From 996e6905ba0ec3d8416c9332109d0805f68167e7 Mon Sep 17 00:00:00 2001
From: Bruno Macabeus <macabeus@users.noreply.github.com>
Date: Wed, 13 Jan 2021 09:53:13 +0000
Subject: [PATCH] android-fence: call callback when fence is invalid (#1881)

---
 .../HOS/Services/SurfaceFlinger/Types/AndroidFence.cs    | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/AndroidFence.cs b/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/AndroidFence.cs
index 62c53f2d62..515efd0536 100644
--- a/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/AndroidFence.cs
+++ b/Ryujinx.HLE/HOS/Services/SurfaceFlinger/Types/AndroidFence.cs
@@ -70,7 +70,14 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
         {
             ref NvFence fence = ref NvFences[FenceCount - 1];
 
-            gpuContext.Synchronization.RegisterCallbackOnSyncpoint(fence.Id, fence.Value, callback);
+            if (fence.IsValid())
+            {
+                gpuContext.Synchronization.RegisterCallbackOnSyncpoint(fence.Id, fence.Value, callback);
+            }
+            else
+            {
+                callback();
+            }
         }
 
         public uint GetFlattenedSize()