From 7369b1a21ee7425492eaa2e2fece0c5e0a34ba99 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 16 Jun 2021 14:33:57 +0200 Subject: [PATCH] vulkan/wsi/wayland: simplify wl_surface version check No need to cast to a wl_proxy, there is a wl_surface variant available. No need to cache the result of get_version(), this is just a one-line getter and doesn't perform any roundtrip. Signed-off-by: Simon Ser Reviewed-by: Jason Ekstrand Reviewed-by: Daniel Stone Part-of: --- src/vulkan/wsi/wsi_common_wayland.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index e2a7d337ecf..d325f9746cd 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -730,7 +730,6 @@ struct wsi_wl_swapchain { struct wsi_wl_display *display; struct wl_surface * surface; - uint32_t surface_version; /* non-NULL when wl_drm should be used for wl_buffer creation; otherwise, * zwp_linux_dmabuf_v1 should be used. @@ -871,7 +870,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, assert(image_index < chain->base.image_count); wl_surface_attach(chain->surface, chain->images[image_index].buffer, 0, 0); - if (chain->surface_version >= 4 && damage && + if (wl_surface_get_version(chain->surface) >= 4 && damage && damage->pRectangles && damage->rectangleCount > 0) { for (unsigned i = 0; i < damage->rectangleCount; i++) { const VkRectLayerKHR *rect = &damage->pRectangles[i]; @@ -1088,7 +1087,6 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, } wl_proxy_set_queue((struct wl_proxy *) chain->surface, chain->display->queue); - chain->surface_version = wl_proxy_get_version((void *)surface->surface); chain->num_drm_modifiers = 0; chain->drm_modifiers = 0;