Skip to content

venus: integrate syncFdFencing feature

Yiwei Zhang requested to merge zzyiwei/mesa:vn-reset-sync into main

The problems:

  1. sync_fd external fence/sempahore export is broken
    • vkGetFenceFdKHR implies a fence reset op which is missing
    • vkGetSemaphoreFdKHR implies a sempahore wait op which is missing
  2. queue submission/bindsparse's scrub of wsi sempahore is broken
    • timeline semaphore wait struct and device group struct miss to be scrubed
  3. sync fd payload is waited until signal upon importing into fence or semaphore
    • We can entirely hide the fence part
    • For semaphore, hwc release fence waiting should be on the gpu timeline, but not cpu. We can do our best to defer the wait to submission time (before we have sync resource).

This MR:

  • Initial commits fix a bunch of bugs (independent from the main globalFencing bug to be fixed) and do some nice refactorings
  • Bring in venus protocol support for syncFdFencing, which provides ways to:
    • vkResetFenceResource100000MESA: reset the host fence when guest export sync fd
    • vkWaitSemaphoreResource100000MESA: wait the host semaphore when guest export sync fd
    • vkImportSemaphoreResource100000MESA: fix the ambiguous sempahore permanent payload for imported case
      • this API can also help fix problem (2) by not scrubing but importing signaled payload to the wsi semaphore on the host side
      • this API is also forward compatible with further fencing with sync resource
    • This fixes problem (1) without breaking backcompat
  • Re-implement sync_fd fence to actually import the fd instead of importing signaled payload after sync_wait
    • This fixes the fence part of problem (3)
  • Re-implement sync_fd semaphore to defer the imported sync file waiting until submission
    • This fixes the semaphore part of problem (3)
  • Import signaled sync_fd -1 to wait sempahores to avoid processing the submission batches
    • This is only active when renderer supports sync fd semaphore import
    • This fixes problem (2)

(optional) land a workaround for https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/4402

Expectations;

  • the re-implementation makes the driver sync_fd fencing behavior conformant
  • the followups for defering sem/fence wait boost performance for lots of titles by hiding the waiting for HWC fence signal
  • the followups for importing sync fd -1 avoid the overhead for driver submission and more importantly fix bugs

Test:

  • dEQP-VK: wsi.android., api.external.
  • dEQP-EGL, dEQP-GLES2, dEQP-GLES3, dEQP-GLES31
  • Android 11 CTS
    Total Tests PASSED FAILED IGNORED
    CtsGraphicsTestCases 3179 3177 0 2
    CtsUiRenderingTestCases 419 418 0 1
    CtsViewTestCases 1072 1069 0 3
    CtsCameraTestCases 569 569 0 0
    CtsMediaTestCases DecodeAccuracyTest 396 396 0 0
    CtsMediaTestCases EncodeDecodeTest 28 28 0 0
    CtsVideoTestCases 763 763 0 0
  • Popular titles run fine
  • Timeline sempahore demo app works fine with WSI semaphores

Related MRs:

Edited by Yiwei Zhang

Merge request reports

Loading