From c1a62476acefcc94de9fd8e7f74d6bd9576796a7 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 21 Feb 2023 08:42:58 -0500 Subject: [PATCH] vulkan/wsi/x11: make 4 image minimum for xwayland driver-specific this avoids adding extra frames of latency to drivers that don't need it Acked-by: Daniel Stone Reviewed-by: Gert Wollny Part-of: --- src/virtio/vulkan/vn_wsi.c | 2 +- src/vulkan/wsi/wsi_common.c | 1 + src/vulkan/wsi/wsi_common.h | 4 ++++ src/vulkan/wsi/wsi_common_x11.c | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/virtio/vulkan/vn_wsi.c b/src/virtio/vulkan/vn_wsi.c index 0acacb23b52..5f9cc4ce558 100644 --- a/src/virtio/vulkan/vn_wsi.c +++ b/src/virtio/vulkan/vn_wsi.c @@ -81,7 +81,7 @@ vn_wsi_init(struct vn_physical_device *physical_dev) VkResult result = wsi_device_init( &physical_dev->wsi_device, vn_physical_device_to_handle(physical_dev), vn_wsi_proc_addr, alloc, -1, &physical_dev->instance->dri_options, - &(struct wsi_device_options){.sw_device = false}); + &(struct wsi_device_options){.sw_device = false, .extra_xwayland_image = true}); if (result != VK_SUCCESS) return result; diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 8a6f6557fbe..a9895d91e02 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -81,6 +81,7 @@ wsi_device_init(struct wsi_device *wsi, wsi->supports_scanout = true; wsi->sw = device_options->sw_device || (WSI_DEBUG & WSI_DEBUG_SW); wsi->wants_linear = (WSI_DEBUG & WSI_DEBUG_LINEAR) != 0; + wsi->x11.extra_xwayland_image = device_options->extra_xwayland_image; #define WSI_GET_CB(func) \ PFN_vk##func func = (PFN_vk##func)proc_addr(pdevice, "vk" #func) WSI_GET_CB(GetPhysicalDeviceExternalSemaphoreProperties); diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index b357354c202..6ebbf2dbe34 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -145,6 +145,9 @@ struct wsi_device { * true. */ bool xwaylandWaitReady; + + /* adds an extra minImageCount when running under xwayland */ + bool extra_xwayland_image; } x11; struct { @@ -257,6 +260,7 @@ typedef PFN_vkVoidFunction (VKAPI_PTR *WSI_FN_GetPhysicalDeviceProcAddr)(VkPhysi struct wsi_device_options { bool sw_device; + bool extra_xwayland_image; }; VkResult diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 6de51942301..3c620be0453 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -652,10 +652,10 @@ x11_get_min_image_count(const struct wsi_device *wsi_device, bool is_xwayland) * This is a tradeoff as it uses more memory than needed for non-fullscreen * and non-performance intensive applications. * - * For Xwayland we report four images as describes in + * For Xwayland Venus reports four images as described in * wsi_wl_surface_get_capabilities */ - return is_xwayland ? 4 : 3; + return is_xwayland && wsi_device->x11.extra_xwayland_image ? 4 : 3; } static VkResult