aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Synchronization
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-10-19 17:25:32 -0300
committerGitHub <noreply@github.com>2021-10-19 17:25:32 -0300
commit0d174cbd4555e69660a900577a52f3d4bf7391b9 (patch)
treeed68e5f55d2f9ba1d365d877d7f66dad8fa3df19 /Ryujinx.Graphics.Gpu/Synchronization
parent63f1663fa959d8809d1762d99e9364565ba9b3d8 (diff)
EventWait should not signal the event when it returns Success (#2739)
* Fix race when EventWait is called and a wait is done on the CPU * This is useless now * Fix EventSignal * Ensure the signal belongs to the current fence, to avoid stale signals
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Synchronization')
-rw-r--r--Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs4
-rw-r--r--Ryujinx.Graphics.Gpu/Synchronization/Syncpoint.cs8
-rw-r--r--Ryujinx.Graphics.Gpu/Synchronization/SyncpointWaiterHandle.cs2
3 files changed, 7 insertions, 7 deletions
diff --git a/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs b/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
index d246f474..968de930 100644
--- a/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
+++ b/Ryujinx.Graphics.Gpu/Synchronization/SynchronizationManager.cs
@@ -70,7 +70,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
/// <param name="callback">The callback to call when the threshold is reached</param>
/// <exception cref="System.ArgumentOutOfRangeException">Thrown when id >= MaxHardwareSyncpoints</exception>
/// <returns>The created SyncpointWaiterHandle object or null if already past threshold</returns>
- public SyncpointWaiterHandle RegisterCallbackOnSyncpoint(uint id, uint threshold, Action callback)
+ public SyncpointWaiterHandle RegisterCallbackOnSyncpoint(uint id, uint threshold, Action<SyncpointWaiterHandle> callback)
{
if (id >= MaxHardwareSyncpoints)
{
@@ -120,7 +120,7 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
using (ManualResetEvent waitEvent = new ManualResetEvent(false))
{
- var info = _syncpoints[id].RegisterCallback(threshold, () => waitEvent.Set());
+ var info = _syncpoints[id].RegisterCallback(threshold, (x) => waitEvent.Set());
if (info == null)
{
diff --git a/Ryujinx.Graphics.Gpu/Synchronization/Syncpoint.cs b/Ryujinx.Graphics.Gpu/Synchronization/Syncpoint.cs
index 30f8cc86..39fb83c0 100644
--- a/Ryujinx.Graphics.Gpu/Synchronization/Syncpoint.cs
+++ b/Ryujinx.Graphics.Gpu/Synchronization/Syncpoint.cs
@@ -34,13 +34,13 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
/// <param name="threshold">The target threshold</param>
/// <param name="callback">The callback to call when the threshold is reached</param>
/// <returns>The created SyncpointWaiterHandle object or null if already past threshold</returns>
- public SyncpointWaiterHandle RegisterCallback(uint threshold, Action callback)
+ public SyncpointWaiterHandle RegisterCallback(uint threshold, Action<SyncpointWaiterHandle> callback)
{
lock (_waiters)
{
if (Value >= threshold)
{
- callback();
+ callback(null);
return null;
}
@@ -111,13 +111,13 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
// we can't call it inside the lock.
if (expired != null)
{
- expired.Callback();
+ expired.Callback(expired);
if (expiredList != null)
{
for (int i = 0; i < expiredList.Count; i++)
{
- expiredList[i].Callback();
+ expiredList[i].Callback(expiredList[i]);
}
}
}
diff --git a/Ryujinx.Graphics.Gpu/Synchronization/SyncpointWaiterHandle.cs b/Ryujinx.Graphics.Gpu/Synchronization/SyncpointWaiterHandle.cs
index 28ce343e..027b5141 100644
--- a/Ryujinx.Graphics.Gpu/Synchronization/SyncpointWaiterHandle.cs
+++ b/Ryujinx.Graphics.Gpu/Synchronization/SyncpointWaiterHandle.cs
@@ -5,6 +5,6 @@ namespace Ryujinx.Graphics.Gpu.Synchronization
public class SyncpointWaiterHandle
{
internal uint Threshold;
- internal Action Callback;
+ internal Action<SyncpointWaiterHandle> Callback;
}
}