From 111d318fc2262c03c289be172696264622e50156 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 22 Mar 2023 10:37:52 +0100 Subject: [PATCH] xwayland: Create scanout capable BO with the fallback path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before linux_dmabuf v4 support was added, the BO were created using gbm_bo_create_with_modifiers() which incidentally creates scanout capable buffers. We now need to replicate that explicitly when using the fallback path, with buffers window, otherwise direct scanout will not be possible in that case. Signed-off-by: Olivier Fourdan Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1535 Suggested-by: Michel Dänzer Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-glamor-gbm.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index 1474eb15d..83318fe62 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -278,7 +278,8 @@ static PixmapPtr xwl_glamor_gbm_create_pixmap_internal(struct xwl_screen *xwl_screen, DrawablePtr drawable, int width, int height, int depth, - unsigned int hint) + unsigned int hint, + Bool implicit_scanout) { struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); struct gbm_bo *bo = NULL; @@ -313,9 +314,11 @@ xwl_glamor_gbm_create_pixmap_internal(struct xwl_screen *xwl_screen, } #endif if (bo == NULL) { + uint32_t usage = GBM_BO_USE_RENDERING; implicit = TRUE; - bo = gbm_bo_create(xwl_gbm->gbm, width, height, format, - GBM_BO_USE_RENDERING); + if (implicit_scanout) + usage |= GBM_BO_USE_SCANOUT; + bo = gbm_bo_create(xwl_gbm->gbm, width, height, format, usage); } if (bo) { @@ -342,21 +345,19 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen, unsigned int hint) { return xwl_glamor_gbm_create_pixmap_internal(xwl_screen_get(screen), NULL, - width, height, depth, hint); + width, height, depth, hint, FALSE); } static PixmapPtr xwl_glamor_gbm_create_pixmap_for_window(struct xwl_window *xwl_window) { - if (xwl_window->window == NullWindow) - return NullPixmap; - return xwl_glamor_gbm_create_pixmap_internal(xwl_window->xwl_screen, &xwl_window->window->drawable, xwl_window->window->drawable.width, xwl_window->window->drawable.height, xwl_window->window->drawable.depth, - CREATE_PIXMAP_USAGE_BACKING_PIXMAP); + CREATE_PIXMAP_USAGE_BACKING_PIXMAP, + xwl_window->has_implicit_scanout_support); } static Bool