[PATCH v2] glamor: Make glamor_name_from_pixmap work without DRI3

Eric Anholt eric at anholt.net
Wed Nov 18 12:57:31 PST 2015


Mark Kettenis <kettenis at openbsd.org> writes:

> This function is used by the modesetting driver to implement DRI2 and
> shouldn't fail on systems that don't support DRI3.  Remove the check
> for DRI3 and rename glamor_egl_dri3_fd_name_from_tex to
> glamor_egl_fd_name_from_tex.

At the time you sent the patch, if you didn't have the dri3_capable ->
glamor_enable_dri3() -> dri3_enable flag series set, then you wouldn't
have had glamor_egl_create_argb8888_based_texture() getting called, so
you'd make your EGL image to share out of whatever random format your GL
chose.  That probably explains your byte swapping bugs.

Also, if you didn't have dri3_capable set, then you hadn't succeeded at
the check for EGL_KHR_gl_texture_2D_image and
EGL_EXT_image_dma_buf_import and GL_OES_EGL_image.  I expect on your
platform you don't have EXT_image_dma_buf_import, but you still need to
check for the others before trying it.

Now, post glamor-delay-shareable, we shouldn't have the issue with byte
swapping since I always make the GBM bo-based EGLImage when exporting.
So, could you respin in a way that just makes sure that we've checked
for the appropriate extensions (see the calls in
glamor_egl_create_textured_pixmap_from_gbm_bo() and
glamor_create_texture_from_image())?

Oh, also, make sure you rename the other callers of
glamor_egl_dri3_fd_name_from_tex() in the tree.

> Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
> ---
>  glamor/glamor.c     | 2 --
>  glamor/glamor.h     | 6 +++---
>  glamor/glamor_egl.c | 8 ++++----
>  3 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/glamor/glamor.c b/glamor/glamor.c
> index d4a0236..110bdb8 100644
> --- a/glamor/glamor.c
> +++ b/glamor/glamor.c
> @@ -776,8 +776,6 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
>      glamor_screen_private *glamor_priv =
>          glamor_get_screen_private(pixmap->drawable.pScreen);
>  
> -    if (!glamor_priv->dri3_enabled)
> -        return -1;
>      switch (pixmap_priv->type) {
>      case GLAMOR_TEXTURE_DRM:
>      case GLAMOR_TEXTURE_ONLY:
> diff --git a/glamor/glamor.h b/glamor/glamor.h
> index 4be8800..01b6e4c 100644
> --- a/glamor/glamor.h
> +++ b/glamor/glamor.h
> @@ -144,9 +144,9 @@ extern _X_EXPORT unsigned int glamor_egl_create_argb8888_based_texture(ScreenPtr
>                                                                         int w,
>                                                                         int h,
>                                                                         Bool linear);
> -extern _X_EXPORT int glamor_egl_dri3_fd_name_from_tex(ScreenPtr, PixmapPtr,
> -                                                      unsigned int, Bool,
> -                                                      CARD16 *, CARD32 *);
> +extern _X_EXPORT int glamor_egl_fd_name_from_tex(ScreenPtr, PixmapPtr,
> +						 unsigned int, Bool,
> +						 CARD16 *, CARD32 *);
>  
>  extern void glamor_egl_destroy_pixmap_image(PixmapPtr pixmap);
>  
> diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
> index 2e6c7bd..9b91147 100644
> --- a/glamor/glamor_egl.c
> +++ b/glamor/glamor_egl.c
> @@ -471,10 +471,10 @@ glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap)
>  }
>  
>  int
> -glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
> -                                 PixmapPtr pixmap,
> -                                 unsigned int tex,
> -                                 Bool want_name, CARD16 *stride, CARD32 *size)
> +glamor_egl_fd_name_from_tex(ScreenPtr screen,
> +			    PixmapPtr pixmap,
> +			    unsigned int tex,
> +			    Bool want_name, CARD16 *stride, CARD32 *size)
>  {
>  #ifdef GLAMOR_HAS_GBM
>      struct glamor_egl_screen_private *glamor_egl;
> -- 
> 2.6.3
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20151118/d9ed0d70/attachment.sig>


More information about the xorg-devel mailing list