[PATCH 1/2] glamor: add support for allocating linear buffers

Dave Airlie airlied at gmail.com
Thu Jun 11 17:43:15 PDT 2015


On 12 June 2015 at 09:48, Dave Airlie <airlied at gmail.com> wrote:
> We need this for doing USB offload scenarios using glamor
> and modesetting driver.
>
> unfortunately only gbm in mesa 10.6 has support for the
> linear API.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  configure.ac                  |  5 +++++
>  glamor/glamor.h               |  3 ++-
>  glamor/glamor_egl.c           |  5 ++++-
>  glamor/glamor_egl_stubs.c     |  2 +-
>  glamor/glamor_fbo.c           | 10 +++++-----
>  hw/xwayland/xwayland-glamor.c |  2 +-
>  include/dix-config.h.in       |  3 +++
>  7 files changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index f760730..d0908e5 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2105,6 +2105,11 @@ if test "x$GLAMOR" = xyes; then
>         if test "x$GBM" = xyes; then
>                 AC_DEFINE(GLAMOR_HAS_GBM, 1,
>                           [Build glamor with GBM-based EGL support])
> +               PKG_CHECK_MODULES(GBM_HAS_LINEAR, "gbm >= 10.6.0", [GBM_HAS_LINEAR=yes], [GBM_HAS_LINEAR=no])
> +               if test "x$GBM_HAS_LINEAR" = xyes; then
> +                       AC_DEFINE(GLAMOR_HAS_GBM_LINEAR,  1,
> +                         [Build glamor/gbm has linear support])
> +               fi
>         fi
>
>  fi
> diff --git a/glamor/glamor.h b/glamor/glamor.h
> index 0d57fff..657354d 100644
> --- a/glamor/glamor.h
> +++ b/glamor/glamor.h
> @@ -142,7 +142,8 @@ extern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen);
>  extern _X_EXPORT unsigned int glamor_egl_create_argb8888_based_texture(ScreenPtr
>                                                                         screen,
>                                                                         int w,
> -                                                                       int h);
> +                                                                       int h,
> +                                                                       Bool linear);
>  extern _X_EXPORT int glamor_egl_dri3_fd_name_from_tex(ScreenPtr, PixmapPtr,
>                                                        unsigned int, Bool,
>                                                        CARD16 *, CARD32 *);
> diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
> index dc54561..2f22c44 100644
> --- a/glamor/glamor_egl.c
> +++ b/glamor/glamor_egl.c
> @@ -187,7 +187,7 @@ glamor_egl_get_gbm_device(ScreenPtr screen)
>  }
>
>  unsigned int
> -glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h)
> +glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h, Bool linear)
>  {
>      ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
>      struct glamor_egl_screen_private *glamor_egl;
> @@ -200,6 +200,9 @@ glamor_egl_create_argb8888_based_texture(ScreenPtr screen, int w, int h)
>
>      glamor_egl = glamor_egl_get_screen_private(scrn);
>      bo = gbm_bo_create(glamor_egl->gbm, w, h, GBM_FORMAT_ARGB8888,
> +#ifdef GLAMOR_GBM_HAS_LINEAR
> +                       (linear ? GBM_BO_USE_LINEAR : 0) |
> +#endif

Yes I got this define wrong, will fix locally (had to hack out to
build against old mesa).

Dave.


More information about the xorg-devel mailing list