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>
This commit is contained in:
Olivier Fourdan 2023-03-28 17:54:46 +02:00
parent a4c700231d
commit 1ac3dd77d5
2 changed files with 18 additions and 0 deletions

View File

@ -919,6 +919,20 @@ xwl_glamor_needs_n_buffering(struct xwl_screen *xwl_screen)
XWL_EGL_BACKEND_NEEDS_N_BUFFERING); 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 void
xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstream) xwl_glamor_init_backends(struct xwl_screen *xwl_screen, Bool use_eglstream)
{ {

View File

@ -104,6 +104,9 @@ struct xwl_egl_backend {
* is set up on. * is set up on.
*/ */
drmDevice *(*get_main_device)(struct xwl_screen *xwl_screen); 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 #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, Bool xwl_glamor_get_drawable_modifiers(DrawablePtr drawable, uint32_t format,
uint32_t *num_modifiers, uint64_t **modifiers); uint32_t *num_modifiers, uint64_t **modifiers);
Bool xwl_glamor_check_flip(PixmapPtr pixmap); Bool xwl_glamor_check_flip(PixmapPtr pixmap);
PixmapPtr xwl_glamor_create_pixmap_for_window (struct xwl_window *xwl_window);
#ifdef XV #ifdef XV
/* glamor Xv Adaptor */ /* glamor Xv Adaptor */