[Mesa-dev] [PATCH v2] meson: implement default driver arguments

Dylan Baker dylan at pnwbakers.com
Tue Oct 31 22:50:49 UTC 2017


This allows drivers to be set by OS/arch in a sane manner.

v2: - set _drivers to a list of drivers instead of manually assigning
      each with_*

cc: Eric Engestrom <eric at engestrom.ch>
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 meson.build       | 18 ++++++++++++++++++
 meson_options.txt |  8 ++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index d22d49535af..38c0c77f875 100644
--- a/meson.build
+++ b/meson.build
@@ -90,6 +90,14 @@ with_dri_r200 = false
 with_dri_nouveau = false
 with_dri_swrast = false
 _drivers = get_option('dri-drivers')
+if _drivers == 'default'
+  if ['linux', 'bsd'].contains(host_machine.system())
+    if ['x86', 'x86_64'].contains(host_machine.cpu_family())
+      _drivers = 'i915,i965,r100,r200,nouveau'
+    endif
+    # TODO: PPC, Sparc
+  endif
+endif
 if _drivers != ''
   _split = _drivers.split(',')
   with_dri_i915 = _split.contains('i915')
@@ -112,6 +120,16 @@ with_gallium_vc5 = false
 with_gallium_etnaviv = false
 with_gallium_imx = false
 _drivers = get_option('gallium-drivers')
+if _drivers == 'default'
+  if ['linux', 'bsd'].contains(host_machine.system())
+    if ['x86', 'x86_64'].contains(host_machine.cpu_family())
+      _drivers = 'radeonsi,nouveau,softpipe'
+    elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
+      _drivers = 'pl111,vc4,vc5,freedreno,etnaviv,imx,softpipe'
+    endif
+    # TODO: PPC, Sparc
+  endif
+endif
 if _drivers != ''
   _split = _drivers.split(',')
   with_gallium_pl111 = _split.contains('pl111')
diff --git a/meson_options.txt b/meson_options.txt
index d93dd6eab2a..ce46438b5d3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -34,8 +34,8 @@ option(
 option(
   'dri-drivers',
   type : 'string',
-  value : 'i915,i965,r100,r200,nouveau',
-  description : 'comma separated list of dri drivers to build.'
+  value : 'default',
+  description : 'comma separated list of dri drivers to build. If this is set to default all drivers applicable to the target OS/architecture will be built'
 )
 option(
   'dri-drivers-path',
@@ -46,8 +46,8 @@ option(
 option(
   'gallium-drivers',
   type : 'string',
-  value : 'pl111,radeonsi,nouveau,freedreno,swrast,vc4,etnaviv,imx',
-  description : 'comma separated list of gallium drivers to build.'
+  value : 'default',
+  description : 'comma separated list of gallium drivers to build. If this is set to default all drivers applicable to the target OS/architecture will be built'
 )
 option(
   'gallium-media',
-- 
2.14.3



More information about the mesa-dev mailing list