{"id":18551,"url":"https://patchwork.libcamera.org/api/1.1/patches/18551/?format=json","web_url":"https://patchwork.libcamera.org/patch/18551/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230426131057.21550-4-naush@raspberrypi.com>","date":"2023-04-26T13:10:47","name":"[libcamera-devel,03/13] pipeline: raspberrypi: Refactor and move pipeline handler code","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a071bc51b9c3db0e235146cb0daea15641ff3d94","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18551/mbox/","series":[{"id":3847,"url":"https://patchwork.libcamera.org/api/1.1/series/3847/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3847","date":"2023-04-26T13:10:44","name":"Raspberry Pi: Code refactoring","version":1,"mbox":"https://patchwork.libcamera.org/series/3847/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18551/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18551/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id EE462BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 26 Apr 2023 13:13:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B3A21627EA;\n\tWed, 26 Apr 2023 15:13:17 +0200 (CEST)","from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 69B60627E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Apr 2023 15:13:14 +0200 (CEST)","by mail-wm1-x32e.google.com with SMTP id\n\t5b1f17b1804b1-3f195b164c4so37126405e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 26 Apr 2023 06:13:14 -0700 (PDT)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tk5-20020adff5c5000000b002f103ca90cdsm15780949wrp.101.2023.04.26.06.13.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 26 Apr 2023 06:13:12 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1682514797;\n\tbh=F3959Pm6JU5R3zup7IqNB32YmRQJwXCrrBJ1IbncgHw=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=0Vr4UV3JBpOVUCpRuHB1QQUIHcda9+iQEAQavZLlE1Y+85igQcNouKxc/CkBXrn5P\n\t7D7W9+fvzqSFLFKbA7ePvKHN5hDQZxHRA3tjjKq5hIpBD3SxOqOp/Vd6vBJ+ZO1RWF\n\tbIR27Odg1Cpqg3rNa3xyuHXj9v44CiHYRJDBHSWBkjnSLPYqh+O8IX9IKMcR8e7sEF\n\tJKn0hhobm3Zdh07HLa2F6giLQkhZLL9HABAh/b/s1MRSSz8fYCBGTH22jrlIHRaMJr\n\tLT4RGt60P+UqPeOiBykdvKdmPkjRfwNZAAhyWTQOfwoj01pfxOoTjRFHChDS7V/rJm\n\tmpVKNi478xzcw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1682514793; x=1685106793;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=NQoeQRknbIwTLq4lL4VzO01h7SoAhCUftXdW8ib11g4=;\n\tb=ldtEXm3PKdKcqPz7Bd19JtG0IDam7z+ntRYwcPoJhOAwiNx2MqPL2idpLvVVmp4Ue7\n\tRC3OAOb8jJFtWJxm4lVFHTWJdgZHevxsPothx7GEaoNyDeEE3jmSB6iSTDcdwOgeHat1\n\tJtqSPpfR+vPc22DT2w83GmI0HS7NLbyEQsbKGxHboRRhmRQaQt4Vvl4fEGt+u8HNrsV3\n\txgLEzgHgMv9Pgi+k4rj4l/Dax4/l5FJtiHahPvz76X7lUq95AH1gMty0wpo5BUZdhGNI\n\t5gfbnBlqJXKk/5vcTU1OoUNhMbrUC1WQ8lF9qyIfUjGI7y+X03ZTVG4hTgQ1gDuENsaX\n\tkrbA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"ldtEXm3P\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1682514793; x=1685106793;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=NQoeQRknbIwTLq4lL4VzO01h7SoAhCUftXdW8ib11g4=;\n\tb=e9Au/HiIP4Q6PiG7p6eoh87a6AinoM5VDU48b5AI2n4RhTn1fJf/4vL16bMUxwJJkV\n\tXAibZFsJbfhvoh258yyxkX55KhANWT0jimcfpXpoFqxBP6IUU3cnQQB3ndrm3WEovhn2\n\tXtvPwHsRN2RLRuPnTnoW1jHsth79miN9BqsV7honVuKFUKMFrAT2P0sBFfJvm421cQpb\n\t6XOGltmpRqLq72qAVBTaA65Qfdf5kbsp8wGUO2Tidc+qNLGFp+lPiPSyP51hAWS2WtMt\n\timXoZqGHRTBANUjETNyP46hCCHJ6X1ylMX/P2oLTO2c0c8yStseg7CDxKz3S+V9z4aPL\n\tQvgA==","X-Gm-Message-State":"AAQBX9fPqPZcK9chcWdgh2xiugwrP41Gieav7prCHox5RJIVFCdBB7K2\n\thIrOwGwyNWs+IrlGBU6lHGu9cqXVGTgtzsQ1ldTmQQ==","X-Google-Smtp-Source":"AKy350bH8M2NHeyYPjpE3EhZj4T6p4RZD0JFP7Trh2pB5w0WLo6Hr0niaqxkwy+l8FEFF+VpkaOIkw==","X-Received":"by 2002:a1c:4b1a:0:b0:3f1:7bb5:9d71 with SMTP id\n\ty26-20020a1c4b1a000000b003f17bb59d71mr12663855wma.33.1682514793556; \n\tWed, 26 Apr 2023 06:13:13 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 26 Apr 2023 14:10:47 +0100","Message-Id":"<20230426131057.21550-4-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20230426131057.21550-1-naush@raspberrypi.com>","References":"<20230426131057.21550-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 03/13] pipeline: raspberrypi: Refactor and\n\tmove pipeline handler code","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Split the Raspberry Pi pipeline handler code into common and VC4/BCM2835\nspecific file structures.\n\nThe common code files now live in src/libcamera/pipeline/rpi/common/\nand the vc4 specific files in src/libcamera/pipeline/rpi/vc4/.\n\nTo build the pipeline handler, the meson configuration option to select\nthe Raspberry Pi pipeline handler has now changed from \"raspberrypi\" to\n\"rpi/vc4\":\n\nmeson setup build -Dpipelines=rpi/vc4\n\nThere are no functional changes in the pipeline handler code itself.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n Documentation/environment_variables.rst                  | 2 +-\n Documentation/guides/introduction.rst                    | 2 +-\n Documentation/guides/ipa.rst                             | 2 +-\n Documentation/guides/pipeline-handler.rst                | 2 +-\n include/libcamera/ipa/meson.build                        | 2 +-\n meson.build                                              | 2 +-\n meson_options.txt                                        | 2 +-\n src/libcamera/pipeline/meson.build                       | 9 +++++++++\n .../{raspberrypi => rpi/common}/delayed_controls.cpp     | 0\n .../{raspberrypi => rpi/common}/delayed_controls.h       | 0\n src/libcamera/pipeline/rpi/common/meson.build            | 8 ++++++++\n .../pipeline/{raspberrypi => rpi/common}/rpi_stream.cpp  | 0\n .../pipeline/{raspberrypi => rpi/common}/rpi_stream.h    | 0\n .../pipeline/{raspberrypi => rpi/vc4}/data/example.yaml  | 0\n .../pipeline/{raspberrypi => rpi/vc4}/data/meson.build   | 2 +-\n .../pipeline/{raspberrypi => rpi/vc4}/dma_heaps.cpp      | 0\n .../pipeline/{raspberrypi => rpi/vc4}/dma_heaps.h        | 0\n .../pipeline/{raspberrypi => rpi/vc4}/meson.build        | 2 --\n .../pipeline/{raspberrypi => rpi/vc4}/raspberrypi.cpp    | 2 +-\n 19 files changed, 26 insertions(+), 11 deletions(-)\n rename src/libcamera/pipeline/{raspberrypi => rpi/common}/delayed_controls.cpp (100%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/common}/delayed_controls.h (100%)\n create mode 100644 src/libcamera/pipeline/rpi/common/meson.build\n rename src/libcamera/pipeline/{raspberrypi => rpi/common}/rpi_stream.cpp (100%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/common}/rpi_stream.h (100%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/data/example.yaml (100%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/data/meson.build (63%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/dma_heaps.cpp (100%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/dma_heaps.h (100%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/meson.build (71%)\n rename src/libcamera/pipeline/{raspberrypi => rpi/vc4}/raspberrypi.cpp (99%)","diff":"diff --git a/Documentation/environment_variables.rst b/Documentation/environment_variables.rst\nindex ceeb251a2ac0..4bf38b877897 100644\n--- a/Documentation/environment_variables.rst\n+++ b/Documentation/environment_variables.rst\n@@ -40,7 +40,7 @@ LIBCAMERA_IPA_MODULE_PATH\n LIBCAMERA_RPI_CONFIG_FILE\n    Define a custom configuration file to use in the Raspberry Pi pipeline handler.\n \n-   Example value: ``/usr/local/share/libcamera/pipeline/raspberrypi/minimal_mem.yaml``\n+   Example value: ``/usr/local/share/libcamera/pipeline/rpi/vc4/minimal_mem.yaml``\n \n Further details\n ---------------\ndiff --git a/Documentation/guides/introduction.rst b/Documentation/guides/introduction.rst\nindex 2d1760c1866b..700ec2d33c30 100644\n--- a/Documentation/guides/introduction.rst\n+++ b/Documentation/guides/introduction.rst\n@@ -288,7 +288,7 @@ with dedicated pipeline handlers:\n \n    -  Intel IPU3 (ipu3)\n    -  Rockchip RK3399 (rkisp1)\n-   -  RaspberryPi 3 and 4 (raspberrypi)\n+   -  RaspberryPi 3 and 4 (rpi/vc4)\n \n Furthermore, generic platform support is provided for the following:\n \ndiff --git a/Documentation/guides/ipa.rst b/Documentation/guides/ipa.rst\nindex 89839408672a..10301d89fc80 100644\n--- a/Documentation/guides/ipa.rst\n+++ b/Documentation/guides/ipa.rst\n@@ -279,7 +279,7 @@ For example, adding the raspberrypi.mojom file to meson:\n .. code-block:: none\n \n         pipeline_ipa_mojom_mapping = [\n-            'raspberrypi': 'raspberrypi.mojom',\n+            'rpi/vc4': 'raspberrypi.mojom',\n         ]\n \n This will cause the mojo data definition file to be compiled. Specifically, it\ndiff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst\nindex 4d38fa23fbcd..7d143b0eaecb 100644\n--- a/Documentation/guides/pipeline-handler.rst\n+++ b/Documentation/guides/pipeline-handler.rst\n@@ -183,7 +183,7 @@ to the libcamera build options in the top level ``meson_options.txt``.\n \n    option('pipelines',\n            type : 'array',\n-           choices : ['ipu3', 'raspberrypi', 'rkisp1', 'simple', 'uvcvideo', 'vimc', 'vivid'],\n+           choices : ['ipu3', 'rpi/vc4', 'rkisp1', 'simple', 'uvcvideo', 'vimc', 'vivid'],\n            description : 'Select which pipeline handlers to include')\n \n \ndiff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build\nindex 67c31cb04ccf..bae15d64d7d8 100644\n--- a/include/libcamera/ipa/meson.build\n+++ b/include/libcamera/ipa/meson.build\n@@ -64,7 +64,7 @@ libcamera_generated_ipa_headers += custom_target('core_ipa_serializer_h',\n pipeline_ipa_mojom_mapping = {\n     'ipu3': 'ipu3.mojom',\n     'rkisp1': 'rkisp1.mojom',\n-    'raspberrypi': 'raspberrypi.mojom',\n+    'rpi/vc4': 'raspberrypi.mojom',\n     'vimc': 'vimc.mojom',\n }\n \ndiff --git a/meson.build b/meson.build\nindex 8628e6acebee..f60da3e17719 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -179,7 +179,7 @@ arch_x86 = ['x86', 'x86_64']\n pipelines_support = {\n     'imx8-isi':     arch_arm,\n     'ipu3':         arch_x86,\n-    'raspberrypi':  arch_arm,\n+    'rpi/vc4':      arch_arm,\n     'rkisp1':       arch_arm,\n     'simple':       arch_arm,\n     'uvcvideo':     ['any'],\ndiff --git a/meson_options.txt b/meson_options.txt\nindex 78a78b7214d5..e1f4c205aa94 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -43,7 +43,7 @@ option('pipelines',\n             'auto',\n             'imx8-isi',\n             'ipu3',\n-            'raspberrypi',\n+            'rpi/vc4',\n             'rkisp1',\n             'simple',\n             'uvcvideo',\ndiff --git a/src/libcamera/pipeline/meson.build b/src/libcamera/pipeline/meson.build\nindex f14869f3a3c0..4f55611013db 100644\n--- a/src/libcamera/pipeline/meson.build\n+++ b/src/libcamera/pipeline/meson.build\n@@ -3,6 +3,15 @@\n # Location of pipeline specific configuration files\n pipeline_data_dir = libcamera_datadir / 'pipeline'\n \n+# If the Raspberry Pi VC4 pipeline handler is enabled, ensure we include the\n+# rpi/common subdirectory in the build.\n+#\n+# This is done here and not within rpi/vc4/meson.build as meson does not\n+# allow the subdir command to traverse up the directory tree.\n+if pipelines.contains('rpi/vc4')\n+    subdir('rpi/common')\n+endif\n+\n foreach pipeline : pipelines\n     subdir(pipeline)\n endforeach\ndiff --git a/src/libcamera/pipeline/raspberrypi/delayed_controls.cpp b/src/libcamera/pipeline/rpi/common/delayed_controls.cpp\nsimilarity index 100%\nrename from src/libcamera/pipeline/raspberrypi/delayed_controls.cpp\nrename to src/libcamera/pipeline/rpi/common/delayed_controls.cpp\ndiff --git a/src/libcamera/pipeline/raspberrypi/delayed_controls.h b/src/libcamera/pipeline/rpi/common/delayed_controls.h\nsimilarity index 100%\nrename from src/libcamera/pipeline/raspberrypi/delayed_controls.h\nrename to src/libcamera/pipeline/rpi/common/delayed_controls.h\ndiff --git a/src/libcamera/pipeline/rpi/common/meson.build b/src/libcamera/pipeline/rpi/common/meson.build\nnew file mode 100644\nindex 000000000000..1dec6d3d028b\n--- /dev/null\n+++ b/src/libcamera/pipeline/rpi/common/meson.build\n@@ -0,0 +1,8 @@\n+# SPDX-License-Identifier: CC0-1.0\n+\n+libcamera_sources += files([\n+    'delayed_controls.cpp',\n+    'rpi_stream.cpp',\n+])\n+\n+includes += include_directories('.')\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/rpi/common/rpi_stream.cpp\nsimilarity index 100%\nrename from src/libcamera/pipeline/raspberrypi/rpi_stream.cpp\nrename to src/libcamera/pipeline/rpi/common/rpi_stream.cpp\ndiff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h\nsimilarity index 100%\nrename from src/libcamera/pipeline/raspberrypi/rpi_stream.h\nrename to src/libcamera/pipeline/rpi/common/rpi_stream.h\ndiff --git a/src/libcamera/pipeline/raspberrypi/data/example.yaml b/src/libcamera/pipeline/rpi/vc4/data/example.yaml\nsimilarity index 100%\nrename from src/libcamera/pipeline/raspberrypi/data/example.yaml\nrename to src/libcamera/pipeline/rpi/vc4/data/example.yaml\ndiff --git a/src/libcamera/pipeline/raspberrypi/data/meson.build b/src/libcamera/pipeline/rpi/vc4/data/meson.build\nsimilarity index 63%\nrename from src/libcamera/pipeline/raspberrypi/data/meson.build\nrename to src/libcamera/pipeline/rpi/vc4/data/meson.build\nindex 1c70433bbcbc..a7dfa02320e5 100644\n--- a/src/libcamera/pipeline/raspberrypi/data/meson.build\n+++ b/src/libcamera/pipeline/rpi/vc4/data/meson.build\n@@ -5,4 +5,4 @@ conf_files = files([\n ])\n \n install_data(conf_files,\n-             install_dir : pipeline_data_dir / 'raspberrypi')\n+             install_dir : pipeline_data_dir / 'rpi/vc4')\ndiff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.cpp b/src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp\nsimilarity index 100%\nrename from src/libcamera/pipeline/raspberrypi/dma_heaps.cpp\nrename to src/libcamera/pipeline/rpi/vc4/dma_heaps.cpp\ndiff --git a/src/libcamera/pipeline/raspberrypi/dma_heaps.h b/src/libcamera/pipeline/rpi/vc4/dma_heaps.h\nsimilarity index 100%\nrename from src/libcamera/pipeline/raspberrypi/dma_heaps.h\nrename to src/libcamera/pipeline/rpi/vc4/dma_heaps.h\ndiff --git a/src/libcamera/pipeline/raspberrypi/meson.build b/src/libcamera/pipeline/rpi/vc4/meson.build\nsimilarity index 71%\nrename from src/libcamera/pipeline/raspberrypi/meson.build\nrename to src/libcamera/pipeline/rpi/vc4/meson.build\nindex 59e8fb18c555..228823f30922 100644\n--- a/src/libcamera/pipeline/raspberrypi/meson.build\n+++ b/src/libcamera/pipeline/rpi/vc4/meson.build\n@@ -1,10 +1,8 @@\n # SPDX-License-Identifier: CC0-1.0\n \n libcamera_sources += files([\n-    'delayed_controls.cpp',\n     'dma_heaps.cpp',\n     'raspberrypi.cpp',\n-    'rpi_stream.cpp',\n ])\n \n subdir('data')\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/rpi/vc4/raspberrypi.cpp\nsimilarity index 99%\nrename from src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nrename to src/libcamera/pipeline/rpi/vc4/raspberrypi.cpp\nindex a4fff28bf198..4595773d2517 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/raspberrypi.cpp\n@@ -2,7 +2,7 @@\n /*\n  * Copyright (C) 2019-2021, Raspberry Pi Ltd\n  *\n- * raspberrypi.cpp - Pipeline handler for Raspberry Pi devices\n+ * raspberrypi.cpp - Pipeline handler for VC4 based Raspberry Pi devices\n  */\n #include <algorithm>\n #include <assert.h>\n","prefixes":["libcamera-devel","03/13"]}