vulkan/wsi/wayland: simplify wl_surface version check
authorSimon Ser <contact@emersion.fr>
Wed, 16 Jun 2021 12:33:57 +0000 (14:33 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 21 Jun 2021 20:01:28 +0000 (20:01 +0000)
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 <contact@emersion.fr>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11420>

src/vulkan/wsi/wsi_common_wayland.c

index e2a7d33..d325f97 100644 (file)
@@ -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;