vulkan/wsi/wayland: fix ARGB window support
authorFredrik Höglund <fredrik@kde.org>
Fri, 21 Oct 2016 17:07:37 +0000 (19:07 +0200)
committerDave Airlie <airlied@redhat.com>
Wed, 26 Oct 2016 02:40:39 +0000 (12:40 +1000)
Use an ARGB format for the DRM buffer when the compositeAlpha field
in VkSwapchainCreateInfoKHR is set to
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/vulkan/wsi/wsi_common_wayland.c

index fc13bde4005896b70f9c2ab513c2d1cf01daa1ce..196ee28742fd5305540f83ab38317fac0abebf24 100644 (file)
@@ -702,6 +702,9 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
    if (chain == NULL)
       return VK_ERROR_OUT_OF_HOST_MEMORY;
 
+   bool alpha = pCreateInfo->compositeAlpha ==
+                      VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
+
    chain->base.device = device;
    chain->base.destroy = wsi_wl_swapchain_destroy;
    chain->base.get_images = wsi_wl_swapchain_get_images;
@@ -711,7 +714,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
    chain->surface = surface->surface;
    chain->extent = pCreateInfo->imageExtent;
    chain->vk_format = pCreateInfo->imageFormat;
-   chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, false);
+   chain->drm_format = wl_drm_format_for_vk_format(chain->vk_format, alpha);
 
    chain->present_mode = pCreateInfo->presentMode;
    chain->fifo_ready = true;