summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kurzinger <ekurzinger@nvidia.com>2024-04-10 11:14:58 -0700
committerMarge Bot <emma+marge@anholt.net>2024-04-10 23:08:36 +0000
commitc1401fda8a0ee29dc3ff878c438510b00031265c (patch)
tree121a2811766a066df0f12d7e356a44d958e566e3
parent44db558ceadc2450149f8cecb5e31372744c3611 (diff)
wsi/wayland: don't use explicit sync with sw
When using software rendering with the Wayland WSI we should not try to use explicit sync even if it is supported by the compositor. Not only is it not necessary in that case, but the protocol explicitly disallows using it with shared memory buffers. As a fix, first we modify wsi_configure_cpu_image to not set info->explicit_sync to true for CPU images. However, we still want the implicit_sync parameter in wsi_create_buffer_blit_context to be set to false since CPU images don't need implicit sync either. To ensure that remains so, we add a new field to wsi_image_info tracking the image type, and then only enable implicit sync for DRM images when explicit sync is not supported. Additionally, we modify wsi_wl_use_explicit_sync to return false when device->sw is true. Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28678>
-rw-r--r--src/vulkan/wsi/wsi_common.c5
-rw-r--r--src/vulkan/wsi/wsi_common_private.h1
-rw-r--r--src/vulkan/wsi/wsi_common_wayland.c2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index ad38bce0aa3..024c20f1530 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -371,6 +371,7 @@ configure_image(const struct wsi_swapchain *chain,
const struct wsi_base_image_params *params,
struct wsi_image_info *info)
{
+ info->image_type = params->image_type;
switch (params->image_type) {
case WSI_IMAGE_TYPE_CPU: {
const struct wsi_cpu_image_params *cpu_params =
@@ -1804,7 +1805,8 @@ wsi_create_buffer_blit_context(const struct wsi_swapchain *chain,
struct wsi_memory_allocate_info memory_wsi_info = {
.sType = VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA,
.pNext = NULL,
- .implicit_sync = !info->explicit_sync,
+ .implicit_sync = info->image_type == WSI_IMAGE_TYPE_DRM &&
+ !info->explicit_sync,
};
VkMemoryDedicatedAllocateInfo buf_mem_dedicated_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
@@ -2200,7 +2202,6 @@ wsi_configure_cpu_image(const struct wsi_swapchain *chain,
1 /* size_align */,
info);
- info->explicit_sync = true;
info->select_blit_dst_memory_type = wsi_select_host_memory_type;
info->select_image_memory_type = wsi_select_device_memory_type;
info->create_mem = wsi_create_cpu_buffer_image_mem;
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 3f7a9954a23..7767f7b8431 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -85,6 +85,7 @@ struct wsi_image_info {
VkImageFormatListCreateInfo format_list;
VkImageDrmFormatModifierListCreateInfoEXT drm_mod_list;
+ enum wsi_image_type image_type;
bool explicit_sync;
bool prime_use_linear_modifier;
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index f32874d50f1..4583f9efad3 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -208,7 +208,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(wsi_wl_swapchain, base.base, VkSwapchainKHR,
static bool
wsi_wl_use_explicit_sync(struct wsi_wl_display *display, struct wsi_device *device)
{
- return device->has_timeline_semaphore &&
+ return !device->sw && device->has_timeline_semaphore &&
(device->timeline_semaphore_export_handle_types & VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT) &&
display->wl_syncobj != NULL;
}