Skip to content

Commit 3fcfd1d

Browse files
committed
tu/wsi: allow presentation on non-DRM devices (KGSL)
tu_wsi_can_present_on_device() uses wsi_common_drm_devices_equal() to match the GPU device against the display fd by calling drmGetDevice2(). However, KGSL exposes the GPU via /dev/kgsl-3d0, which is not part of the DRM subsystem. As a result, drmGetDevice2() always fails on the KGSL local_fd, causing can_present_on_device() to unconditionally return false and making vkCreateSwapchainKHR fail on all Adreno devices using the KGSL kernel driver. Fix this by detecting the KGSL case: if the DRM device comparison fails and no DRM master fd is present (master_fd == -1), skip the check and allow presentation on any display fd. This restores swapchain creation on Adreno 725 and similar devices running in Android container environments with KGSL. Fixes: vkcube crashing at demo_prepare_buffers on Adreno 725 (KGSL path)
1 parent 3b064f5 commit 3fcfd1d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/freedreno/vulkan/tu_wsi.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ tu_wsi_can_present_on_device(VkPhysicalDevice physicalDevice, int fd)
2727
{
2828
#ifdef HAVE_LIBDRM
2929
VK_FROM_HANDLE(tu_physical_device, pdevice, physicalDevice);
30+
/* KGSL uses /dev/kgsl-3d0 which is not a DRM device, so drmGetDevice2()
31+
* fails on local_fd. In this case, we allow presentation on any display fd
32+
* since there is no reliable way to match them via the DRM subsystem.
33+
*/
34+
if (!wsi_common_drm_devices_equal(fd, pdevice->local_fd) &&
35+
pdevice->master_fd == -1)
36+
return true;
3037
return wsi_common_drm_devices_equal(fd, pdevice->local_fd);
3138
#else
3239
return true;

0 commit comments

Comments
 (0)