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 <frank.binns@imgtec.com>
Reviewed-by: Luigi Santivetti <luigi.santivetti@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26516>
This commit is contained in:
Frank Binns
2023-12-04 11:48:05 +00:00
committed by Marge Bot
parent 86ab29a4d4
commit 4add1273f5

View File

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