From 1f906f8715079e98510be5cda9f99d4d1dd82bc6 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 11 Jul 2024 12:27:08 -0500 Subject: [PATCH] zink/kopper: Set VK_COMPOSITE_ALPHA_OPAQUE_BIT when PresentOpaque is set This is required for EGL_EXT_present_opaque to work correctly. Fixes: 8ade5588e39d ("zink: add kopper api") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11007 Reviewed-by: Mike Blumenkrantz Part-of: --- include/kopper_interface.h | 1 + src/egl/drivers/dri2/platform_wayland.c | 1 + src/egl/drivers/dri2/platform_x11.c | 1 + src/gallium/drivers/zink/zink_kopper.c | 4 +++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/kopper_interface.h b/include/kopper_interface.h index fa1f001a728..b1162a95610 100644 --- a/include/kopper_interface.h +++ b/include/kopper_interface.h @@ -97,6 +97,7 @@ struct kopper_loader_info { struct kopper_vk_surface_create_storage bos; int has_alpha; int initial_swap_interval; + bool present_opaque; }; #define __DRI_KOPPER_LOADER "DRI_KopperLoader" diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 63de619ee4d..8574355b2fa 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -2910,6 +2910,7 @@ kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *out) wlsci->flags = 0; wlsci->display = dri2_dpy->wl_dpy; wlsci->surface = dri2_surf->wl_surface_wrapper; + out->present_opaque = dri2_surf->base.PresentOpaque; } static const __DRIkopperLoaderExtension kopper_loader_extension = { diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 8d0999cbf49..97436a0254b 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1454,6 +1454,7 @@ kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *ci) xcb->connection = dri2_dpy->conn; xcb->window = dri2_surf->drawable; ci->has_alpha = dri2_surf->depth == 32; + ci->present_opaque = dri2_surf->base.PresentOpaque; } static const __DRIkopperLoaderExtension kopper_loader_extension = { diff --git a/src/gallium/drivers/zink/zink_kopper.c b/src/gallium/drivers/zink/zink_kopper.c index 06b87b49a67..a564f38033d 100644 --- a/src/gallium/drivers/zink/zink_kopper.c +++ b/src/gallium/drivers/zink/zink_kopper.c @@ -283,7 +283,9 @@ kopper_CreateSwapchain(struct zink_screen *screen, struct kopper_displaytarget * cswap->scci.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; cswap->scci.queueFamilyIndexCount = 0; cswap->scci.pQueueFamilyIndices = NULL; - cswap->scci.compositeAlpha = has_alpha ? VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR : VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; + cswap->scci.compositeAlpha = has_alpha && !cdt->info.present_opaque + ? VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR + : VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; cswap->scci.clipped = VK_TRUE; } cswap->scci.presentMode = cdt->present_mode;