[Mesa-dev] [PATCH v2] gbm: add support for loading third-party backend (v2)

Ilia Mirkin imirkin at alum.mit.edu
Fri Apr 7 12:45:50 UTC 2017


On Fri, Apr 7, 2017 at 3:28 AM, Qiang Yu <Qiang.Yu at amd.com> wrote:
> V2:
>   1. export gbmint.h and test backend/libgbm ABI compatible
>   2. drop GBM_BACKEND_DIR, specify backend path in config file
>   3. add GBM_CONFIG_DIR for config file
>   4. add per backend priority
>   5. take care of thread safe
>
> Third-party can put their backend to a directory and create a
> /etc/gbm.conf.d/*.conf file which contains the backend so file
> path to overwrite the default builtin DRI backend.
>
> The /etc/gbm.conf.d/*.conf will be sorted and the backends added
> will be tried one-by-one until one can successfully create a gbm
> device. The default DRI backend is tried at last.
>
> /etc/gbm.conf.d/*.conf can also contain a "priority" field.
> backend with bigger number will be tried first. Default priority
> is 1000 inlcuding the builtin backend.
>
> GBM config file example:
> lib:/opt/amdgpu-pro/lib/gbm/amdgpu.so
> priority:2000
>
> People can still use GBM_BACKEND to overwrite the backend try
> order.
>
> Signed-off-by: Qiang Yu <Qiang.Yu at amd.com>
> ---
>  configure.ac                   |   9 +++
>  src/gbm/Makefile.am            |  11 +++-
>  src/gbm/backends/dri/gbm_dri.c |   1 +
>  src/gbm/main/backend.c         | 130 ++++++++++++++++++++++++++++++++++++++---
>  src/gbm/main/gbmint.h          |   7 ++-
>  5 files changed, 146 insertions(+), 12 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 70885fb..792d1b2 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2221,6 +2221,15 @@ AC_ARG_WITH([d3d-libdir],
>      [D3D_DRIVER_INSTALL_DIR="${libdir}/d3d"])
>  AC_SUBST([D3D_DRIVER_INSTALL_DIR])
>
> +dnl Directory for GBM
> +
> +AC_ARG_WITH([gbm-configdir],
> +    [AS_HELP_STRING([--with-gbm-configdir=DIR],
> +        [directory for the GBM configs @<:@/etc/gbm.conf.d@:>@])],
> +    [GBM_CONFIG_DIR="$withval"],
> +    [GBM_CONFIG_DIR='/etc/gbm.conf.d'])

Without commenting on the rest of the change, these should be
${sysconfigdir} instead of /etc.

Cheers,

  -ilia


More information about the mesa-dev mailing list