[Mesa-dev] [PATCH 6/7] meson: use array type options

Dylan Baker dylan at pnwbakers.com
Tue Apr 17 18:56:25 UTC 2018


Quoting Eric Anholt (2018-04-17 11:37:37)
> Dylan Baker <dylan at pnwbakers.com> writes:
> 
> > This option type is nice since it involves less converting strings into
> > lists, and because it validates the values that are provided.
> >
> > Signed-off-by: Dylan Baker <dylan.c.baker at intel.com>
> > ---
> >  meson.build       | 113 +++++++++++++++++++++++-----------------------
> >  meson_options.txt |  48 ++++++++++++--------
> >  2 files changed, 87 insertions(+), 74 deletions(-)
> >
> > diff --git a/meson.build b/meson.build
> > index beb65b314ac..b0e2bc1f625 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -51,8 +51,8 @@ with_valgrind = get_option('valgrind')
> >  with_libunwind = get_option('libunwind')
> >  with_asm = get_option('asm')
> >  with_osmesa = get_option('osmesa')
> > -with_swr_arches = get_option('swr-arches').split(',')
> > -with_tools = get_option('tools').split(',')
> > +with_swr_arches = get_option('swr-arches')
> > +with_tools = get_option('tools')
> >  if with_tools.contains('all')
> >    with_tools = ['freedreno', 'glsl', 'intel', 'nir', 'nouveau']
> >  endif
> > @@ -101,31 +101,30 @@ with_dri_r200 = false
> >  with_dri_nouveau = false
> >  with_dri_swrast = false
> >  _drivers = get_option('dri-drivers')
> > -if _drivers == 'auto'
> > +if _drivers.contains('auto')
> >    if system_has_kms_drm
> >      # TODO: PPC, Sparc
> >      if ['x86', 'x86_64'].contains(host_machine.cpu_family())
> > -      _drivers = 'i915,i965,r100,r200,nouveau'
> > +      _drivers = ['i915', 'i965', 'r100', 'r200', 'nouveau']
> >      elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > -      _drivers = ''
> > +      _drivers = ['']
> >      else
> >        error('Unknown architecture. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
> >      endif
> >    elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
> >      # only swrast would make sense here, but gallium swrast is a much better default
> > -    _drivers = ''
> > +    _drivers = ['']
> >    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')
> > -  with_dri_i965 = _split.contains('i965')
> > -  with_dri_r100 = _split.contains('r100')
> > -  with_dri_r200 = _split.contains('r200')
> > -  with_dri_nouveau = _split.contains('nouveau')
> > -  with_dri_swrast = _split.contains('swrast')
> > +if _drivers != ['']
> > +  with_dri_i915 = _drivers.contains('i915')
> > +  with_dri_i965 = _drivers.contains('i965')
> > +  with_dri_r100 = _drivers.contains('r100')
> > +  with_dri_r200 = _drivers.contains('r200')
> > +  with_dri_nouveau = _drivers.contains('nouveau')
> > +  with_dri_swrast = _drivers.contains('swrast')
> >    with_dri = true
> >  endif
> >  
> > @@ -147,40 +146,44 @@ with_gallium_svga = false
> >  with_gallium_virgl = false
> >  with_gallium_swr = false
> >  _drivers = get_option('gallium-drivers')
> > -if _drivers == 'auto'
> > +if _drivers.contains('auto')
> >    if system_has_kms_drm
> >      # TODO: PPC, Sparc
> >      if ['x86', 'x86_64'].contains(host_machine.cpu_family())
> > -      _drivers = 'r300,r600,radeonsi,nouveau,virgl,svga,swrast'
> > +      _drivers = [
> > +        'r300', 'r600', 'radeonsi', 'nouveau', 'virgl', 'svga', 'swrast'
> > +      ]
> >      elif ['arm', 'aarch64'].contains(host_machine.cpu_family())
> > -      _drivers = 'pl111,vc4,vc5,freedreno,etnaviv,imx,nouveau,tegra,virgl,swrast'
> > +      _drivers = [
> > +        'pl111', 'vc4', 'vc5', 'freedreno', 'etnaviv', 'imx', 'nouveau',
> > +        'tegra', 'virgl', 'swrast',
> > +      ]
> >      else
> >        error('Unknown architecture. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
> >      endif
> >    elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
> > -    _drivers = 'swrast'
> > +    _drivers = ['swrast']
> >    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')
> > -  with_gallium_radeonsi = _split.contains('radeonsi')
> > -  with_gallium_r300 = _split.contains('r300')
> > -  with_gallium_r600 = _split.contains('r600')
> > -  with_gallium_nouveau = _split.contains('nouveau')
> > -  with_gallium_freedreno = _split.contains('freedreno')
> > -  with_gallium_softpipe = _split.contains('swrast')
> > -  with_gallium_vc4 = _split.contains('vc4')
> > -  with_gallium_vc5 = _split.contains('vc5')
> > -  with_gallium_etnaviv = _split.contains('etnaviv')
> > -  with_gallium_imx = _split.contains('imx')
> > -  with_gallium_tegra = _split.contains('tegra')
> > -  with_gallium_i915 = _split.contains('i915')
> > -  with_gallium_svga = _split.contains('svga')
> > -  with_gallium_virgl = _split.contains('virgl')
> > -  with_gallium_swr = _split.contains('swr')
> > +if _drivers != ['']
> > +  with_gallium_pl111 = _drivers.contains('pl111')
> > +  with_gallium_radeonsi = _drivers.contains('radeonsi')
> > +  with_gallium_r300 = _drivers.contains('r300')
> > +  with_gallium_r600 = _drivers.contains('r600')
> > +  with_gallium_nouveau = _drivers.contains('nouveau')
> > +  with_gallium_freedreno = _drivers.contains('freedreno')
> > +  with_gallium_softpipe = _drivers.contains('swrast')
> > +  with_gallium_vc4 = _drivers.contains('vc4')
> > +  with_gallium_vc5 = _drivers.contains('vc5')
> > +  with_gallium_etnaviv = _drivers.contains('etnaviv')
> > +  with_gallium_imx = _drivers.contains('imx')
> > +  with_gallium_tegra = _drivers.contains('tegra')
> > +  with_gallium_i915 = _drivers.contains('i915')
> > +  with_gallium_svga = _drivers.contains('svga')
> > +  with_gallium_virgl = _drivers.contains('virgl')
> > +  with_gallium_swr = _drivers.contains('swr')
> >    with_gallium = true
> >    if system_has_kms_drm
> >      _glx = get_option('glx')
> > @@ -195,24 +198,23 @@ with_intel_vk = false
> >  with_amd_vk = false
> >  with_any_vk = false
> >  _vulkan_drivers = get_option('vulkan-drivers')
> > -if _vulkan_drivers == 'auto'
> > +if _vulkan_drivers.contains('auto')
> >    if system_has_kms_drm
> >      if host_machine.cpu_family().startswith('x86')
> > -      _vulkan_drivers = 'amd,intel'
> > +      _vulkan_drivers = ['amd', 'intel']
> >      else
> >        error('Unknown architecture. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.')
> >      endif
> >    elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
> >      # No vulkan driver supports windows or macOS currently
> > -    _vulkan_drivers = ''
> > +    _vulkan_drivers = ['']
> >    else
> >      error('Unknown OS. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.')
> >    endif
> >  endif
> > -if _vulkan_drivers != ''
> > -  _split = _vulkan_drivers.split(',')
> > -  with_intel_vk = _split.contains('intel')
> > -  with_amd_vk = _split.contains('amd')
> > +if _vulkan_drivers != ['']
> > +  with_intel_vk = _drivers.contains('intel')
> > +  with_amd_vk = _drivers.contains('amd')
> >    with_any_vk = with_amd_vk or with_intel_vk
> 
> Now that _vulkan_drivers can only contain intel or amd, maybe just set
> with_any_vk=true here?
> 
> Other than that, all but patch 5 get my r-b.  I minimize my knowledge of
> both C++ and LLVM, so I don't think I can review that one, but maybe if
> nobody else bothers to look at it for a while then just throw my a-b on
> it.

Thanks, I'll do that.

I meant to cc Marek and Tom on that one, since Marek ran into that problem.
Curro tells me not using rtti is not recomended, it creates a non standard C++
abi so code with and without rtti cannot be linked together, but LLVM does
support turning rtti off, and autotools does compile and link successfully in
that case, so I guess meson should too.

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180417/0e6d9e07/attachment-0001.sig>


More information about the mesa-dev mailing list