Mesa (main): vulkan/wsi/wayland: Fix add_drm_format_modifier aplha/opaqueness.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 31 18:31:02 UTC 2022


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

Author: Georg Lehmann <dadschoorse at gmail.com>
Date:   Tue Jan 18 00:38:10 2022 +0100

vulkan/wsi/wayland: Fix add_drm_format_modifier aplha/opaqueness.

This had the opposite problem of the shm path. R8G8B8A8 was always support if
either DRM_FORMAT_XBGR8888 or DRM_FORMAT_ABGR8888 was supported, but we need
both.

Fixes: d944136f363 ("vulkan/wsi/wayland: don't expose surface formats not fully supported")

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

---

 src/vulkan/wsi/wsi_common_wayland.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index b9db002ac32..1e37ae32f13 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -298,14 +298,21 @@ wsi_wl_display_add_drm_format_modifier(struct wsi_wl_display *display,
          wsi_wl_format_add_modifier(format, modifier);
       if (srgb_format)
          wsi_wl_format_add_modifier(srgb_format, modifier);
-      FALLTHROUGH;
+
+      srgb_format = wsi_wl_display_add_vk_format(display, formats,
+                                                 VK_FORMAT_R8G8B8A8_SRGB,
+                                                 false, true);
+      format = wsi_wl_display_add_vk_format(display, formats,
+                                            VK_FORMAT_R8G8B8A8_UNORM,
+                                            false, true);
+      break;
    case DRM_FORMAT_ABGR8888:
       srgb_format = wsi_wl_display_add_vk_format(display, formats,
                                                  VK_FORMAT_R8G8B8A8_SRGB,
-                                                 true, true);
+                                                 true, false);
       format = wsi_wl_display_add_vk_format(display, formats,
                                             VK_FORMAT_R8G8B8A8_UNORM,
-                                            true, true);
+                                            true, false);
       break;
    case DRM_FORMAT_XRGB8888:
       srgb_format = wsi_wl_display_add_vk_format(display, formats,
@@ -319,14 +326,20 @@ wsi_wl_display_add_drm_format_modifier(struct wsi_wl_display *display,
       if (srgb_format)
          wsi_wl_format_add_modifier(srgb_format, modifier);
 
-      FALLTHROUGH;
+      srgb_format = wsi_wl_display_add_vk_format(display, formats,
+                                                 VK_FORMAT_B8G8R8A8_SRGB,
+                                                 false, true);
+      format = wsi_wl_display_add_vk_format(display, formats,
+                                            VK_FORMAT_B8G8R8A8_UNORM,
+                                            false, true);
+      break;
    case DRM_FORMAT_ARGB8888:
       srgb_format = wsi_wl_display_add_vk_format(display, formats,
                                                  VK_FORMAT_B8G8R8A8_SRGB,
-                                                 true, true);
+                                                 true, false);
       format = wsi_wl_display_add_vk_format(display, formats,
                                             VK_FORMAT_B8G8R8A8_UNORM,
-                                            true, true);
+                                            true, false);
       break;
    }
 



More information about the mesa-commit mailing list