From 18d3b7d623248511b8a5fd75feefe735db9b289f Mon Sep 17 00:00:00 2001 From: Kitlith Date: Mon, 19 Jan 2026 22:42:58 -0800 Subject: [PATCH] hk: override can_present_on_device Drivers for non-PCI based GPUs are expected to override this function. This enables successful usage of VK_EXT_acquire_drm_display. Signed-off-by: Kitlith Part-of: --- src/asahi/vulkan/hk_wsi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/asahi/vulkan/hk_wsi.c b/src/asahi/vulkan/hk_wsi.c index b95d09a7d97..69621b291b6 100644 --- a/src/asahi/vulkan/hk_wsi.c +++ b/src/asahi/vulkan/hk_wsi.c @@ -8,6 +8,8 @@ #include "hk_instance.h" #include "wsi_common.h" +#include + static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL hk_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName) { @@ -15,6 +17,28 @@ hk_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName) return vk_instance_get_proc_addr_unchecked(pdev->vk.instance, pName); } +static bool +hk_wsi_can_present_on_device(VkPhysicalDevice physicalDevice, int fd) +{ + VK_FROM_HANDLE(hk_physical_device, pdev, physicalDevice); + if (pdev->dev.is_virtio) { + return false; + } + + drmDevicePtr device; + if (drmGetDevice2(fd, 0, &device) != 0) { + return false; + } + + /* Allow on-device presentation for all non-virtio devices with bus type + * PLATFORM */ + bool match = device->bustype == DRM_BUS_PLATFORM; + + drmFreeDevice(&device); + + return match; +} + VkResult hk_init_wsi(struct hk_physical_device *pdev) { @@ -30,6 +54,7 @@ hk_init_wsi(struct hk_physical_device *pdev) pdev->wsi_device.supports_scanout = false; pdev->wsi_device.supports_modifiers = true; + pdev->wsi_device.can_present_on_device = hk_wsi_can_present_on_device; pdev->vk.wsi_device = &pdev->wsi_device;