mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 16:00:08 +01:00
pvr: copy WSI can_present_on_device function from PanVK
Both PVR and PanVK are drivers for generic embedded GPU IP cores, so just take the can_present_on_device implementation from PanVK, which allows any platform devices for presentation. Signed-off-by: Icenowy Zheng <uwu@icenowy.me> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38985>
This commit is contained in:
parent
8b8e472c65
commit
6bda88bfdb
1 changed files with 12 additions and 0 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <xf86drm.h>
|
||||
|
||||
#include "pvr_device.h"
|
||||
#include "pvr_entrypoints.h"
|
||||
|
|
@ -50,6 +51,16 @@ static PFN_vkVoidFunction pvr_wsi_proc_addr(VkPhysicalDevice physicalDevice,
|
|||
return vk_instance_get_proc_addr_unchecked(&pdevice->instance->vk, pName);
|
||||
}
|
||||
|
||||
static bool pvr_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 pvr_wsi_init(struct pvr_physical_device *pdevice)
|
||||
{
|
||||
VkResult result;
|
||||
|
|
@ -65,6 +76,7 @@ VkResult pvr_wsi_init(struct pvr_physical_device *pdevice)
|
|||
return result;
|
||||
|
||||
pdevice->wsi_device.supports_modifiers = false;
|
||||
pdevice->wsi_device.can_present_on_device = pvr_can_present_on_device;
|
||||
pdevice->vk.wsi_device = &pdevice->wsi_device;
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue