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

Eric Engestrom eric.engestrom at imgtec.com
Wed Nov 1 11:09:26 UTC 2017


On Tuesday, 2017-10-31 15:50:49 -0700, 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_*
> 
> 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

I think we need something here to handle the cases where `default` is
the value, but isn't handled by the detection logic.
Something like this at the end of the `_drivers == default` block, for
instance?

if _drivers == 'default'
  error(host_machine.system() + ' ' + host_machine.cpu_family() + ' has no default set; you need to set `dri-drivers` manually with `meson configure -Ddri-drivers=something`')
endif

(that's a bloody long line, but I don't think meson supports multiline
error)

> +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'

`softpipe` is a new addition in this commit; might be worth splitting
out, or at least mention in the commit message.

> +    endif
> +    # TODO: PPC, Sparc
> +  endif

same `if _drivers still 'default'` error here.

Other than that, this looks good to me. With the errors added and
the addition of softpipe mentioned in the commit msg or split out,
this is:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> +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