Mesa (main): vulkan/wsi/wayland: use enum wl_shm_format

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 1 08:47:20 UTC 2022


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

Author: Simon Ser <contact at emersion.fr>
Date:   Thu Jan 20 12:05:21 2022 +0100

vulkan/wsi/wayland: use enum wl_shm_format

libwayland defines an enum for wl_shm formats. Let's use it instead
of uint32_t.

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

---

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

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 4cd122b7a6c..9463a9c55bc 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -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;



More information about the mesa-commit mailing list