Mesa (main): meson: Add a GBM backends search path build option

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 6 17:27:20 UTC 2021


Module: Mesa
Branch: main
Commit: 7f615c66fbdd0a7aa7a513d011956dcc6c0ac2e6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f615c66fbdd0a7aa7a513d011956dcc6c0ac2e6

Author: James Jones <jajones at nvidia.com>
Date:   Thu Apr 22 23:18:49 2021 -0700

meson: Add a GBM backends search path build option

This is the list of locations where GBM will look
for alternate backend implementations based on the
DRM driver name. It defaults to $libdir/gbm.

On Android, this path is currently hard-coded to
/vendor/lib[64]/gbm.

Signed-off-by: James Jones <jajones at nvidia.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9902>

---

 Android.common.mk   |  3 +++
 meson.build         | 10 +++++++++-
 meson_options.txt   |  6 ++++++
 src/gbm/meson.build |  5 ++++-
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/Android.common.mk b/Android.common.mk
index 7ef6a90a179..124df640899 100644
--- a/Android.common.mk
+++ b/Android.common.mk
@@ -118,6 +118,9 @@ LOCAL_CFLAGS += -DHAVE_LIBDRM
 LOCAL_SHARED_LIBRARIES += libdrm
 endif
 
+LOCAL_CFLAGS_32 += -DDEFAULT_BACKENDS_PATH=\"/vendor/lib/gbm\"
+LOCAL_CFLAGS_64 += -DDEFAULT_BACKENDS_PATH=\"/vendor/lib64/gbm\"
+
 LOCAL_CFLAGS_32 += -DDEFAULT_DRIVER_DIR=\"/vendor/lib/$(MESA_DRI_MODULE_REL_PATH)\"
 LOCAL_CFLAGS_64 += -DDEFAULT_DRIVER_DIR=\"/vendor/lib64/$(MESA_DRI_MODULE_REL_PATH)\"
 LOCAL_PROPRIETARY_MODULE := true
diff --git a/meson.build b/meson.build
index 303414c4c3e..2ef0b88e6d3 100644
--- a/meson.build
+++ b/meson.build
@@ -92,6 +92,11 @@ if dri_search_path == ''
   dri_search_path = dri_drivers_path
 endif
 
+gbm_backends_path = get_option('gbm-backends-path')
+if gbm_backends_path == ''
+  gbm_backends_path = join_paths(get_option('prefix'), get_option('libdir'), 'gbm')
+endif
+
 with_gles1 = get_option('gles1')
 if with_gles1 == 'true'
   with_gles1 = 'enabled'
@@ -2162,7 +2167,6 @@ if with_egl
   endif
   lines += 'EGL drivers:     ' + ' '.join(egl_drivers)
 endif
-lines += 'GBM:             ' + (with_gbm ? 'yes' : 'no')
 if with_egl or with_any_vk
   _platforms += 'surfaceless'
   if with_gbm and not with_platform_android
@@ -2170,6 +2174,10 @@ if with_egl or with_any_vk
   endif
   lines += 'EGL/Vulkan/VL platforms:   ' + ' '.join(_platforms)
 endif
+lines += 'GBM:             ' + (with_gbm ? 'yes' : 'no')
+if with_gbm
+  lines += 'GBM backends path: ' + gbm_backends_path
+endif
 
 lines += ''
 if with_any_vk
diff --git a/meson_options.txt b/meson_options.txt
index 9fd9c8a2fd9..2c11092eeb4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -270,6 +270,12 @@ option(
   choices : ['auto', 'true', 'false', 'enabled', 'disabled'],
   description : 'Build support for gbm platform'
 )
+option(
+  'gbm-backends-path',
+  type : 'string',
+  value : '',
+  description : 'Locations to search for gbm backends, passed as colon separated list. Default: $libdir/gbm.'
+)
 option(
   'glx',
   type : 'combo',
diff --git a/src/gbm/meson.build b/src/gbm/meson.build
index 493a5b3893c..ccdc517fc56 100644
--- a/src/gbm/meson.build
+++ b/src/gbm/meson.build
@@ -28,7 +28,9 @@ files_gbm = files(
   'main/gbmint.h',
 )
 deps_gbm = []
-args_gbm = []
+args_gbm = [
+  '-DDEFAULT_BACKENDS_PATH="@0@"'.format(gbm_backends_path),
+]
 deps_gbm = []
 incs_gbm = [
   include_directories('main'), inc_include, inc_src, inc_loader,
@@ -70,6 +72,7 @@ pkg.generate(
   version : meson.project_version(),
   libraries : libgbm,
   libraries_private : gbm_priv_libs,
+  variables : ['gbmbackendspath=' + gbm_backends_path],
 )
 
 if with_symbols_check



More information about the mesa-commit mailing list