From patchwork Wed Oct 15 15:55:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 24690 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 49E2EC3332 for ; Wed, 15 Oct 2025 15:55:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B8FB860624; Wed, 15 Oct 2025 17:55:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Fg+6wEUE"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B047560628 for ; Wed, 15 Oct 2025 17:55:36 +0200 (CEST) Received: from [192.168.1.106] (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E51416C5; Wed, 15 Oct 2025 17:53:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760543637; bh=2Bxs7dUYHz3fobXnR2cEBW56/G43T4o+OpEhmNGQUms=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Fg+6wEUELYRHkCkafcWMvevUAsF1BZCC8CIZxhA3OGggcfo0s2Ixj14EPMmrTy+JE 4l3jESlE7bAT/lBZIxERECNYImfAVE8vgttLtG+Q/xBbvBMpGakIKxvJgbNNS4IKs9 CuTN7RA8n4adiPRfSNpQKlh7RknkzZluoX5OP0Yc= From: Jacopo Mondi Date: Wed, 15 Oct 2025 17:55:27 +0200 Subject: [PATCH v3 4/4] ipa: Allow pipelines to have differently named IPA MIME-Version: 1.0 Message-Id: <20251015-ipa-match-by-name-v3-4-11f9c774c7fc@ideasonboard.com> References: <20251015-ipa-match-by-name-v3-0-11f9c774c7fc@ideasonboard.com> In-Reply-To: <20251015-ipa-match-by-name-v3-0-11f9c774c7fc@ideasonboard.com> To: libcamera-devel@lists.libcamera.org, =?utf-8?q?Niklas_S=C3=B6derlund?= , Hans de Goede , Milan Zamazal Cc: Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3917; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=2Bxs7dUYHz3fobXnR2cEBW56/G43T4o+OpEhmNGQUms=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo78P1y0mlprifc10GMZnmt/xzRpogWWPA/LZv0 d8fCCACQp+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO/D9QAKCRByNAaPFqFW PEcbEACMNQQRBrgGO6ALnciGs3wd8NwykPgrrEaeHG4+LWCP29mlEyZTXC27b5EFfRkRNT5jKM5 Glq95wpWWUAgz9d62RMkvJhzocxkfKCFfXiDXiwU+wWUq6sCUqHf86YPcLStw0fT1agC3/aO/3L fjGgoZOKnr+GYbtOIJxgncE68JDBLU86nFSGxO3RHFQ3cRJlChnKn4+5gvYKf8izUmX08+pXCVc UqpWzTDDnO+wJTl7lYmaaB+sGLb6flmsMLjl9zqrl65HjzgG6c+X4gFJ5B4KxSEnanqwvGKRbg0 m0NtmQJrRnLcNLp7yv4A8GKV+6wahVtHMLlv8UXk2qfV7lfQincpBUdJ3EG4fYXTFK6rZR47uUr b/Ba4vaoaKh7foo7rM4W4VrqNomd9of+Z7P3vzbhqTfH+BDj3hYRqoMAWHUt78D4rAkAyOP99OE TQAHvNB1Db5BUtWWhc5+KvaVIUqAdmHfn7Cl4+/P+WpHHPL2SD+T/GMdWDNlJkO+qmUQR/bEKEJ O2ewNnNtr/wLOtlx26AoSx3w+SdELxQoksgOzM/J1lCJhzrWX7ayXSvY/YkHe19+77DZhlD6NO7 56q8V9ycPN0B/BlcUv4mQW7YkJchMdE2SZLpteXIYTLdxVj4xsZp3mHNyGZQiG7Rug/jKWLJBAw 1us0G889nVSuIyA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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" Right now the build system assumes a 1-to-1 matching between a pipeline handler name and an IPA module. This, as also acknowledged by a \todo comment, is quite a rigid requirement and only allows a 1-to-1 matching between pipeline and IPA names. The more platforms libcamera supports, the more it is likely that a pipeline handler could re-use an IPA module. This is particularly relevant for the softISP IPA module which could theoretically be plugged to any pipeline. Likewise, the forthcoming R-Car Gen4 support uses the RkISP1 IPA and at the moment would require building the 'rkisp1' pipeline in to have the IPA module available. When building IPAs, the build system iterates the list of enabled pipeline handlers and for each of them tries to verify if the 'ipas' list contains a corresponding entry for it. The 'ipas' meson options is an array option and, as no default value is specified for it, it contains by default all its possible choices. In this way if no value is specified for the 'ipas' option, compiling the pipeline handlers ['X','Y', 'Z'] will compile the ['X', 'Y', 'Z'] IPAs. If instead the user specifies '-Dipas=X' during the configuration then only IPA module ['X'] will be built, regardless of which pipeline is enabled. Building an IPA module will anyway require to build a corresponding pipeline with the same name. Relax the 1-to-1 'pipeline'-'IPA' naming requirement by introducing a dictionary that associates pipelines with IPA modules. For each enabled pipeline: 1) Make sure an IPA module exists for it 2) Make sure the IPA module is enabled by the 'ipas' option 3) Make sure the IPA is compiled once only This will require every new pipeline to add an entry to the dictionary and specify which IPA module they would like to use. Signed-off-by: Jacopo Mondi --- src/ipa/meson.build | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/ipa/meson.build b/src/ipa/meson.build index eb7846e47888d4056b81e4a68f1903f134e6a662..c583c7efdd35170ab31d92fd8347ecdceaba5a31 100644 --- a/src/ipa/meson.build +++ b/src/ipa/meson.build @@ -24,6 +24,16 @@ subdir('libipa') ipa_sign = files('ipa-sign.sh') +supported_ipas = { + 'ipu3': 'ipu3', + 'mali-c55': 'mali-c55', + 'rkisp1': 'rkisp1', + 'rpi/pisp': 'rpi/pisp', + 'rpi/vc4': 'rpi/vc4', + 'simple': 'simple', + 'vimc': 'vimc' +} + ipa_modules = get_option('ipas') # Tests require the vimc IPA, similar to vimc pipline-handler for their @@ -39,24 +49,34 @@ ipa_names = [] subdirs = [] foreach pipeline : pipelines - # The current implementation expects the IPA module name to match the - # pipeline name. - # \todo Make the IPA naming scheme more flexible. - if not ipa_modules.contains(pipeline) + # Make sure an IPA exists for the pipeline + if not supported_ipas.has_key(pipeline) + continue + endif + + ipa = supported_ipas.get(pipeline) + + # Only build IPAs specified with '-Dipas' + if not ipa_modules.contains(ipa) + continue + endif + + # If enabled already do not add it twice + if enabled_ipa_names.contains(ipa) continue endif - enabled_ipa_names += pipeline + enabled_ipa_names += ipa # Allow multi-level directory structuring for the IPAs if needed. - pipeline = pipeline.split('/')[0] - if pipeline in subdirs + ipa = ipa.split('/')[0] + if ipa in subdirs continue endif - subdirs += pipeline - subdir(pipeline) + subdirs += ipa + subdir(ipa) - # Don't reuse the pipeline variable below, the subdirectory may have + # Don't reuse the ipa variable below, the subdirectory may have # overwritten it. endforeach