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

Eric Engestrom eric at engestrom.ch
Fri Nov 3 23:44:11 UTC 2017


On Friday, 2017-11-03 18:09:01 +0000, Dylan Baker wrote:
> 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_*
> v3: - Use "auto" instead of "default", which matches the value of other
>       automatically configured options.
>     - Set vulkan drivers as well
>     - Add error message if no automatic drivers are known for a given
>       arch/OS combo
>     - use not(darwin or windows) instead of (linux or *bsd), which is
>       probably more accurate (that way Solaris and other *nix systems
>       aren't excluded)
>     - rename softpipe to swrast, as swrast is the actual option name
> 
> cc: Eric Engestrom <eric at engestrom.ch>

Not sure about the duplicate error(), but that nitpick aside, this is:
Reviewed-by: Eric Engestrom <eric at engestrom.ch>

> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  meson.build       | 38 ++++++++++++++++++++++++++++++++++++++
>  meson_options.txt | 12 ++++++------
>  2 files changed, 44 insertions(+), 6 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index d22d49535af..7ffcc02bf41 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -90,6 +90,18 @@ with_dri_r200 = false
>  with_dri_nouveau = false
>  with_dri_swrast = false
>  _drivers = get_option('dri-drivers')
> +if _drivers == 'auto'
> +  # TODO: PPC, Sparc
> +  if not ['darwin', 'windows'].contains(host_machine.system())
> +    if ['x86', 'x86_64'].contains(host_machine.cpu_family())
> +      _drivers = 'i915,i965,r100,r200,nouveau'
> +    else
> +      error('Unknown architecture. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
> +    endif
> +  else
> +    error('Unknown OS. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
> +  endif
> +endif
>  if _drivers != ''
>    _split = _drivers.split(',')
>    with_dri_i915 = _split.contains('i915')
> @@ -112,6 +124,20 @@ with_gallium_vc5 = false
>  with_gallium_etnaviv = false
>  with_gallium_imx = false
>  _drivers = get_option('gallium-drivers')
> +if _drivers == 'auto'
> +  if not ['darwin', 'windows'].contains(host_machine.system())
> +    # TODO: PPC, Sparc
> +    if ['x86', 'x86_64'].contains(host_machine.cpu_family())
> +      _drivers = 'radeonsi,nouveau,swrast'
> +    elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
> +      _drivers = 'pl111,vc4,vc5,freedreno,etnaviv,imx,swrast'
> +    else
> +      error('Unknown architecture. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
> +    endif
> +  else
> +    error('Unknown OS. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
> +  endif
> +endif
>  if _drivers != ''
>    _split = _drivers.split(',')
>    with_gallium_pl111 = _split.contains('pl111')
> @@ -246,6 +272,18 @@ with_intel_vk = false
>  with_amd_vk = false
>  with_any_vk = false
>  _vulkan_drivers = get_option('vulkan-drivers')
> +if _vulkan_drivers == 'auto'
> +  if not ['darwin', 'windows'].contains(host_machine.system())
> +    if host_machine.cpu_family().startswith('x86')
> +      _vulkan_drivers = 'amd,intel'
> +    else
> +      error('Unknown architecture. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.')
> +    endif
> +  else
> +    # No vulkan driver supports windows or macOS currently
> +    _vulkan_drivers = ''
> +  endif
> +endif
>  if _vulkan_drivers != ''
>    _split = _vulkan_drivers.split(',')
>    with_intel_vk = _split.contains('intel')
> diff --git a/meson_options.txt b/meson_options.txt
> index d93dd6eab2a..6c9cd33998c 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 : 'auto',
> +  description : 'comma separated list of dri drivers to build. If this is set to auto 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 : 'auto',
> +  description : 'comma separated list of gallium drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
>  )
>  option(
>    'gallium-media',
> @@ -58,8 +58,8 @@ option(
>  option(
>    'vulkan-drivers',
>    type : 'string',
> -  value : 'intel,amd',
> -  description : 'comma separated list of vulkan drivers to build.'
> +  value : 'auto',
> +  description : 'comma separated list of vulkan drivers to build. If this is set to auto all drivers applicable to the target OS/architecture will be built'
>  )
>  option(
>    'shader-cache',
> -- 
> 2.15.0


More information about the mesa-dev mailing list