egl/kopper: hook up EGL_EXT_surface_compression on wayland

the driver hook isn't supported yet, so this does nothing

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31024>
This commit is contained in:
Mike Blumenkrantz
2024-09-04 12:19:12 -04:00
committed by Marge Bot
parent f4aab9984b
commit 33335fdd89
3 changed files with 31 additions and 1 deletions

View File

@@ -98,6 +98,7 @@ struct kopper_loader_info {
int has_alpha;
int initial_swap_interval;
bool present_opaque;
uint32_t compression;
};
#define __DRI_KOPPER_LOADER "DRI_KopperLoader"

View File

@@ -636,7 +636,8 @@ dri2_setup_screen(_EGLDisplay *disp)
#ifdef HAVE_ANDROID_PLATFORM
dri2_dpy->has_native_fence_fd = dri_get_screen_param(dri2_dpy->dri_screen_render_gpu, PIPE_CAP_NATIVE_FENCE_FD);
#endif
dri2_dpy->has_compression_modifiers = pscreen->query_compression_rates && pscreen->query_compression_modifiers;
dri2_dpy->has_compression_modifiers = pscreen->query_compression_rates &&
(pscreen->query_compression_modifiers || dri2_dpy->kopper);
/*
* EGL 1.5 specification defines the default value to 1. Moreover,

View File

@@ -2902,6 +2902,34 @@ kopperSetSurfaceCreateInfo(void *_draw, struct kopper_loader_info *out)
wlsci->display = dri2_dpy->wl_dpy;
wlsci->surface = dri2_surf->wl_surface_wrapper;
out->present_opaque = dri2_surf->base.PresentOpaque;
/* convert to vulkan constants */
switch (dri2_surf->base.CompressionRate) {
case EGL_SURFACE_COMPRESSION_FIXED_RATE_NONE_EXT:
out->compression = 0;
break;
case EGL_SURFACE_COMPRESSION_FIXED_RATE_DEFAULT_EXT:
out->compression = UINT32_MAX;
break;
#define EGL_VK_COMP(NUM) \
case EGL_SURFACE_COMPRESSION_FIXED_RATE_##NUM##BPC_EXT: \
out->compression = VK_IMAGE_COMPRESSION_FIXED_RATE_##NUM##BPC_BIT_EXT; \
break
EGL_VK_COMP(1);
EGL_VK_COMP(2);
EGL_VK_COMP(3);
EGL_VK_COMP(4);
EGL_VK_COMP(5);
EGL_VK_COMP(6);
EGL_VK_COMP(7);
EGL_VK_COMP(8);
EGL_VK_COMP(9);
EGL_VK_COMP(10);
EGL_VK_COMP(11);
EGL_VK_COMP(12);
#undef EGL_VK_COMP
default:
unreachable("unknown compression rate");
}
}
static const __DRIkopperLoaderExtension kopper_loader_extension = {