glamor/glamor_egl: Choose a BGR depth 30 format on gles

Match the bgr format chosen in `glamor_setup_formats`

Signed-off-by: stefan11111 <stefan11111github@gmail.com>
This commit is contained in:
stefan11111 2026-06-15 22:09:17 +03:00 • committed by Enrico Weigelt
commit ef20ec6e50
2 changed files with 12 additions and 6 deletions

View file

@ -1143,7 +1143,7 @@ glamor_egl_fd_name_from_pixmap(ScreenPtr screen,
}
static uint32_t
glamor_drm_format_for_depth(CARD8 depth)
glamor_drm_format_for_depth(CARD8 depth, int is_gles)
{
switch (depth) {
case 15:
@ -1153,7 +1153,8 @@ glamor_drm_format_for_depth(CARD8 depth)
case 24:
return DRM_FORMAT_XRGB8888;
case 30:
return DRM_FORMAT_ARGB2101010;
/* Match the format chosen in glamor_setup_formats */
return is_gles ? DRM_FORMAT_ABGR2101010 : DRM_FORMAT_ARGB2101010;
default:
GLAMOR_LOG_MESSAGE(-1, X_ERROR, "unexpected depth: %d\n", depth);
case 32:
@ -1169,6 +1170,7 @@ glamor_back_pixmap_from_fd_direct(PixmapPtr pixmap,
CARD16 _stride, CARD8 depth, CARD8 bpp)
{
ScreenPtr screen = pixmap->drawable.pScreen;
glamor_egl_priv_t *glamor_egl = glamor_egl_get_screen_private(screen);
uint32_t format;
const int stride = _stride;
const int offset = 0;
@ -1177,7 +1179,7 @@ glamor_back_pixmap_from_fd_direct(PixmapPtr pixmap,
return FALSE;
}
format = glamor_drm_format_for_depth(depth);
format = glamor_drm_format_for_depth(depth, glamor_egl->is_gles);
screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, stride, NULL);
@ -1212,7 +1214,7 @@ glamor_back_pixmap_from_fd_gbm(PixmapPtr pixmap,
import_data.width = width;
import_data.height = height;
import_data.stride = stride;
import_data.format = glamor_drm_format_for_depth(depth);
import_data.format = glamor_drm_format_for_depth(depth, glamor_egl->is_gles);
bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_FD, &import_data,
GBM_BO_USE_RENDERING);
if (!bo) {
@ -1291,7 +1293,7 @@ glamor_pixmap_from_fds_direct(ScreenPtr screen,
goto error;
}
format = glamor_drm_format_for_depth(depth);
format = glamor_drm_format_for_depth(depth, glamor_egl->is_gles);
/* XXX Could we do this at compile-time? XXX */
if (sizeof(int) == sizeof(CARD32)) {
@ -1360,7 +1362,7 @@ glamor_pixmap_from_fds_gbm(ScreenPtr screen,
import_data.width = width;
import_data.height = height;
import_data.format = glamor_drm_format_for_depth(depth);
import_data.format = glamor_drm_format_for_depth(depth, glamor_egl->is_gles);
import_data.num_fds = num_fds;
import_data.modifier = modifier;
for (i = 0; i < num_fds; i++) {
@ -2792,6 +2794,8 @@ glamor_egl_check_renderer(glamor_egl_priv_t* glamor_egl, int platform,
const char* vendor;
int is_nvidia;
glamor_egl->is_gles = !epoxy_is_desktop_gl();
renderer = (const char*)glGetString(GL_RENDERER);
vendor = (const char*)glGetString(GL_VENDOR);

View file

@ -44,6 +44,8 @@ typedef struct glamor_egl_screen_private {
int can_texture_gbm_bo;
#endif
int is_gles;
int has_image_dma_buf_export;
int has_EXT_EGL_image_storage;
int has_OES_EGL_image;