From patchwork Fri May 3 14:49:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Vuillaumier X-Patchwork-Id: 19998 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 90637BDE6B for ; Fri, 3 May 2024 14:49:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 44A8363418; Fri, 3 May 2024 16:49:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="YLmP3pg6"; dkim-atps=neutral Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:260f::601]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B2C263415 for ; Fri, 3 May 2024 16:49:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BypWvKLb6qmgc5j2++KBRaMlVU1m4dqGK21C87pu2uUtntbHzfgHVoGL9r3sTQjidhjvr7PQW5M6XLRnOdCQnQSdM1UdBqbPpBHT6Uji8hyqIHC6cJr0PAUZk4X+qObwve7WqQPcH8TuArI3+Osg5ZXyPnFjkomhZrubTEIlmsGqoGBkIL77IPWslkCk8ngK5FPZxKioUswENfdwTGx90l4UzsLcMjoAtNBCx+rA6cjLt2pyBWqi3BoxNxX+8sGHPF4yT7Blsi9GR1QBOsSJ9809hkA+raOdbzmeTzaOGKmMmP2VQ98qw8wwCbp3gHzdgQg6NMD1z9lQI9+mc7VBwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IAHQRbcb8oyR9I3LUCdcMo+09PpYgoJqXBK+yBn42UM=; b=RnyWLpFLutQObLdJxsirn0f8sBuQ/vYscgU0Rl3L4NMyCI1vn7Zy8FVZ9mFNNnjpaLN8dJ1TELiaIRBJJEb8BxdupycUgnOan8bcbo3C1YoEuyByXnQJlVr2P1cd2+AWRY7LbnTSpLQIBj7pP2DyxaB2C0ZzUuvZbHLdyguEKkFqqKpjzP730RbegQCsO9bAtAqzSshqiXPxS7Ttrnh2/zPirZRXa9j8TkkKhaIOum00yFfHTUJ/yvC0n0B4fw1HA2TzoDUj3fy89cXhaHbM26yh70LQu38LfgBfm171QcsU9s5EyK/OAJOjZjVpcXrk1psPi3sR8NfzWBqd98X1Lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IAHQRbcb8oyR9I3LUCdcMo+09PpYgoJqXBK+yBn42UM=; b=YLmP3pg6urCq4WlaC6w9f2ehXGSllPTHRj6fBCdF5p4hQWYNrwO8W1nj5sXt98Reyxbg4dQZvXNv8QjB+Y6MNdc+6SuFeAA45jMyXyzc4a3xnDpZ6zhnyuvBtsIW5Mibx/XrcTbLCHYA87IETSi2TPuB5swEudBn8r8G45AZ6Ho= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) by PAXPR04MB9570.eurprd04.prod.outlook.com (2603:10a6:102:24d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.30; Fri, 3 May 2024 14:49:51 +0000 Received: from AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::eace:e980:28a4:ef8a]) by AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::eace:e980:28a4:ef8a%2]) with mapi id 15.20.7544.029; Fri, 3 May 2024 14:49:51 +0000 From: Julien Vuillaumier To: libcamera-devel@lists.libcamera.org Cc: jacopo.mondi@ideasonboard.com, kieran.bingham@ideasonboard.com, julien.vuillaumier@nxp.com Subject: [PATCH v4 1/3] libcamera: pipeline: Rename pipelines to a shorter name Date: Fri, 3 May 2024 16:49:17 +0200 Message-Id: <20240503144919.2371357-2-julien.vuillaumier@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240503144919.2371357-1-julien.vuillaumier@nxp.com> References: <20240503144919.2371357-1-julien.vuillaumier@nxp.com> X-ClientProxiedBy: AM0PR03CA0003.eurprd03.prod.outlook.com (2603:10a6:208:14::16) To AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8147:EE_|PAXPR04MB9570:EE_ X-MS-Office365-Filtering-Correlation-Id: e99ccf27-5257-44b4-c236-08dc6b8049d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|1800799015|376005|366007|38350700005; X-Microsoft-Antispam-Message-Info: wIwRS5XZT6qc63bgBwP5MtR+VMDKXd6ucX0pOLYdXxn2K0hGO0/nW+zyxBxwQFL1JhTtUY0rvYUo0ae4puufxVxuQjgRpuFyiPLxzD/Kr3M6zw87nxSZcyjl21/0XgvDGFHOs/tF+kZg58RsfWmDbWNpkALjcdf6gWwmCy8xzSSeT6VjhQksx3SUtXlEC6PxS/aepm6jlF5cE45pgBy21Z0dPXq1a8FgUkctc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255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8147.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BhKIOu9Y+oMpgkIF2+gtJ39nxt/upaRRf+lWc/d8aj99R6LL7DHMf3T4MJ/CciIVvHAYz5aUzNnFxYQ/FwXqV79LZf4iNHmGMULXGriuycQZhgV9rS9+578NmJ0UobCS/FWtnrX+zEb28r0PYrMGutYyeq/jylnhrM3JvDYrwTIq3l3uRBJ0EiBdhhYQMFFCJHdRdQ3wUgjf+RXiV/fNEX+tqR2Cf4uLJl79JlNUYypv8DRrNGVMJQ17okNjeCVO33fAWAoVlX2Y01rbx3uqpyHGxr9ZuEsa1jf6t6Sea4pZM0WJ/TIUiWe0AQMZEGJyVD7hg7tO2MBqSUeX7Gc8bYSD57eRSlYzsuiB7Kx5dVnbi1gBGUMzUXl7hpgtgV2+jVo2yhuik5GcR8jhHlu28u9/oHgKpUU2W2PJNDLNwdlRLpr3Jkk/hrzN5lcdWMMmaf0I5pPCfvX1nRgx91i3M8HLLOeZhi5y2t4GPJ7FhF/9+0We9clFPWsAbmTRTHmSiASS4aagGBCs4cZFgMybeINvf44izGM5pZroXB51HwdSx/eqIsxFZaFIsxOJfWJ/nD5hy1MEyrIOI6VV1jEtmczVJsJeHVNut9qKxaNhQzYWOjWOBqfBHlX+XU6q2CHkYnx4ZN5PiUiK0MeOVdKbOCJ1g+NUDmujysFOesp5DZusfMnZpxu4HrH/0qzMB7Yf2uWDK+BM36I2gjG3daNq8CYPo9A48RhMvb7rlLwt1Imk24ihgklkQ33rTBRC00JidI1EWhHAa5cVRzUdq9DK39Aam4FcCGUMe+7WrVtDKksIa5CXV3B2w+8FO1YyLlZQyoZvltVUt/mg314sdS1TPmOpK/LhitMmzGG/tQlsql8caIdvajnGwrzDZNntctGKzRJ1aeVU5E3ADwSPPc6Dv80JO0T2JjS+tta+bL58eEwTkL7quqRIFepGyT1ghcmXq/nf5SnH/NMns2HYWGL5c9VEYqHOOaZ4LKKCOZ2iqjekXmtKDemZxqMCHHnOWs4de1Ic/cArrRrbyXMQyLmo3Sg08Nvyrb4deVm2TD+WZXY6k2BVmXxOGRCjFud0q48YD1JH5ZwE4crrhtrK9n25b/mXTySnIR3Rg7Bgv+CAhoM4warg57I48ZOwWADYEB5ACWvILPNtVLKegIATl8xwf9WGtwghY+6guLYQETUBQAFoevquwQeDJ+U1NeFzupZPfcyMGdTjDoTQQzy/SUuNKBn/InXh+2yXZfltX1wOuLRRd87hfxqY+wgSexjjPWbTdBgCkCj9BEYv6tngTwaWmytYM87VVAgkD7ZoqqAKNDe1yIyrWZldLtPsdAhqKgThz/tmHo1aNXr5kW+AUjW3rE0p/ko8GaY9jqgTEj1Hmo/tAZDO9A5aPf9wlwp/AGadNvCHqhp+T91G1Ek64Ad5Cg5s+U7Wi7gRLEr3BVgCeGtHvsx1eVIH0nL5ryGuefgA+Qa0BAGm3JmB0fIjtFp0FOFtfNt7r7TOZWqIDr2BvlORFIaX12BReVkrP0ao/myT3rnrXBg7mGXCOM3WwM7g3GWkiGEku79xtMlxtIaJBg/uyzPOhUZHO3jre4Zt9BMOU8DptetZYLOQ1rti5HKVKg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e99ccf27-5257-44b4-c236-08dc6b8049d1 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8147.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 14:49:51.9579 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1W5UEObHCrayz2UmnUaUu12Ssev0zpTWInuBs6WbuHilmozA1RL23PyHpO+69O2ManX6q2X4HOVybwCJrZu9z3P88256nN21IwSG+TPBpsM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9570 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The PipelineHandlerFactoryBase class has a name that is propagated to the PipelineHandler instance it creates. In present implementation, this name comes from the REGISTER_PIPELINE_HANDLER registration macro. It corresponds to the stringified name of the PipelineHandler derived class. Therefore, PipelineHandler factories and instances names can be quite long such as "PipelineHandlerRkISP1". A libcamera user may have to explicitly refer to a PipelineHandler name for configuration purpose: one usage of the name can be to define a pipeline handlers match list and their priorities. It is desired, for user convenience, to use a short name to designate a pipeline handler. Reusing the short pipeline names already defined in the meson option files is an existing and consistent way of naming pipelines. This change adds an explicit name parameter to the REGISTER_PIPELINE_HANDLER registration macro. That parameter is used to define the name of a pipeline handler factory, instead of the current pipeline handler class name. Each pipeline registration is updated accordingly. The short name assigned corresponds to the pipeline directory name in the source tree. It is consistent with pipelines names used in meson. Changing the pipeline name has an impact on the IPA modules: each module defines a IPAModuleInfo structure. This structure has a pipelineName member defining the pipeline handler name it shall match with. Therefore, each internal IPA module definition has to be changed to have its IPAModuleInfo pipelineName name updated with the short pipeline handler name. In addition to this pipelineName member, the IPAModuleInfo structure also has a name member, associated to the IPA module name. Having renamed the pipelines to a short name, the pipeline name and the IPA module names of the IPAModuleInfo structure are the same: for in-tree IPA, they correspond to the respective pipeline and IPA subdirectories in the source tree. However the IPA name could be different, for instance with a close source IPA implementation built out-of-tree. Thus, it makes sense to keep the IPA name in that structure, as the 2 definitions may not always be redundant. Signed-off-by: Julien Vuillaumier Reviewed-by: Kieran Bingham Reviewed-by: Kieran Bingham --- Documentation/guides/pipeline-handler.rst | 4 +++- include/libcamera/internal/pipeline_handler.h | 4 ++-- src/ipa/ipu3/ipu3.cpp | 2 +- src/ipa/rkisp1/rkisp1.cpp | 2 +- src/ipa/rpi/vc4/vc4.cpp | 2 +- src/ipa/simple/soft_simple.cpp | 2 +- src/ipa/vimc/vimc.cpp | 2 +- src/libcamera/pipeline/imx8-isi/imx8-isi.cpp | 2 +- src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +- src/libcamera/pipeline/mali-c55/mali-c55.cpp | 2 +- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 +- src/libcamera/pipeline/rpi/vc4/vc4.cpp | 2 +- src/libcamera/pipeline/simple/simple.cpp | 2 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +- src/libcamera/pipeline/vimc/vimc.cpp | 2 +- src/libcamera/pipeline_handler.cpp | 2 ++ test/ipa/ipa_interface_test.cpp | 2 +- test/ipa/ipa_module_test.cpp | 2 +- 18 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Documentation/guides/pipeline-handler.rst b/Documentation/guides/pipeline-handler.rst index 728e9676..7e45cdb8 100644 --- a/Documentation/guides/pipeline-handler.rst +++ b/Documentation/guides/pipeline-handler.rst @@ -258,7 +258,7 @@ implementations for the overridden class members. return false; } - REGISTER_PIPELINE_HANDLER(PipelineHandlerVivid) + REGISTER_PIPELINE_HANDLER(PipelineHandlerVivid, "vivid") } /* namespace libcamera */ @@ -266,6 +266,8 @@ Note that you must register the ``PipelineHandler`` subclass with the pipeline handler factory using the `REGISTER_PIPELINE_HANDLER`_ macro which registers it and creates a global symbol to reference the class and make it available to try and match devices. +String "vivid" is the name assigned to the pipeline, matching the pipeline +subdirectory name in the source tree. .. _REGISTER_PIPELINE_HANDLER: https://libcamera.org/api-html/pipeline__handler_8h.html diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index c96944f4..cc70f69c 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -140,7 +140,7 @@ public: } }; -#define REGISTER_PIPELINE_HANDLER(handler) \ -static PipelineHandlerFactory global_##handler##Factory(#handler); +#define REGISTER_PIPELINE_HANDLER(handler, name) \ +static PipelineHandlerFactory global_##handler##Factory(name); } /* namespace libcamera */ diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 08ee6eb3..994c0eda 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -672,7 +672,7 @@ extern "C" { const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, - "PipelineHandlerIPU3", + "ipu3", "ipu3", }; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 9dc5f53c..5319c98f 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -458,7 +458,7 @@ extern "C" { const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, - "PipelineHandlerRkISP1", + "rkisp1", "rkisp1", }; diff --git a/src/ipa/rpi/vc4/vc4.cpp b/src/ipa/rpi/vc4/vc4.cpp index d2159a51..11316e05 100644 --- a/src/ipa/rpi/vc4/vc4.cpp +++ b/src/ipa/rpi/vc4/vc4.cpp @@ -583,7 +583,7 @@ extern "C" { const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 1, - "PipelineHandlerVc4", + "rpi/vc4", "rpi/vc4", }; diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp index b9fb58b5..39c49448 100644 --- a/src/ipa/simple/soft_simple.cpp +++ b/src/ipa/simple/soft_simple.cpp @@ -389,7 +389,7 @@ extern "C" { const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 0, - "SimplePipelineHandler", + "simple", "simple", }; diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index 2c255778..1bda772f 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -200,7 +200,7 @@ extern "C" { const struct IPAModuleInfo ipaModuleInfo = { IPA_MODULE_API_VERSION, 0, - "PipelineHandlerVimc", + "vimc", "vimc", }; diff --git a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp index 63082cea..f4d755c2 100644 --- a/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp +++ b/src/libcamera/pipeline/imx8-isi/imx8-isi.cpp @@ -1112,6 +1112,6 @@ void PipelineHandlerISI::bufferReady(FrameBuffer *buffer) completeRequest(request); } -REGISTER_PIPELINE_HANDLER(PipelineHandlerISI) +REGISTER_PIPELINE_HANDLER(PipelineHandlerISI, "imx8-isi") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index fa4bd0bb..d1708d42 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -1420,6 +1420,6 @@ void IPU3CameraData::frameStart(uint32_t sequence) *testPatternMode); } -REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3) +REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3, "ipu3") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/mali-c55/mali-c55.cpp b/src/libcamera/pipeline/mali-c55/mali-c55.cpp index 78343553..44e84bcf 100644 --- a/src/libcamera/pipeline/mali-c55/mali-c55.cpp +++ b/src/libcamera/pipeline/mali-c55/mali-c55.cpp @@ -1061,6 +1061,6 @@ bool PipelineHandlerMaliC55::match(DeviceEnumerator *enumerator) return true; } -REGISTER_PIPELINE_HANDLER(PipelineHandlerMaliC55) +REGISTER_PIPELINE_HANDLER(PipelineHandlerMaliC55, "mali-c55") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index abb21968..d8f99135 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -1322,6 +1322,6 @@ void PipelineHandlerRkISP1::statReady(FrameBuffer *buffer) data->delayedCtrls_->get(buffer->metadata().sequence)); } -REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1) +REGISTER_PIPELINE_HANDLER(PipelineHandlerRkISP1, "rkisp1") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 947b1e73..013c6519 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -1018,6 +1018,6 @@ bool Vc4CameraData::findMatchingBuffers(BayerFrame &bayerFrame, FrameBuffer *&em return true; } -REGISTER_PIPELINE_HANDLER(PipelineHandlerVc4) +REGISTER_PIPELINE_HANDLER(PipelineHandlerVc4, "rpi/vc4") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 61a59926..e62e9172 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -1732,6 +1732,6 @@ void SimplePipelineHandler::releasePipeline(SimpleCameraData *data) } } -REGISTER_PIPELINE_HANDLER(SimplePipelineHandler) +REGISTER_PIPELINE_HANDLER(SimplePipelineHandler, "simple") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index ed9c7f88..33464517 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -709,6 +709,6 @@ void UVCCameraData::bufferReady(FrameBuffer *buffer) pipe()->completeRequest(request); } -REGISTER_PIPELINE_HANDLER(PipelineHandlerUVC) +REGISTER_PIPELINE_HANDLER(PipelineHandlerUVC, "uvcvideo") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 5e66ee1d..f681102d 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -623,6 +623,6 @@ void VimcCameraData::paramsBufferReady([[maybe_unused]] unsigned int id, { } -REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc) +REGISTER_PIPELINE_HANDLER(PipelineHandlerVimc, "vimc") } /* namespace libcamera */ diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 29e0c98a..0c913e50 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -830,6 +830,8 @@ std::vector &PipelineHandlerFactoryBase::factories * \def REGISTER_PIPELINE_HANDLER * \brief Register a pipeline handler with the pipeline handler factory * \param[in] handler Class name of PipelineHandler derived class to register + * \param[in] name Name assigned to the pipeline handler, matching the pipeline + * subdirectory name in the source tree. * * Register a PipelineHandler subclass with the factory and make it available to * try and match devices. diff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp index 56f3cd6d..b489b5f6 100644 --- a/test/ipa/ipa_interface_test.cpp +++ b/test/ipa/ipa_interface_test.cpp @@ -56,7 +56,7 @@ protected: const std::vector &factories = PipelineHandlerFactoryBase::factories(); for (const PipelineHandlerFactoryBase *factory : factories) { - if (factory->name() == "PipelineHandlerVimc") { + if (factory->name() == "vimc") { pipe_ = factory->create(nullptr); break; } diff --git a/test/ipa/ipa_module_test.cpp b/test/ipa/ipa_module_test.cpp index bd5e0e4c..ae6f7a52 100644 --- a/test/ipa/ipa_module_test.cpp +++ b/test/ipa/ipa_module_test.cpp @@ -57,7 +57,7 @@ protected: const struct IPAModuleInfo testInfo = { IPA_MODULE_API_VERSION, 0, - "PipelineHandlerVimc", + "vimc", "vimc", }; From patchwork Fri May 3 14:49:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Vuillaumier X-Patchwork-Id: 19999 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B9A7EC328F for ; Fri, 3 May 2024 14:50:00 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 24B7F63421; Fri, 3 May 2024 16:50:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="jYSQ9Yhy"; dkim-atps=neutral Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2611::600]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E72B863415 for ; Fri, 3 May 2024 16:49:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RRkaZunwfjpXcXZZ9zpz2g18dPJDUD/Oib8xDdiwSNM3Y2s6rU4tbQVjwsfdQm7B90UER7TiojKgkTQzVINd5iX7fYHQqtj5/uyuqqJdiXq/cqc3PgauHWsYHOzkuSubRKEcrtljsAg5EwkuVgumzu7sFoJuYkYzi5oOC/CzeC3OoAVXLksfviAYd55mv4rwIGcIXHPObDjak/KiPB0z5ukQaWLY3uOqq5nJOvev/eucbDOQA+qXweLlWeJ3CD3tWB1sM4Q+4e+keucNVeVzzas1hmXceTJhdeW4vqJ2xRAo6mlaI1e/TyhhuzaJFGis6Xecn8vARnE2sPryA61rYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N56hWJanKO/y8R0j6yqApG+ySITioz6QcoDFpy92nzk=; b=dO+kcnxi6o/5UbUinUAVvAQymQHQ+46VoUwJXDZNMgwnyMh/0LW4ZciTgHLt6p8WS6hczdExfy0P0Y7Z2nUwMI1X29ONltOCPAXmfTeIEjbQo8aNEBQ3Z7QP7HawOs8lpCPxB8J9T2vd/KogVYyoWegodUHN2ZQAVK39Vw+PpVSAc0Er0fePiR81WjcM3QIb9Kz6RroCvwcbLmbvvyXR7jNFLnYfGWNYRY3RqK34tLwpk3enB394IjgsI/FUnO/Bob45W5TIBXtiybF+IrTBy3shmtFQGpTGjTpzhN8feoF2KRECYx9aVclM9mGuPtl6OwR+cVKLBq1KnLxbwlzNYw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N56hWJanKO/y8R0j6yqApG+ySITioz6QcoDFpy92nzk=; b=jYSQ9Yhy5o8ABoVZokuq3z8L9HYYW+BNDUW6MXAAsi457rPg6vOTmEBzwEiitcxfJICRq2mO3HEqssvho84Naah07XYV+78ElyUyPGnqlY1abQfdOBphernFBkknVLvIwjJcNwMH0oCn2eJMCATPZ/jGfsVW1ypi4TnL27jxsDc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) by PAXPR04MB9570.eurprd04.prod.outlook.com (2603:10a6:102:24d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.30; Fri, 3 May 2024 14:49:56 +0000 Received: from AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::eace:e980:28a4:ef8a]) by AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::eace:e980:28a4:ef8a%2]) with mapi id 15.20.7544.029; Fri, 3 May 2024 14:49:56 +0000 From: Julien Vuillaumier To: libcamera-devel@lists.libcamera.org Cc: jacopo.mondi@ideasonboard.com, kieran.bingham@ideasonboard.com, julien.vuillaumier@nxp.com Subject: [PATCH v4 2/3] libcamera: pipeline: Add a get factory by name helper Date: Fri, 3 May 2024 16:49:18 +0200 Message-Id: <20240503144919.2371357-3-julien.vuillaumier@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240503144919.2371357-1-julien.vuillaumier@nxp.com> References: <20240503144919.2371357-1-julien.vuillaumier@nxp.com> X-ClientProxiedBy: AM0PR03CA0003.eurprd03.prod.outlook.com (2603:10a6:208:14::16) To AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8147:EE_|PAXPR04MB9570:EE_ X-MS-Office365-Filtering-Correlation-Id: 360b2312-bfe4-404c-9714-08dc6b804c84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|1800799015|376005|366007|38350700005; X-Microsoft-Antispam-Message-Info: VKStP8b0U3sjyHHuofKpy4CoETsehuP4vUryvFp9sbrcR1HFsIQkGYbXoWXE+ODNgeNtygqYu+OpEEmny/a7qqDyeUGl4E5DpS2uzwaaMUK2rEawd8Gz1TQxIcgo+6y6ffQELyzGPzCt4kAxA9ZWWhPThKMzJHdtILnVvjm1NcFcJ/sC2cCiHP7lWPtZRPe9ja+XgGkgP87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RbH8LPdZK/JrW7RmpprEAdEz/gBIQ5KoaSjtzEvYg9U8rkZtCIWVZJwyjqT3sbte6Jh0s1bhmLDgJ9mJprjg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8147.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XK2Kq+dUoBCniJYlhicLvg9sFegM8kS4Ij+sTgfW86nhCLTg8pXoAxE5Ah+DKpRvBK+vBx+3m+A83oHZZ66zvTB+qSN9E/Dfiz8IEr998yp1q0IDmiTx7TQ33nQEoe1fuaOwEBw3yVmKb3b7x+G4BQkcMPey+ve7SwJwoaOxf04OSrWkiuZIDlR8m7hJc8iq2M2/3g9cs6t+V9uroXxoUAmn8q/YAzqYz1KxqXVFVQfEI7Ry9zykVtClU+0OBMl3RBHlxAmKd+m7bZTubZVJQ6MEc+eKVX5jofkhyZ4K0T5epxsSdZ/x1QCJP/1qbl7ZNTqj95oprzJdXj3xiiB84jvLU87wJ34nnBtArCIEVLejsvEPPOTWAtN94QazjEZ1FG8M3G+q0VwVnKx0j34QPN4CZHnZwB5iDoovTvGD4uxGqJXbtCIl8/wZU0OeE31VWAq+o63kKPDI9zCr8oT99klWO27CiY0/HJzjM1/kduK4SVHvodgBCw64YXWevIc+kduDmkS4wcSJG5Koi+78Knt3SxPHrL2osM/RTT1ZEVXEwlWhlXKnnXfkl7UYXNkFaDVu8c+6woC6sVAUZNHJG/I0vmffhUpJSjYAOaFOihQg/Kflho+pS8WjQJrhOrfh/vTiRc+6E0t+8gfpLzt1qg+SUquqzuRCy1jFFKPM5ewjkV6Mos1qONCHMgf42MPw+3aGI4sg/qhnLSLRvWd/gN+PO0Q5XClFhtVQYsX1KYPaQRkvC8hZ35OqL9TTGPuOxaNbm5+jszxnsNKhfW4SsAzjbRVoqbs3FqLww7hprGnGqZctyq4zZYnQdmTQuF1NLN5hQPxilwRHP+eJpv05cuMyI2WW/eHmhnZaX7t4k/S9TrFP2rNzh3vGSUax0yN0drMyvPb4tbajCqihEiuYMI0nu2Hq8FygaG3XzCYjugXSDT+/9sOqIGWMVFo4pNOQ/4eUZoV+vdaHChAFe/PqfhBM/5tulrFkFOVgTfRirxdZDix+VDV48sQjDfiReukAJZ4rltoKcep1SlDeMYme2elMecU3ZVbCtfxloOasVg/CBK5m2CtIKqzTZ251qs4/fZIJ5SdGCRD0FyopOv8GZwW5ngtjLAJ7JHyo0mTP2CcVGpxVo8R0pD8qR5ZfVJLk6e+rBCDzf7dJYP1WsJfK/biYagN6n0RglPiXxTvnIoz3Qg/qMN0OyGmeADMmnmZapHTPujQ678t0CueF7M1rMQ9PNOsnKqT69SZcdjC1jej6Yi/R2nYOGJ+TVkKGAuk8z98VRVcFaNFUkhIsyWCEYvIvgHP5bymoKVm+BFH4/lz1siacNXoTizxBf1x3XIEh3sYItoerqRPxQIW9j4/ItCSLiGkE+xkrjACRQwaGl0KJ8SLPvjTw6IV7/BigHyOXUrvHj1wEhDHoiXATKPv8A6RN6jBAPB2IbOLQ3XC89mu7xUA2LFqVTWubAwp/curl4bEQNyrevX1Ez0czWuAqBH7r99IKvuHJnCdeu0J0PAvtfIbHTvwirs3VlyRo8GyxVrUbpVmIC6ze6IMm3+B9IFj5wbvsVib20ptprKjv3kobwR9uGY940/ZD6XiIrF7qSsb5U3tforxqzSrbTpOdYA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 360b2312-bfe4-404c-9714-08dc6b804c84 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8147.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 14:49:56.4543 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vqB+G7EL5WE9mwn3aFzEgW2cOunGkBvFgXkxkOeKFMHvf4mXVvMo9a93QVQN0NSCdg/zWH1Y7KuNC3pbpTiHRtRD/gQcVfBT4lov6oxKlDU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9570 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a static helper to the PipelineHandlerFactoryBase class to allow retrieving a pipeline by name. Signed-off-by: Julien Vuillaumier Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- include/libcamera/internal/pipeline_handler.h | 1 + src/libcamera/pipeline_handler.cpp | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h index cc70f69c..67d5164f 100644 --- a/include/libcamera/internal/pipeline_handler.h +++ b/include/libcamera/internal/pipeline_handler.h @@ -114,6 +114,7 @@ public: const std::string &name() const { return name_; } static std::vector &factories(); + static const PipelineHandlerFactoryBase *getFactoryByName(const std::string &name); private: static void registerType(PipelineHandlerFactoryBase *factory); diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 0c913e50..de5097e1 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -794,6 +794,28 @@ std::vector &PipelineHandlerFactoryBase::factories return factories; } +/** + * \brief Return the factory for the pipeline handler with name \a name + * \param[in] name The pipeline handler name + * \return The factory of the pipeline with name \a name, or nullptr if not found + */ +const PipelineHandlerFactoryBase *PipelineHandlerFactoryBase::getFactoryByName(const std::string &name) +{ + const std::vector &factories = + PipelineHandlerFactoryBase::factories(); + + auto iter = std::find_if(factories.begin(), + factories.end(), + [&name](const PipelineHandlerFactoryBase *f) { + return f->name() == name; + }); + + if (iter != factories.end()) + return *iter; + + return nullptr; +} + /** * \class PipelineHandlerFactory * \brief Registration of PipelineHandler classes and creation of instances From patchwork Fri May 3 14:49:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Vuillaumier X-Patchwork-Id: 20000 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 7A0D1C32C9 for ; Fri, 3 May 2024 14:50:03 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D40F663424; Fri, 3 May 2024 16:50:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="D9/6MnYJ"; dkim-atps=neutral Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:260f::601]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 092C463418 for ; Fri, 3 May 2024 16:50:01 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g3BWbBipQglNtrMPYcomoKIyj2fk5epYLzwuqV5U/Wns7eXkRzfmHadxPDL7MNQddjtrKnbot9ixSvUoQSAMkx/nFTaDmgvajQEVW9F0P9ev13b6y0MNAIQNT1Sd/sj5I5Y2VB7osIJS3TVGq6f47o2wILnuGasvgcfEzoZasaT1NV4vHYerSqhAbg2Z8gX3ObPiSiuF3Jr6y41ffzVNBaidMPWxkVYh/J5LOn/UTDBjzTYk0sj2Gj1lak3vmxTTjCR0YwKuZQn+FoiwOWU1dP4xuk1E5lhlEFqqy4LwKLiJudPKW0DtEql+SDMohWF/0saEQuIxHaFVmX/VOCuoMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rU9/Qw6PkUXap96LyU45h9YkfzExaDjBmlCXecYLFKg=; b=UMOoKZWNfgeB0S/obtf3pcjjjfGKGYy6RCxwjdXtgbzXjiKSthmEfBPPwLe2VbNS+H7Dbm3GItEqTHupPTwzNvDTSvkMut846WVEU7S5QnUb7gTWw66JSXEJ6c0uB35VP0+TU2K+Qv1p972JhAHzzsKIWBfJIQV6d3PupaWc+0eJoABuMMsG6rhP5wqPZ5D5VLs5YpeCJWAEAXG2TXHDcXOOsIROKZllDAj8qOP91FU/5rcVmZ6VtDA4PEr1ZWQN5/YyAL1NB/3Lc+hgeeDLroa5TFRpSvg1tA70eTzaFD0JHxd1IwqO3yPX4A+Mhz9h6z6sFLTE+mQhAN8l/OSFZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rU9/Qw6PkUXap96LyU45h9YkfzExaDjBmlCXecYLFKg=; b=D9/6MnYJekVjDc15GZzbYHAEjx6TzuwQls0PT3FlpqdjqqOtRs/xcEsV0BhC7Q1GeYxADFA1iNhFarr9A2fXzIxsowzu2TfgJaITDuFA4WJZ/TpUIeS4lGcJ0MD56HK/bqohH2dt/OU+xC/s7p6100MuAlz82mNIACjtzEIZN0c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) by PAXPR04MB9570.eurprd04.prod.outlook.com (2603:10a6:102:24d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.30; Fri, 3 May 2024 14:49:59 +0000 Received: from AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::eace:e980:28a4:ef8a]) by AM9PR04MB8147.eurprd04.prod.outlook.com ([fe80::eace:e980:28a4:ef8a%2]) with mapi id 15.20.7544.029; Fri, 3 May 2024 14:49:59 +0000 From: Julien Vuillaumier To: libcamera-devel@lists.libcamera.org Cc: jacopo.mondi@ideasonboard.com, kieran.bingham@ideasonboard.com, julien.vuillaumier@nxp.com Subject: [PATCH v4 3/3] libcamera: camera_manager: Add environment variable to order pipelines match Date: Fri, 3 May 2024 16:49:19 +0200 Message-Id: <20240503144919.2371357-4-julien.vuillaumier@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240503144919.2371357-1-julien.vuillaumier@nxp.com> References: <20240503144919.2371357-1-julien.vuillaumier@nxp.com> X-ClientProxiedBy: AM0PR03CA0003.eurprd03.prod.outlook.com (2603:10a6:208:14::16) To AM9PR04MB8147.eurprd04.prod.outlook.com (2603:10a6:20b:3e0::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8147:EE_|PAXPR04MB9570:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b3fcb57-6f92-453d-8b17-08dc6b804e12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|1800799015|376005|366007|38350700005; X-Microsoft-Antispam-Message-Info: sl/wq8OnAigtb/nbnH5UvFcVYJu6Z886iluQuFxvEnfz7n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MhnL7nkpR6Cuxe4yRPXss706x/UhJEs/JzAcCis+wqeBlzayIYXR596LjoRDUFws06QQn2TW0ckCnVZbcssWveI+UE60vW8xqDmwT48YM5eUmaAPN+2NrPw61lKecaR9t1DzTxS+1JAko8K/Y80C9YdqPNVXSZsqzHlxF5KHE/pY73oqm6QQ96hUJvgmv7GK7IVXLsMCpbmn/+jcKu1SfszaBE/fxdT8+uzdxuYrNlFtQAsRud2mJWMfvA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8147.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kQ5cXTi92w4lPXRgC6lgkCA4JRA83WvUcFmPGuG/IbfnXPPoPlPeh8lRw9+tySp09UmdbeAcF99z47y1klkungUkBoJQOfaK0s8imIvjKZULa7PNnFQ1qv9O8ZOreHPiHNh/xtakzdGwI+NQwfKUL60GKIRN/YlmaCAK5IyyIY0EEoqrHYEEW2jyoBbW5q8b9rPb0lzXuHBeO/zDT5NkgjjXjVKlc06MnowvSG07ZjD+9tf/bh3KjLNNjpw/a36vo2PmCZFB9H3hUhUm5yM7C2BrO1GsbrRmHxWUSw/YBYIdx2qBlMXiZDTP7y7YgaL8SSD0XNsuBGZSqMV9BDMbrdxqm7jbclGLIlKw/ipySJrYl0eaKnt4QqZ9JD8b5M2ARt0JEaRq/XlIbMF0YZhq9kudPNDrWTvgs9f0mUg6ctbEb4+g16RyyrbzwixhCl5Wu3KzY6MhOkjwiCZWtZoTpJ5n3HGzRU4S40KMBeuS0isFxvQcWcXHuUZuAY8J4561lYgcHsWTrBZPAeysNfS8iiJj1r5pFxcAnB0L0cvPed7kbe0r2kPyuzsJHBe4bLq3xPmJLIhmsMhQOQDX0wlRR3Z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8b17-08dc6b804e12 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8147.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2024 14:49:59.0916 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tHhtvrJiPM6bjC0xm/0zU7PjbIk4znrmV66cmzbbWPbzhh8xN1B8x63AvaTr/1xW8VxdWiXGVDZH/Xn7NPyvM2T03NCQMhdsFH2JD+EY1RM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9570 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" To match the enumerated media devices, each registered pipeline handler is used in no specific order. It is a limitation when several pipelines can match the devices, and user has to select a specific pipeline. For this purpose, environment variable LIBCAMERA_PIPELINES_MATCH_LIST is created to give the option to define an ordered list of pipelines to match on. LIBCAMERA_PIPELINES_MATCH_LIST="[,[,...]]]" Example: LIBCAMERA_PIPELINES_MATCH_LIST="rkisp1,simple" Signed-off-by: Julien Vuillaumier Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- Documentation/environment_variables.rst | 8 ++++ include/libcamera/internal/camera_manager.h | 1 + src/libcamera/camera_manager.cpp | 53 ++++++++++++++++----- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/Documentation/environment_variables.rst b/Documentation/environment_variables.rst index a9b230bc..4e9fbb27 100644 --- a/Documentation/environment_variables.rst +++ b/Documentation/environment_variables.rst @@ -37,6 +37,14 @@ LIBCAMERA_IPA_MODULE_PATH Example value: ``${HOME}/.libcamera/lib:/opt/libcamera/vendor/lib`` +LIBCAMERA_PIPELINES_MATCH_LIST + Define an ordered list of pipeline names to be used to match the media + devices in the system. The pipeline handler names used to populate the + variable are the ones passed to the REGISTER_PIPELINE_HANDLER() macro in the + source code. + + Example value: ``rkisp1,simple`` + LIBCAMERA_RPI_CONFIG_FILE Define a custom configuration file to use in the Raspberry Pi pipeline handler. diff --git a/include/libcamera/internal/camera_manager.h b/include/libcamera/internal/camera_manager.h index 33ebe069..5694d40d 100644 --- a/include/libcamera/internal/camera_manager.h +++ b/include/libcamera/internal/camera_manager.h @@ -44,6 +44,7 @@ protected: private: int init(); void createPipelineHandlers(); + void pipelineFactoryMatch(const PipelineHandlerFactoryBase *factory); void cleanup() LIBCAMERA_TSA_EXCLUDES(mutex_); /* diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp index 355f3ada..ce6607e1 100644 --- a/src/libcamera/camera_manager.cpp +++ b/src/libcamera/camera_manager.cpp @@ -99,16 +99,37 @@ int CameraManager::Private::init() void CameraManager::Private::createPipelineHandlers() { - CameraManager *const o = LIBCAMERA_O_PTR(); - /* * \todo Try to read handlers and order from configuration - * file and only fallback on all handlers if there is no - * configuration file. + * file and only fallback on environment variable or all handlers, if + * there is no configuration file. */ + const char *pipesList = + utils::secure_getenv("LIBCAMERA_PIPELINES_MATCH_LIST"); + if (pipesList) { + /* + * When a list of preferred pipelines is defined, iterate + * through the ordered list to match the enumerated devices. + */ + for (const auto &pipeName : utils::split(pipesList, ",")) { + const PipelineHandlerFactoryBase *factory; + factory = PipelineHandlerFactoryBase::getFactoryByName(pipeName); + if (!factory) + continue; + + LOG(Camera, Debug) + << "Found listed pipeline handler '" + << pipeName << "'"; + pipelineFactoryMatch(factory); + } + + return; + } + const std::vector &factories = PipelineHandlerFactoryBase::factories(); + /* Match all the registered pipeline handlers. */ for (const PipelineHandlerFactoryBase *factory : factories) { LOG(Camera, Debug) << "Found registered pipeline handler '" @@ -117,15 +138,23 @@ void CameraManager::Private::createPipelineHandlers() * Try each pipeline handler until it exhaust * all pipelines it can provide. */ - while (1) { - std::shared_ptr pipe = factory->create(o); - if (!pipe->match(enumerator_.get())) - break; + pipelineFactoryMatch(factory); + } +} - LOG(Camera, Debug) - << "Pipeline handler \"" << factory->name() - << "\" matched"; - } +void CameraManager::Private::pipelineFactoryMatch(const PipelineHandlerFactoryBase *factory) +{ + CameraManager *const o = LIBCAMERA_O_PTR(); + + /* Provide as many matching pipelines as possible. */ + while (1) { + std::shared_ptr pipe = factory->create(o); + if (!pipe->match(enumerator_.get())) + break; + + LOG(Camera, Debug) + << "Pipeline handler \"" << factory->name() + << "\" matched"; } }