From 4add1273f5af2bfddbb2f79105a54989e96c536d Mon Sep 17 00:00:00 2001 From: Frank Binns Date: Mon, 4 Dec 2023 11:48:05 +0000 Subject: [PATCH] pvr: alloc WSI memory via GPU when there isn't a valid display FD This isn't currently causing any issues as the driver only supports the VK_KHR_display extension for now, so there will always be a valid display FD when a WSI allocation is requested. However, checking that we have a valid display FD when attempting to allocate via the display driver is more correct and, when we come to support VK_KHR_wayland_surface, will avoid vkAllocateMemory() unnecessarily failing. This addresses a comment made here: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15507#note_2188052 Signed-off-by: Frank Binns Reviewed-by: Luigi Santivetti Part-of: --- src/imagination/vulkan/pvr_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index d598cb8a8a7..34f1fa19378 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -2078,7 +2078,8 @@ VkResult pvr_AllocateMemory(VkDevice _device, vk_foreach_struct_const (ext, pAllocateInfo->pNext) { switch ((unsigned)ext->sType) { case VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA: - type = PVR_WINSYS_BO_TYPE_DISPLAY; + if (device->ws->display_fd >= 0) + type = PVR_WINSYS_BO_TYPE_DISPLAY; break; case VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR: fd_info = (void *)ext;