panvk: override can_present_on_device
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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 <christoph.pillmayer@arm.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37543>
This commit is contained in:
Utku Iseri 2025-10-10 13:09:03 +02:00 committed by Marge Bot
parent 0b82b803d9
commit 08da41f2f1

View file

@ -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;