Skip to content

tu/kgsl: Fix patched Turnip for Adreno 830/840#54

Merged
lfdevs merged 1 commit into
dev/adreno-mainfrom
test/fix-patched-turnip
May 11, 2026
Merged

tu/kgsl: Fix patched Turnip for Adreno 830/840#54
lfdevs merged 1 commit into
dev/adreno-mainfrom
test/fix-patched-turnip

Conversation

@lfdevs
Copy link
Copy Markdown
Owner

@lfdevs lfdevs commented Apr 25, 2026

Currently, the Turnip driver from the standard release (whose release title doesn't have the turnip- prefix) fails to work on most Adreno GPUs, and the possible error messages are as follows. This PR aims to fix this issue.

[Vulkan Loader] WARNING | LAYER: env var 'VK_INSTANCE_LAYERS' defined and adding layers "VK_LAYER_KHRONOS_validation"
[Vulkan Loader] ERROR | LAYER:  Layer "VK_LAYER_KHRONOS_validation" was not found but was requested by env var VK_INSTANCE_LAYERS!
[Vulkan Loader] WARNING | LAYER: env var 'VK_INSTANCE_LAYERS' defined and adding layers "VK_LAYER_KHRONOS_validation"
[Vulkan Loader] ERROR | LAYER:  Layer "VK_LAYER_KHRONOS_validation" was not found but was requested by env var VK_INSTANCE_LAYERS!
[Vulkan Loader] LAYER:          vkCreateInstance layer callstack setup to:
[Vulkan Loader] LAYER:             <Application>
[Vulkan Loader] LAYER:               ||
[Vulkan Loader] LAYER:             <Loader>
[Vulkan Loader] LAYER:               ||
[Vulkan Loader] LAYER:             <Drivers>
TU: info: TU_DEBUG=0x20003
TU: info: Created an instance
[Vulkan Loader] ERROR:          setup_loader_term_phys_devs: Call to 'vkEnumeratePhysicalDevices' in ICD /usr/lib/aarch64-linux-gnu/libvulkan_freedreno.so failed with error code -3
[Vulkan Loader] ERROR:          setup_loader_term_phys_devs:  Failed to detect any valid GPUs in the current config
vkcube: ./cube/cube.c:4153: demo_select_physical_device: Assertion `!err' failed.

@lfdevs lfdevs marked this pull request as ready for review April 25, 2026 07:30
@lfdevs lfdevs force-pushed the test/fix-patched-turnip branch from 07c519b to 9e2f19d Compare April 25, 2026 08:02
@lfdevs lfdevs force-pushed the test/fix-patched-turnip branch 2 times, most recently from dbec508 to 3b064f5 Compare April 25, 2026 10:19
@lfdevs lfdevs marked this pull request as draft April 25, 2026 10:28
@lfdevs
Copy link
Copy Markdown
Owner Author

lfdevs commented Apr 28, 2026

Note

The driver built by this PR contains both patched Freedreno & Turnip, no need to install unpatched Turnip again.

Build artifacts: https://github.com/lfdevs/mesa-for-android-container/actions/runs/25629402080?pr=54#artifacts
It is worth mentioning that the directly downloaded file is a .zip archive, which needs to be unzipped once to get the .tar.gz installation package.

The vkcube test results are as follows:

Device GPU vkcube
REDMI K80 Pro Adreno 830 ✔️
Xiaomi Pad 6 Pro Adreno 730

Tips: When testing vkmark, it is recommended to add the parameter --winsys xcb, see: #51 (comment)

If vkcube fails to run, you can use the following environment variables to get detailed logs. This is very helpful for locating issues:

export VK_LOADER_DEBUG=all MESA_DEBUG=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation TU_DEBUG=startup,log,perf,nir FD_RD_DUMP=enable

This was referenced Apr 28, 2026
@lfdevs lfdevs force-pushed the test/fix-patched-turnip branch from 3fcfd1d to b0bb7e4 Compare May 7, 2026 16:38
@lfdevs lfdevs force-pushed the dev/adreno-main branch from fc84739 to 2fd93cb Compare May 10, 2026 12:56
@lfdevs lfdevs force-pushed the test/fix-patched-turnip branch from b0bb7e4 to e201189 Compare May 10, 2026 13:00
Currently, `tu_knl_kgsl_load` explicitly fails with `VK_ERROR_INITIALIZATION_FAILED`
if the application enables the `VK_KHR_display` instance extension.

This causes applications that blindly enable all available instance extensions
(such as `vkcube` or WSI layers) to fail device enumeration completely
in environments where KMS/DRM support is compiled alongside KGSL (i.e. when
VK_USE_PLATFORM_DISPLAY_KHR is exposed).

The proper WSI display fallback behavior (returning 0 displays when the DRM
master fd is invalid/missing) is already correctly handled by `wsi_display_init_wsi`
and `wsi_GetPhysicalDeviceDisplayPropertiesKHR`. Thus, it is safe and more
compliant to drop this aggressive check, allowing Vulkan physical device
enumeration to succeed even if the display extension was requested.
@lfdevs lfdevs force-pushed the test/fix-patched-turnip branch from e201189 to 817b8dd Compare May 11, 2026 14:25
@lfdevs lfdevs changed the title tu/kgsl: Fix patched Turnip tu/kgsl: Fix patched Turnip for Adreno 830/840 May 11, 2026
@lfdevs lfdevs marked this pull request as ready for review May 11, 2026 14:27
@lfdevs lfdevs merged commit 3743cc8 into dev/adreno-main May 11, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant