Skip to content

turnip: KGSL backend rewrite

Mark Collins requested to merge PixelyIon/mesa:kgsl-rework into main

This MR rewrites the KGSL backend to utilize vk common wherever possible to bring the codebase in line with DRM while implicitly fixing minor API bugs that may have occurred as a result of manually implementing VK functions. As a part of moving to vk common, KGSL sync is now implemented atop vk common sync and vastly expanded in terms of functionality such as:

  • Import/Export of sync FDs - A required capability for properly supporting the Android WSI and as these functions were stubbed when a presentation operation used semaphores, it would cause a leak of FDs that were imported due to the expectation that the driver would close them. As well as causing UB around due to ignoring the imported FD or not exporting a valid FD.
  • Supporting pre-signalled fences - Vulkan allows fences to be created in a signalled state which was stubbed prior and can lead to UB.
  • Timeline semaphore support - As a result of utilizing vk common as the backbone for synchronization, its timeline semaphore emulation has been utilized to provide support for them without needing kernel support. (Note: On newer versions of KGSL, timeline semaphores can be implemented natively rather than using emulation as they support wait-before-signal)

VK-CTS Tests:

16:13:19.621 29044-29072  I  Test run totals:
16:13:19.621 29044-29072  I    Passed:        9623/56917 (16.9%)
16:13:19.621 29044-29072  I    Failed:        0/56917 (0.0%)
16:13:19.621 29044-29072  I    Not supported: 47294/56917 (83.1%)
16:13:19.621 29044-29072  I    Warnings:      0/56917 (0.0%)
16:13:19.621 29044-29072  I    Waived:        0/56917 (0.0%)

Fixes freezes due to semaphore usage with presentation on:

  • Genshin Impact
  • Skyline Emulator

Merge request reports