zink/kopper: Set VK_COMPOSITE_ALPHA_OPAQUE_BIT when PresentOpaque is set

This is required for EGL_EXT_present_opaque to work correctly.

Fixes: 8ade5588e3 ("zink: add kopper api")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11007
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30133>
(cherry picked from commit 1f906f8715)
This commit is contained in:
Faith Ekstrand 2024-07-11 12:27:08 -05:00 committed by Eric Engestrom
parent fbd4b2be5b
commit c8e8664235
5 changed files with 7 additions and 2 deletions

View File

@ -214,7 +214,7 @@
"description": "zink/kopper: Set VK_COMPOSITE_ALPHA_OPAQUE_BIT when PresentOpaque is set",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "8ade5588e39d736bdeab9bdd8ffa7cbfb6a5191e",
"notes": null

View File

@ -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"

View File

@ -2760,6 +2760,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 = {

View File

@ -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 = {

View File

@ -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;