Skip to content

Commit fdfca07

Browse files
Ikshwaku Chauhanaleasto
Ikshwaku Chauhan
authored andcommitted
CHROMIUM: vulkan/runtime: Wait on Android acquire fence on CPU.
This works around stuck fences. Waiting on the CPU here can be a "Quality of Implementation" issue and might result in lower perf. However, this is overall very unlikely and this is the same behavior as the Intel driver does so this is very low risk. Ported for Mesa-22.0.3 form https://chromium-review.googlesource.com/c/chromiumos/third_party/mesa/+/3158739/2 BUG=b:270499011,b:245687382,b:237232102,b:194858164,b:199406573,b:207433028 TEST=Pass CQ dry run Change-Id: Iddfd2a75725dd93303db30605524cbe93c80e694 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/mesa/+/4405525 Commit-Queue: Ilja Friedel <[email protected]> Reviewed-by: Ilja Friedel <[email protected]> Tested-by: Ilja Friedel <[email protected]>
1 parent 117a999 commit fdfca07

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/vulkan/runtime/vk_android.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,17 @@ vk_common_AcquireImageANDROID(VkDevice _device,
800800
}
801801
}
802802

803+
/* Workaround: If we don't wait on the CPU here fences can get stuck. Details
804+
* are still TBD but from a historical similar issue this is likely due to
805+
* rendering too far ahead and getting cycles with implicit sync.
806+
*/
807+
if (nativeFenceFd >= 0) {
808+
if (sync_wait(nativeFenceFd, -1) < 0) {
809+
close(nativeFenceFd);
810+
return VK_ERROR_DEVICE_LOST;
811+
}
812+
}
813+
803814
if (semaphore != VK_NULL_HANDLE) {
804815
const VkImportSemaphoreFdInfoKHR info = {
805816
.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR,

0 commit comments

Comments
 (0)