From 08da41f2f198571d7aac23c75bcf076517047226 Mon Sep 17 00:00:00 2001 From: Utku Iseri Date: Fri, 10 Oct 2025 13:09:03 +0200 Subject: [PATCH] panvk: override can_present_on_device Non-PCI devices are responsible for checking device matches themselves by overriding can_present_on_device on wsi_device to take the non-blitting WSI path. We can allow on-device presentation for both the display controller, and any panthor node. The simplest way of achieving that is allowing this for all devices with bus type platform, as there's nothing else that has this property. Reviewed-by: Christoph Pillmayer Reviewed-by: Lars-Ivar Hesselberg Simonsen Part-of: --- src/panfrost/vulkan/panvk_wsi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/panfrost/vulkan/panvk_wsi.c b/src/panfrost/vulkan/panvk_wsi.c index a3f1073bdb3..cabb90d14c4 100644 --- a/src/panfrost/vulkan/panvk_wsi.c +++ b/src/panfrost/vulkan/panvk_wsi.c @@ -1,5 +1,6 @@ /* * Copyright © 2021 Collabora Ltd. + * Copyright © 2025 Arm Ltd. * * Derived from tu_wsi.c: * Copyright © 2016 Red Hat @@ -41,6 +42,17 @@ panvk_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName) return vk_instance_get_proc_addr_unchecked(&instance->vk, pName); } +static bool +panvk_can_present_on_device(VkPhysicalDevice pdevice, int fd) +{ + drmDevicePtr device; + if (drmGetDevice2(fd, 0, &device) != 0) + return false; + /* Allow on-device presentation for all devices with bus type PLATFORM. + * Other device types such as PCI or USB should use the PRIME blit path. */ + return device->bustype == DRM_BUS_PLATFORM; +} + VkResult panvk_wsi_init(struct panvk_physical_device *physical_device) { @@ -57,6 +69,8 @@ panvk_wsi_init(struct panvk_physical_device *physical_device) return result; physical_device->wsi_device.supports_modifiers = true; + physical_device->wsi_device.can_present_on_device = + panvk_can_present_on_device; physical_device->vk.wsi_device = &physical_device->wsi_device;