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@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12117>
This commit is contained in:
Leandro Ribeiro 2021-07-28 13:51:45 -03:00 committed by Simon Ser
parent e090316570
commit 4bf011a768

View file

@ -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);