diff --git a/include/kopper_interface.h b/include/kopper_interface.h index 5ab5be68f7e..6f627c1273d 100644 --- a/include/kopper_interface.h +++ b/include/kopper_interface.h @@ -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" diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 627a1836e97..12a8e2c5ec7 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -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, diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 739a8cee7db..931153c22db 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -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 = {