[Mesa-dev] [PATCH v4] meson: Don't confuse the install and search paths for dri drivers

Dylan Baker dylan at pnwbakers.com
Thu Jan 25 19:05:38 UTC 2018


Currently there is not a separate option for setting the search path of
DRI drivers in meson, like there is in scons and autotools. This is an
oversight and needs to be fixed. This adds an extra option
`dri-search-path`, which will default to the value of
`dri-drivers-path`, like autotools does.

v2: - Split input list before joining.
v3: - use : instead of ; as the delimiter. The autotools help string
      incorrectly says ; but the code uses :
v4: - Take list in pre : delimited form (Ilia)
    - Ensure that the dri-search-path is absolute when using
      dri_drivers_path

Fixes: db9788420d4bc7b4 ("meson: Add support for configuring dri drivers directory.")
Reported-by: Ilia Mirkin <imirkin at alum.mit.edu>
Signed-off-by: Dylan Baker <dylan.c.baker at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net> (v2)
Reviewed-by: Eric Engestrom <eric at engestrom.ch> (v3)
---

I noticed that this patch has the same problem that has been noticed elsewhere,
that `get_option('libdir')` doesn't necessarily return an absolute path. I also
decided that Ilia was right, just taking the options as 'foo:bar' (like
autotools) and not splitting and joining is a better plan. Oh, and I removed an
extra dead variable that should have been removed already.

 meson.build         | 4 ++++
 meson_options.txt   | 8 +++++++-
 src/egl/meson.build | 2 +-
 src/gbm/meson.build | 2 +-
 src/glx/meson.build | 4 ++--
 5 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/meson.build b/meson.build
index bc5996992a3..dc51c4f70db 100644
--- a/meson.build
+++ b/meson.build
@@ -57,6 +57,10 @@ dri_drivers_path = get_option('dri-drivers-path')
 if dri_drivers_path == ''
   dri_drivers_path = join_paths(get_option('libdir'), 'dri')
 endif
+dri_search_path = get_option('dri-search-path')
+if dri_search_path == ''
+  dri_search_path = join_paths(get_option('prefix'), dri_drivers_path)
+endif
 
 with_gles1 = get_option('gles1')
 with_gles2 = get_option('gles2')
diff --git a/meson_options.txt b/meson_options.txt
index 894378985fd..fca06c4e61d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -41,7 +41,13 @@ option(
   'dri-drivers-path',
   type : 'string',
   value : '',
-  description : 'Location of dri drivers. Default: $libdir/dri.'
+  description : 'Location to install dri drivers. Default: $libdir/dri.'
+)
+option(
+  'dri-search-path',
+  type : 'string',
+  value : '',
+  description : 'Locations to search for dri drivers, passed as colon separated list. Default: dri-drivers-path.'
 )
 option(
   'gallium-drivers',
diff --git a/src/egl/meson.build b/src/egl/meson.build
index df6e8b49dac..6cd04567b0d 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -160,7 +160,7 @@ libegl = shared_library(
   c_args : [
     c_vis_args,
     c_args_for_egl,
-    '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir),
+    '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
     '-D_EGL_BUILT_IN_DRIVER_DRI2',
     '-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ at 0@'.format(egl_native_platform.to_upper()),
   ],
diff --git a/src/gbm/meson.build b/src/gbm/meson.build
index 14b9e960360..2f5d1c6ddd7 100644
--- a/src/gbm/meson.build
+++ b/src/gbm/meson.build
@@ -38,7 +38,7 @@ incs_gbm = [
 if with_dri2
   files_gbm += files('backends/dri/gbm_dri.c', 'backends/dri/gbm_driint.h')
   deps_gbm += dep_libdrm # TODO: pthread-stubs
-  args_gbm += '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir)
+  args_gbm += '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path)
 endif
 if with_platform_wayland
   deps_gbm += dep_wayland_server
diff --git a/src/glx/meson.build b/src/glx/meson.build
index 04cd647ee49..e147aa3821e 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -111,7 +111,6 @@ elif with_dri_platform == 'windows'
   extra_ld_args_libgl = '-Wl,--disable-stdcall-fixup'
 endif
 
-dri_driver_dir = join_paths(get_option('prefix'), dri_drivers_path)
 if not with_glvnd
   gl_lib_name = 'GL'
   gl_lib_version = '1.2.0'
@@ -128,7 +127,8 @@ else
 endif
 
 gl_lib_cargs = [
-  '-D_REENTRANT', '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir),
+  '-D_REENTRANT',
+  '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
 ]
 
 if dep_xxf86vm != [] and dep_xxf86vm.found()
-- 
2.16.0



More information about the mesa-dev mailing list