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@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>
This commit is contained in:
Simon Ser 2021-06-16 14:33:57 +02:00 committed by Marge Bot
parent eb98171252
commit 7369b1a21e
1 changed files with 1 additions and 3 deletions

View 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;