summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2023-03-28 17:54:46 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2023-04-03 11:46:15 +0200
commit1ac3dd77d5adbcc0eb4365b2ff08460826ec1be1 (patch)
tree7af72317d7394b1b6ce852acb011cf98e5fd2b80
parenta4c700231dfbd20a7d48b64ff64e8cc40a6c22bc (diff)
xwayland: Add a direct hook to create pixmaps with glamor
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 <ofourdan@redhat.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
-rw-r--r--hw/xwayland/xwayland-glamor.c14
-rw-r--r--hw/xwayland/xwayland-glamor.h4
2 files changed, 18 insertions, 0 deletions
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 */