vulkan/wsi/wayland: use enum wl_shm_format
authorSimon Ser <contact@emersion.fr>
Thu, 20 Jan 2022 11:05:21 +0000 (12:05 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 1 Feb 2022 08:00:22 +0000 (08:00 +0000)
libwayland defines an enum for wl_shm formats. Let's use it instead
of uint32_t.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14634>

src/vulkan/wsi/wsi_common_wayland.c

index 4cd122b..9463a9c 100644 (file)
@@ -352,7 +352,7 @@ wsi_wl_display_add_drm_format_modifier(struct wsi_wl_display *display,
 static void
 wsi_wl_display_add_wl_shm_format(struct wsi_wl_display *display,
                                  struct u_vector *formats,
-                                 uint32_t wl_shm_format)
+                                 enum wl_shm_format wl_shm_format)
 {
    switch (wl_shm_format) {
    case WL_SHM_FORMAT_XBGR8888:
@@ -399,6 +399,8 @@ wsi_wl_display_add_wl_shm_format(struct wsi_wl_display *display,
                                    VK_FORMAT_B8G8R8A8_UNORM,
                                    true, false);
       break;
+   default:
+      break; /* Ignore */
    }
 }
 
@@ -451,7 +453,7 @@ wl_drm_format_for_vk_format(VkFormat vk_format, bool alpha)
    }
 }
 
-static uint32_t
+static enum wl_shm_format
 wl_shm_format_for_vk_format(VkFormat vk_format, bool alpha)
 {
    switch (vk_format) {
@@ -953,7 +955,7 @@ struct wsi_wl_swapchain {
    VkExtent2D                                   extent;
    VkFormat                                     vk_format;
    uint32_t                                     drm_format;
-   uint32_t                                     shm_format;
+   enum wl_shm_format                           shm_format;
 
    uint32_t                                     num_drm_modifiers;
    const uint64_t *                             drm_modifiers;