[libcamera-devel] [PATCH 05/13] pipeline: raspberrypi: Refactor and move pipeline handler code
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Thu May 4 18:23:47 CEST 2023
Hi Naush,
Thank you for the patch.
On Wed, May 03, 2023 at 01:20:27PM +0100, Naushir Patuck via libcamera-devel wrote:
> Split the Raspberry Pi pipeline handler code into common and VC4/BCM2835
> specific file structures.
>
> The common code files now live in src/libcamera/pipeline/rpi/common/
> and the vc4 specific files in src/libcamera/pipeline/rpi/vc4/.
s/vc4 specific/vc4-specific/
> To build the pipeline handler, the meson configuration option to select
> the Raspberry Pi pipeline handler has now changed from "raspberrypi" to
> "rpi/vc4":
>
> meson setup build -Dpipelines=rpi/vc4
>
> There are no functional changes in the pipeline handler code itself.
>
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> Reviewed-by: Jacopo Mondi <jacopo.mondi at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---
> Documentation/environment_variables.rst | 2 +-
> Documentation/guides/introduction.rst | 2 +-
> Documentation/guides/pipeline-handler.rst | 2 +-
> include/libcamera/ipa/meson.build | 2 +-
> meson.build | 2 +-
> meson_options.txt | 2 +-
> .../{raspberrypi => rpi/common}/delayed_controls.cpp | 0
> .../{raspberrypi => rpi/common}/delayed_controls.h | 0
> src/libcamera/pipeline/rpi/common/meson.build | 6 ++++++
> .../{raspberrypi => rpi/common}/rpi_stream.cpp | 0
> .../{raspberrypi => rpi/common}/rpi_stream.h | 0
> src/libcamera/pipeline/rpi/meson.build | 12 ++++++++++++
> .../{raspberrypi => rpi/vc4}/data/example.yaml | 0
> .../{raspberrypi => rpi/vc4}/data/meson.build | 2 +-
> .../pipeline/{raspberrypi => rpi/vc4}/dma_heaps.cpp | 0
> .../pipeline/{raspberrypi => rpi/vc4}/dma_heaps.h | 0
> .../pipeline/{raspberrypi => rpi/vc4}/meson.build | 2 --
> .../{raspberrypi => rpi/vc4}/raspberrypi.cpp | 6 +++---
> 18 files changed, 28 insertions(+), 12 deletions(-)
> rename src/libcamera/pipeline/{raspberrypi => rpi/common}/delayed_controls.cpp (100%)
> rename src/libcamera/pipeline/{raspberrypi => rpi/common}/delayed_controls.h (100%)
> create mode 100644 src/libcamera/pipeline/rpi/common/meson.build
> rename src/libcamera/pipeline/{raspberrypi => rpi/common}/rpi_stream.cpp (100%)
> rename src/libcamera/pipeline/{raspberrypi => rpi/common}/rpi_stream.h (100%)
> create mode 100644 src/libcamera/pipeline/rpi/meson.build
> rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/data/example.yaml (100%)
> rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/data/meson.build (63%)
> rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/dma_heaps.cpp (100%)
> rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/dma_heaps.h (100%)
> rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/meson.build (71%)
> rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/raspberrypi.cpp (99%)
>
> diff --git a/Documentation/environment_variables.rst b/Documentation/environment_variables.rst
> index ceeb251a2ac0..4bf38b877897 100644
> --- a/Documentation/environment_variables.rst
> +++ b/Documentation/environment_variables.rst
> @@ -40,7 +40,7 @@ LIBCAMERA_IPA_MODULE_PATH
> LIBCAMERA_RPI_CONFIG_FILE
> Define a custom configuration file to use in the Raspberry Pi pipeline handler.
>
> - Example value: ``/usr/local/share/libcamera/pipeline/raspberrypi/minimal_mem.yaml``
> + Example value: ``/usr/local/share/libcamera/pipeline/rpi/vc4/minimal_mem.yaml``
>
> Further details
> ---------------
> diff --git a/Documentation/guides/introduction.rst b/Documentation/guides/introduction.rst
> index 2d1760c1866b..700ec2d33c30 100644
> --- a/Documentation/guides/introduction.rst
> +++ b/Documentation/guides/introduction.rst
> @@ -288,7 +288,7 @@ with dedicated pipeline handlers:
>
> - Intel IPU3 (ipu3)
> - Rockchip RK3399 (rkisp1)
> - - RaspberryPi 3 and 4 (raspberrypi)
> + - RaspberryPi 3 and 4 (rpi/vc4)
>
> Furthermore, generic platform support is provided for the following:
>
> diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst
> index 1acd1812cf37..57644534de61 100644
> --- a/Documentation/guides/pipeline-handler.rst
> +++ b/Documentation/guides/pipeline-handler.rst
> @@ -183,7 +183,7 @@ to the libcamera build options in the top level ``meson_options.txt``.
>
> option('pipelines',
> type : 'array',
> - choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc', 'vivid'],
> + choices : ['ipu3', 'rkisp1', 'rpi/vc4', 'simple', 'uvcvideo', 'vimc', 'vivid'],
> description : 'Select which pipeline handlers to include')
>
>
> diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build
> index c57b3a5e1570..6060c68f047d 100644
> --- a/include/libcamera/ipa/meson.build
> +++ b/include/libcamera/ipa/meson.build
> @@ -64,7 +64,7 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',
> pipeline_ipa_mojom_mapping = {
> 'ipu3': 'ipu3.mojom',
> 'rkisp1': 'rkisp1.mojom',
> - 'raspberrypi': 'raspberrypi.mojom',
> + 'rpi/vc4': 'raspberrypi.mojom',
> 'vimc': 'vimc.mojom',
> }
>
> diff --git a/meson.build b/meson.build
> index 2d99029bf5b7..e1fd924307f7 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -194,8 +194,8 @@ arch_x86 = ['x86', 'x86_64']
> pipelines_support = {
> 'imx8-isi': arch_arm,
> 'ipu3': arch_x86,
> - 'raspberrypi': arch_arm,
> 'rkisp1': arch_arm,
> + 'rpi/vc4': arch_arm,
> 'simple': arch_arm,
> 'uvcvideo': ['any'],
> 'vimc': ['test'],
> diff --git a/meson_options.txt b/meson_options.txt
> index 78a78b7214d5..b4afb8e591a8 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -43,8 +43,8 @@ option('pipelines',
> 'auto',
> 'imx8-isi',
> 'ipu3',
> - 'raspberrypi',
> 'rkisp1',
> + 'rpi/vc4',
> 'simple',
> 'uvcvideo',
> 'vimc'
> diff --git a/src/libcamera/pipeline/raspberrypi/delayed_controls.cpp b/src/libcamera/pipeline/rpi/common/delayed_controls.cpp
> similarity index 100%
> rename from src/libcamera/pipeline/raspberrypi/delayed_controls.cpp
> rename to src/libcamera/pipeline/rpi/common/delayed_controls.cpp
> diff --git a/src/libcamera/pipeline/raspberrypi/delayed_controls.h b/src/libcamera/pipeline/rpi/common/delayed_controls.h
> similarity index 100%
> rename from src/libcamera/pipeline/raspberrypi/delayed_controls.h
> rename to src/libcamera/pipeline/rpi/common/delayed_controls.h
> diff --git a/src/libcamera/pipeline/rpi/common/meson.build b/src/libcamera/pipeline/rpi/common/meson.build
> new file mode 100644
> index 000000000000..2ad594cf8d1a
> --- /dev/null
> +++ b/src/libcamera/pipeline/rpi/common/meson.build
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: CC0-1.0
> +
> +libcamera_sources += files([
> + 'delayed_controls.cpp',
> + 'rpi_stream.cpp',
> +])
> diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> similarity index 100%
> rename from src/libcamera/pipeline/raspberrypi/rpi_stream.cpp
> rename to src/libcamera/pipeline/rpi/common/rpi_stream.cpp
> diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h
> similarity index 100%
> rename from src/libcamera/pipeline/raspberrypi/rpi_stream.h
> rename to src/libcamera/pipeline/rpi/common/rpi_stream.h
> diff --git a/src/libcamera/pipeline/rpi/meson.build b/src/libcamera/pipeline/rpi/meson.build
> new file mode 100644
> index 000000000000..2391b6a9729e
> --- /dev/null
> +++ b/src/libcamera/pipeline/rpi/meson.build
> @@ -0,0 +1,12 @@
> +# SPDX-License-Identifier: CC0-1.0
> +
> +subdir('common')
> +
> +foreach pipeline : pipelines
> + pipeline = pipeline.split('/')
> + if pipeline.length() < 2 or pipeline[0] != 'rpi'
> + continue
> + endif
> +
> + subdir(pipeline[1])
> +endforeach
> diff --git a/src/libcamera/pipeline/raspberrypi/data/example.yaml b/src/libcamera/pipeline/rpi/vc4/data/example.yaml
> similarity index 100%
> rename from src/libcamera/pipeline/raspberrypi/data/example.yaml
> rename to src/libcamera/pipeline/rpi/vc4/data/example.yaml
> diff --git a/src/libcamera/pipeline/raspberrypi/data/meson.build b/src/libcamera/pipeline/rpi/vc4/data/meson.build
> similarity index 63%
> rename from src/libcamera/pipeline/raspberrypi/data/meson.build
> rename to src/libcamera/pipeline/rpi/vc4/data/meson.build
> index 1c70433bbcbc..cca5e3885a4e 100644
> --- a/src/libcamera/pipeline/raspberrypi/data/meson.build
> +++ b/src/libcamera/pipeline/rpi/vc4/data/meson.build
> @@ -5,4 +5,4 @@ conf_files = files([
> ])
>
> install_data(conf_files,
> - install_dir : pipeline_data_dir / 'raspberrypi')
> + install_dir : pipeline_data_dir / 'rpi' / 'vc4')
> diff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.cpp b/src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp
> similarity index 100%
> rename from src/libcamera/pipeline/raspberrypi/dma_heaps.cpp
> rename to src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp
> diff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.h b/src/libcamera/pipeline/rpi/vc4/dma_heaps.h
> similarity index 100%
> rename from src/libcamera/pipeline/raspberrypi/dma_heaps.h
> rename to src/libcamera/pipeline/rpi/vc4/dma_heaps.h
> diff --git a/src/libcamera/pipeline/raspberrypi/meson.build b/src/libcamera/pipeline/rpi/vc4/meson.build
> similarity index 71%
> rename from src/libcamera/pipeline/raspberrypi/meson.build
> rename to src/libcamera/pipeline/rpi/vc4/meson.build
> index 59e8fb18c555..228823f30922 100644
> --- a/src/libcamera/pipeline/raspberrypi/meson.build
> +++ b/src/libcamera/pipeline/rpi/vc4/meson.build
> @@ -1,10 +1,8 @@
> # SPDX-License-Identifier: CC0-1.0
>
> libcamera_sources += files([
> - 'delayed_controls.cpp',
> 'dma_heaps.cpp',
> 'raspberrypi.cpp',
> - 'rpi_stream.cpp',
> ])
>
> subdir('data')
> diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/rpi/vc4/raspberrypi.cpp
> similarity index 99%
> rename from src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> rename to src/libcamera/pipeline/rpi/vc4/raspberrypi.cpp
> index 0060044143cc..af464d153f28 100644
> --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
> +++ b/src/libcamera/pipeline/rpi/vc4/raspberrypi.cpp
> @@ -2,7 +2,7 @@
> /*
> * Copyright (C) 2019-2021, Raspberry Pi Ltd
> *
> - * raspberrypi.cpp - Pipeline handler for Raspberry Pi devices
> + * raspberrypi.cpp - Pipeline handler for VC4-based Raspberry Pi devices
> */
> #include <algorithm>
> #include <assert.h>
> @@ -43,9 +43,9 @@
> #include "libcamera/internal/v4l2_videodevice.h"
> #include "libcamera/internal/yaml_parser.h"
>
> -#include "delayed_controls.h"
> +#include "../common/delayed_controls.h"
> +#include "../common/rpi_stream.h"
> #include "dma_heaps.h"
> -#include "rpi_stream.h"
>
> using namespace std::chrono_literals;
>
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list