From 83b13387ab8b28cbdfeb44f05e019a656214d722 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 15 Jan 2025 18:34:27 +0100 Subject: [PATCH] glamor: use gbm_format_for_depth instead of open-coding it This way glamor_back_pixmap_from_fd deals with the same depth values as glamor_pixmap_from_fds. Signed-off-by: Pierre-Eric Pelloux-Prayer Part-of: --- glamor/glamor_egl.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 56ac6b532..bb5e4d658 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -561,17 +561,14 @@ glamor_back_pixmap_from_fd(PixmapPtr pixmap, glamor_egl = glamor_egl_get_screen_private(scrn); - if (bpp != 32 || !(depth == 24 || depth == 32 || depth == 30) || width == 0 || height == 0) + if (!gbm_format_for_depth(depth, &import_data.format) || + width == 0 || height == 0) return FALSE; import_data.fd = fd; import_data.width = width; import_data.height = height; import_data.stride = stride; - if (depth == 30) - import_data.format = GBM_FORMAT_ARGB2101010; - else - import_data.format = GBM_FORMAT_ARGB8888; bo = gbm_bo_import(glamor_egl->gbm, GBM_BO_IMPORT_FD, &import_data, 0); if (!bo) return FALSE;