From 1ac3dd77d5adbcc0eb4365b2ff08460826ec1be1 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 28 Mar 2023 17:54:46 +0200 Subject: [PATCH] xwayland: Add a direct hook to create pixmaps with glamor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With linux dmabuf v4 support, for direct scanout support, we need more context that just what CreatePixmap() provides, as we need the actual drawable to invoke xwl_glamor_get_drawable_modifiers(). Add a specific hook in Xwayland's glamor implementation that we can use for that purpose. This is preparation work for the direct scanout fixes. Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-glamor.c | 14 ++++++++++++++ hw/xwayland/xwayland-glamor.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index af227bb03..b714f9be0 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -919,6 +919,20 @@ xwl_glamor_needs_n_buffering(struct xwl_screen *xwl_screen) XWL_EGL_BACKEND_NEEDS_N_BUFFERING); } +PixmapPtr +xwl_glamor_create_pixmap_for_window(struct xwl_window *xwl_window) +{ + struct xwl_screen *xwl_screen = xwl_window->xwl_screen; + + if (!xwl_screen->glamor || !xwl_screen->egl_backend) + return NullPixmap; + + if (xwl_screen->egl_backend->create_pixmap_for_window) + return xwl_screen->egl_backend->create_pixmap_for_window(xwl_window); + else + return NullPixmap; +} + void xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstream) { diff --git a/hw/xwayland/xwayland-glamor.h b/hw/xwayland/xwayland-glamor.h index 0ecd25b38..c2eed95e9 100644 --- a/hw/xwayland/xwayland-glamor.h +++ b/hw/xwayland/xwayland-glamor.h @@ -104,6 +104,9 @@ struct xwl_egl_backend { * is set up on. */ drmDevice *(*get_main_device)(struct xwl_screen *xwl_screen); + + /* Direct hook to create the backing pixmap for a window */ + PixmapPtr (*create_pixmap_for_window)(struct xwl_window *xwl_window); }; #ifdef XWL_HAS_GLAMOR @@ -142,6 +145,7 @@ Bool xwl_glamor_get_modifiers(ScreenPtr screen, uint32_t format, Bool xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format, uint32_t *num_modifiers, uint64_t **modifiers); Bool xwl_glamor_check_flip(PixmapPtr pixmap); +PixmapPtr xwl_glamor_create_pixmap_for_window (struct xwl_window *xwl_window); #ifdef XV /* glamor Xv Adaptor */