diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 4a4ca4bd8..7beb6f88e 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -260,9 +260,7 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) glamor_get_pixmap_private(pixmap); unsigned width = pixmap->drawable.width; unsigned height = pixmap->drawable.height; - uint32_t format; - struct gbm_bo *bo = NULL; - Bool used_modifiers = FALSE; + struct gbm_bo *bo; PixmapPtr exported; GCPtr scratch_gc; @@ -277,36 +275,14 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok) return FALSE; } - if (pixmap->drawable.depth == 30) - format = GBM_FORMAT_ARGB2101010; - else - format = GBM_FORMAT_ARGB8888; - -#ifdef GBM_BO_WITH_MODIFIERS - if (modifiers_ok && glamor_egl->dmabuf_capable) { - uint32_t num_modifiers; - uint64_t *modifiers = NULL; - - glamor_get_modifiers(screen, format, &num_modifiers, &modifiers); - - bo = gbm_bo_create_with_modifiers(glamor_egl->gbm, width, height, - format, modifiers, num_modifiers); - if (bo) - used_modifiers = TRUE; - free(modifiers); - } -#endif - - if (!bo) - { - bo = gbm_bo_create(glamor_egl->gbm, width, height, format, + bo = gbm_bo_create(glamor_egl->gbm, width, height, + (pixmap->drawable.depth == 30) ? + GBM_FORMAT_ARGB2101010 : GBM_FORMAT_ARGB8888, #ifdef GLAMOR_HAS_GBM_LINEAR - (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ? - GBM_BO_USE_LINEAR : 0) | + (pixmap->usage_hint == CREATE_PIXMAP_USAGE_SHARED ? + GBM_BO_USE_LINEAR : 0) | #endif - GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); - } - + GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT); if (!bo) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to make %dx%dx%dbpp GBM bo\n", diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index cdca072ed..20cc0ab42 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -159,7 +159,16 @@ xwl_glamor_pixmap_get_wl_buffer(PixmapPtr pixmap, unsigned short height, Bool *created) { - struct xwl_screen *xwl_screen = xwl_screen_get(pixmap->drawable.pScreen); + struct xwl_screen *xwl_screen = xwl_screen_get(screen); + struct gbm_bo *bo; + + if (width > 0 && height > 0 && depth >= 15 && + (hint == 0 || + hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP || + hint == CREATE_PIXMAP_USAGE_SHARED)) { + bo = gbm_bo_create(xwl_screen->gbm, width, height, + gbm_format_for_depth(depth), + GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); if (xwl_screen->egl_backend.get_wl_buffer_for_pixmap) return xwl_screen->egl_backend.get_wl_buffer_for_pixmap(pixmap,