Mesa (main): vulkan/wsi/wayland: check directly if we got globals successfully

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 16 08:56:09 UTC 2021


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

Author: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Date:   Wed Jul 28 13:51:45 2021 -0300

vulkan/wsi/wayland: check directly if we got globals successfully

Until now we had a weird way to bail out if we could not get any
globals. Instead, add a direct check, what makes the code easier to
read.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro at collabora.com>
Reviewed-by: Simon Ser <contact at emersion.fr>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Acked-by: Daniel Stone <daniels at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>

---

 src/vulkan/wsi/wsi_common_wayland.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 6fa9b6a5438..d89982eaca1 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -486,10 +486,13 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
 
    /* Round-trip to get wl_shm and zwp_linux_dmabuf_v1 globals */
    wl_display_roundtrip_queue(display->wl_display, display->queue);
+   if (!display->dmabuf.wl_dmabuf && !display->swrast.wl_shm) {
+      result = VK_ERROR_SURFACE_LOST_KHR;
+      goto fail_registry;
+   }
 
    /* Round-trip again to get formats and modifiers */
-   if (display->dmabuf.wl_dmabuf || display->swrast.wl_shm)
-      wl_display_roundtrip_queue(display->wl_display, display->queue);
+   wl_display_roundtrip_queue(display->wl_display, display->queue);
 
    if (wsi_wl->wsi->force_bgra8_unorm_first) {
       /* Find BGRA8_UNORM in the list and swap it to the first position if we
@@ -511,11 +514,6 @@ wsi_wl_display_init(struct wsi_wayland *wsi_wl,
    else if (display->dmabuf.wl_dmabuf)
       display->formats = &display->dmabuf.formats;
 
-   if (!display->formats) {
-      result = VK_ERROR_SURFACE_LOST_KHR;
-      goto fail_registry;
-   }
-
    /* We don't need this anymore */
    wl_registry_destroy(registry);
 



More information about the mesa-commit mailing list