meson: Rework automatic pipeline selection

The supported pipelines are listed in three places: the
meson_options.txt file, the defined array when a user selects
-Dpipelines="all", and arrays defined when the default
-Dpipelines="auto" is selected.

This can be hard to maintain and error prone.

Rework the definition of pipeline selection to a single table which
specifies the architecture(s) that the pipeline handler supports and
iterate it to handle the special cases for 'all', 'auto' and 'test'.

The current behaviour such that 'all' takes precedence over 'auto' is
maintained, and 'test' is now extended such that additional test
pipeline handlers can easily be introduced.

The existing implementation defines the i.MX8-ISI and RKISP1 pipeline
handlers as only supported by 'aarch64'. This conversion changes the
behaviour such that those pipeline handlers are now supported on both
'arm' and 'aarch64' as each of those platforms could support a 32-bit
ARM build.

Suggested-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2023-01-12 10:45:01 +00:00
parent 4133dbe2b3
commit 8f85c024f9

View file

@ -164,42 +164,41 @@ liblttng = dependency('lttng-ust', required : get_option('tracing'))
# Pipeline handlers # Pipeline handlers
# #
# Tests require the vimc pipeline handler, include it automatically when tests
# are enabled.
pipelines = get_option('pipelines') pipelines = get_option('pipelines')
if pipelines.contains('all') arch_arm = ['arm', 'aarch64']
pipelines = [ arch_x86 = ['x86', 'x86_64']
'imx8-isi', pipelines_support = {
'ipu3', 'imx8-isi': arch_arm,
'raspberrypi', 'ipu3': arch_x86,
'rkisp1', 'raspberrypi': arch_arm,
'simple', 'rkisp1': arch_arm,
'uvcvideo', 'simple': arch_arm,
'vimc', 'uvcvideo': ['any'],
] 'vimc': ['test'],
endif }
if pipelines.contains('auto') if pipelines.contains('all')
pipelines = pipelines_support.keys()
elif pipelines.contains('auto')
host_cpu = host_machine.cpu_family() host_cpu = host_machine.cpu_family()
pipelines = [] pipelines = []
if host_cpu == 'x86' or host_cpu == 'x86_64' foreach pipeline, archs : pipelines_support
pipelines += ['ipu3'] if host_cpu in archs or 'any' in archs
elif host_cpu == 'aarch64' pipelines += pipeline
pipelines += ['imx8-isi', 'rkisp1'] endif
endif endforeach
if host_cpu == 'arm' or host_cpu == 'aarch64'
pipelines += ['raspberrypi', 'simple']
endif
# Always include the uvcvideo pipeline handler.
pipelines += ['uvcvideo']
endif endif
if get_option('test') and 'vimc' not in pipelines # Tests require the vimc pipeline handler, include it automatically when tests
message('Enabling vimc pipeline handler to support tests') # are enabled.
pipelines += ['vimc'] if get_option('test')
foreach pipeline, archs : pipelines_support
if 'test' in archs and pipeline not in pipelines
message('Enabling ' + pipeline + ' pipeline handler for tests')
pipelines += pipeline
endif
endforeach
endif endif
# Utilities are parsed first to provide support for other components. # Utilities are parsed first to provide support for other components.