Enqueue frame before signalling the frame is ready. (#2722)

It seems that certain games (Link's Awakening, Xenoblade DE) had their fences reached already when posting framebuffers, so the signal that a frame was ready would go out _before_ the frame was enqueued, and the render loop would fail to dequeue anything and "skip" a frame.

This was resulting in their performance lowering dramatically after some loading transitions, as a frame signal would be consumed and presentation would be one frame behind.

It's possible this might have eventually caused deadlocks in these games or others, if it happened twice.
This commit is contained in:
riperiperi 2021-10-12 22:29:50 +01:00 committed by GitHub
parent 0bce4a074a
commit a2c6cd5132
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -370,20 +370,6 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Item = item Item = item
}; };
if (item.Fence.FenceCount == 0)
{
_device.Gpu.Window.SignalFrameReady();
_device.Gpu.GPFifo.Interrupt();
}
else
{
item.Fence.RegisterCallback(_device.Gpu, () =>
{
_device.Gpu.Window.SignalFrameReady();
_device.Gpu.GPFifo.Interrupt();
});
}
_device.Gpu.Window.EnqueueFrameThreadSafe( _device.Gpu.Window.EnqueueFrameThreadSafe(
layer.Owner, layer.Owner,
frameBufferAddress, frameBufferAddress,
@ -398,6 +384,20 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
AcquireBuffer, AcquireBuffer,
ReleaseBuffer, ReleaseBuffer,
textureCallbackInformation); textureCallbackInformation);
if (item.Fence.FenceCount == 0)
{
_device.Gpu.Window.SignalFrameReady();
_device.Gpu.GPFifo.Interrupt();
}
else
{
item.Fence.RegisterCallback(_device.Gpu, () =>
{
_device.Gpu.Window.SignalFrameReady();
_device.Gpu.GPFifo.Interrupt();
});
}
} }
private void ReleaseBuffer(object obj) private void ReleaseBuffer(object obj)