hk: 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

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 <kitlith@kitl.pw>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39414>
This commit is contained in:
Kitlith 2026-01-19 22:42:58 -08:00 committed by Marge Bot
parent 6eadcaa851
commit 18d3b7d623

View file

@ -8,6 +8,8 @@
#include "hk_instance.h"
#include "wsi_common.h"
#include <xf86drm.h>
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;