From 5aebc0109611fb78ea040e386273c15d604087f3 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 1 Feb 2023 15:40:24 +0100 Subject: [PATCH] xwayland: fix GBM on driver without explicit modifiers Some drivers (e.g. AMD GFX8-) don't support explicit format modifiers. On these drivers, gbm_bo_create_with_modifiers() will fail. This results in "Error getting buffer" in the logs later on with all X11 windows staying invisible. Fallback to the modifier-less API gbm_bo_create() in that case. Signed-off-by: Simon Ser --- hw/xwayland/xwayland-glamor-gbm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index 205d2feb3..3984d0b38 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -278,7 +278,7 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); - struct gbm_bo *bo; + struct gbm_bo *bo = NULL; PixmapPtr pixmap = NULL; if (width > 0 && height > 0 && depth >= 15 && @@ -297,9 +297,8 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, format, modifiers, num_modifiers); free(modifiers); } - else #endif - { + if (bo == NULL) { bo = gbm_bo_create(xwl_gbm->gbm, width, height, format, GBM_BO_USE_RENDERING); }