Mesa (main): vulkan/wsi/wayland: simplify wl_surface version check

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 21 20:21:49 UTC 2021


Module: Mesa
Branch: main
Commit: 7369b1a21ee7425492eaa2e2fece0c5e0a34ba99
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7369b1a21ee7425492eaa2e2fece0c5e0a34ba99

Author: Simon Ser <contact at emersion.fr>
Date:   Wed Jun 16 14:33:57 2021 +0200

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 <contact at emersion.fr>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Daniel Stone <daniels at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11420>

---

 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;



More information about the mesa-commit mailing list