1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-19 13:16:41 +00:00

Allow Surface Flinger frame enqueue after process has exited (#3733)

This commit is contained in:
gdkchan 2022-10-02 18:50:03 -03:00 committed by GitHub
parent 358a781639
commit 81f848e54f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 13 deletions

View file

@ -123,7 +123,8 @@ namespace Ryujinx.Graphics.Gpu
/// <param name="releaseCallback">Texture release callback</param> /// <param name="releaseCallback">Texture release callback</param>
/// <param name="userObj">User defined object passed to the release callback</param> /// <param name="userObj">User defined object passed to the release callback</param>
/// <exception cref="ArgumentException">Thrown when <paramref name="pid"/> is invalid</exception> /// <exception cref="ArgumentException">Thrown when <paramref name="pid"/> is invalid</exception>
public void EnqueueFrameThreadSafe( /// <returns>True if the frame was added to the queue, false otherwise</returns>
public bool EnqueueFrameThreadSafe(
ulong pid, ulong pid,
ulong address, ulong address,
int width, int width,
@ -140,7 +141,7 @@ namespace Ryujinx.Graphics.Gpu
{ {
if (!_context.PhysicalMemoryRegistry.TryGetValue(pid, out var physicalMemory)) if (!_context.PhysicalMemoryRegistry.TryGetValue(pid, out var physicalMemory))
{ {
throw new ArgumentException("The PID is invalid or the process was not registered", nameof(pid)); return false;
} }
FormatInfo formatInfo = new FormatInfo(format, 1, 1, bytesPerPixel, 4); FormatInfo formatInfo = new FormatInfo(format, 1, 1, bytesPerPixel, 4);
@ -184,6 +185,8 @@ namespace Ryujinx.Graphics.Gpu
acquireCallback, acquireCallback,
releaseCallback, releaseCallback,
userObj)); userObj));
return true;
} }
/// <summary> /// <summary>

View file

@ -453,7 +453,7 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Item = item Item = item
}; };
_device.Gpu.Window.EnqueueFrameThreadSafe( if (_device.Gpu.Window.EnqueueFrameThreadSafe(
layer.Owner, layer.Owner,
frameBufferAddress, frameBufferAddress,
frameBufferWidth, frameBufferWidth,
@ -466,20 +466,25 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
crop, crop,
AcquireBuffer, AcquireBuffer,
ReleaseBuffer, ReleaseBuffer,
textureCallbackInformation); textureCallbackInformation))
if (item.Fence.FenceCount == 0)
{ {
_device.Gpu.Window.SignalFrameReady(); if (item.Fence.FenceCount == 0)
_device.Gpu.GPFifo.Interrupt();
}
else
{
item.Fence.RegisterCallback(_device.Gpu, (x) =>
{ {
_device.Gpu.Window.SignalFrameReady(); _device.Gpu.Window.SignalFrameReady();
_device.Gpu.GPFifo.Interrupt(); _device.Gpu.GPFifo.Interrupt();
}); }
else
{
item.Fence.RegisterCallback(_device.Gpu, (x) =>
{
_device.Gpu.Window.SignalFrameReady();
_device.Gpu.GPFifo.Interrupt();
});
}
}
else
{
ReleaseBuffer(textureCallbackInformation);
} }
} }