Dave Airlie <[email protected]> writes: > Rather than create the pixmap, this uses the file descriptor > to change an existing pixmaps backing store. > > This is required for reverse prime slaves, where we create > the slave pixmap, then set the backing store. > > Signed-off-by: Dave Airlie <[email protected]> > --- > glamor/glamor.h | 19 +++++++++++++++++++ > glamor/glamor_egl.c | 52 +++++++++++++++++++++++++++++++++++----------------- > 2 files changed, 54 insertions(+), 17 deletions(-) > > diff --git a/glamor/glamor.h b/glamor/glamor.h > index 657354d..f402d7d 100644 > --- a/glamor/glamor.h > +++ b/glamor/glamor.h > @@ -218,6 +218,25 @@ extern _X_EXPORT PixmapPtr > glamor_pixmap_from_fd(ScreenPtr screen, > CARD8 depth, > CARD8 bpp); > > +/* @glamor_back_pixmap_from_fd: Backs an existing pixmap with a dma-buf fd. > + * > + * @pixmap: Pixmap to change backing for > + * @fd: The dma-buf fd to import. > + * @width: The width of the buffer. > + * @height: The height of the buffer. > + * @stride: The stride of the buffer. > + * @depth: The depth of the buffer. > + * @bpp: The number of bpp of the buffer. > + * > + * Returns TRUE if successful, FALSE on failure. > + * */ > +extern _X_EXPORT Bool glamor_back_pixmap_from_fd(PixmapPtr pixmap, > + int fd, > + CARD16 width, > + CARD16 height, > + CARD16 stride, > + CARD8 depth, > + CARD8 bpp); > #ifdef GLAMOR_FOR_XORG > > #define GLAMOR_EGL_MODULE_NAME "glamoregl" > diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c > index 4c0db6a..994dbd2 100644 > --- a/glamor/glamor_egl.c > +++ b/glamor/glamor_egl.c > @@ -461,19 +461,18 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, > #endif > } > > -_X_EXPORT PixmapPtr > -glamor_pixmap_from_fd(ScreenPtr screen, > - int fd, > - CARD16 width, > - CARD16 height, > - CARD16 stride, CARD8 depth, CARD8 bpp) > +_X_EXPORT Bool > +glamor_back_pixmap_from_fd(PixmapPtr pixmap, > + int fd, > + CARD16 width, > + CARD16 height, > + CARD16 stride, CARD8 depth, CARD8 bpp) > { > #ifdef GLAMOR_HAS_GBM > - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); > + ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
I slightly prefer having a local "ScreenPtr screen = pixmap->drawable.pScreen", but either way: Reviewed-by: Eric Anholt <[email protected]>
signature.asc
Description: PGP signature
_______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
