From bc848da244128ec00768ae49ef267b73049b2946 Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Tue, 7 Apr 2026 13:33:40 -0700 Subject: [PATCH] gfxstream: fix goldfish guards on fence functions ... to ensure that "mSyncHelper->close()" still happens on non goldfish devices. Android equivalent ag/39315505 for b/500332164 Tested with CtsGraphicsTestCases after the build file changes. Part-of: --- src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp index b35236f9698..40101545f03 100644 --- a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp +++ b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp @@ -4829,14 +4829,16 @@ VkResult ResourceTracker::on_vkResetFences(void* context, VkResult, VkDevice dev auto& info = it->second; if (!info.external) continue; -#if GFXSTREAM_ENABLE_GUEST_GOLDFISH if (info.syncFd && *info.syncFd >= 0) { MESA_TRACE_SCOPE("%s: resetting fence. make fd -1\n", __func__); + +#if GFXSTREAM_ENABLE_GUEST_GOLDFISH goldfish_sync_signal(*info.syncFd); +#endif + mSyncHelper->close(*info.syncFd); } info.syncFd.reset(); -#endif } return res; @@ -4873,13 +4875,15 @@ VkResult ResourceTracker::on_vkImportFenceFdKHR(void* context, VkResult, VkDevic auto& info = it->second; -#if GFXSTREAM_ENABLE_GUEST_GOLDFISH if (info.syncFd && *info.syncFd >= 0) { MESA_TRACE_SCOPE("%s: previous sync fd exists, close it\n", __func__); + +#if GFXSTREAM_ENABLE_GUEST_GOLDFISH goldfish_sync_signal(*info.syncFd); +#endif + mSyncHelper->close(*info.syncFd); } -#endif if (pImportFenceFdInfo->fd < 0) { MESA_TRACE_SCOPE("%s: import -1, set to -1 and exit\n", __func__);