mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
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 <kitlith@kitl.pw> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39414>
This commit is contained in:
parent
6eadcaa851
commit
18d3b7d623
1 changed files with 25 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue