From patchwork Tue Oct 14 10:55:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 24629 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 48B56BE080 for ; Tue, 14 Oct 2025 10:55:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 59035605DF; Tue, 14 Oct 2025 12:55:52 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uMXkFc6e"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B8D0060443 for ; Tue, 14 Oct 2025 12:55:50 +0200 (CEST) Received: from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it [93.46.82.201]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 05612741; Tue, 14 Oct 2025 12:54:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1760439252; bh=Wo+AtGw+ImxV9/zVn9C8NiN4t07hDCNOfuEANt6VCDw=; h=From:Subject:Date:To:Cc:From; b=uMXkFc6e5qA9qKmUcxqdiL9kXa7JMe8yqe7LAtoCeACbovQkwpH29A3vYBQgGvSXh au9wVkMGQ6QaSZkdsFp6X+Z0y5d/UkZ5grIF2QD/y3Gs1DCT1lffNotSXhYMYXuc6l M4qk8KxZZ63GyOv4A+i2eLmlZVe7+JjfvrfvPFEc= From: Jacopo Mondi Subject: [PATCH v6 0/5] ipa: libipa: Introduce V4L2Params Date: Tue, 14 Oct 2025 12:55:35 +0200 Message-Id: <20251014-v4l2-params-v6-0-caf5fa69eb29@ideasonboard.com> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIACcs7mgC/3XMQW7DIBCF4atErEvFDIOBrHqPqgtsxg1SYyKor FaR716cRRtX8fJ/0vuuonJJXMXxcBWF51RTnlp0TwcxnML0zjLF1gIVGuXQy5k+UF5CCecqI2E Ixnu2Loj2uBQe09dNe31rfUr1M5fvGz7Duj52ZpBKalLW6rHv/Di+pMih5qnPocTnIZ/Fys34R 3jotgQ2wnZEFjh2pM0Ooe8I/EfoRjADkHU4QM87BP0SoBRsCWqEG7Enaz0qs0eYe8JuCbMSsSc DwYH27gGxLMsPGt2YMrkBAAA= X-Change-ID: 20250829-v4l2-params-d42aa599e78a To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , Laurent Pinchart , Kieran Bingham , Antoine Bouyer , Laurent Pinchart , Daniel Scally X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4491; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=Wo+AtGw+ImxV9/zVn9C8NiN4t07hDCNOfuEANt6VCDw=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBo7iw0jKsNu/Ra4kklwD0/T6Z4lD0c7lhpqW9n7 8j1QV0y6SiJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaO4sNAAKCRByNAaPFqFW PI2+EACbFFrHM2lBuseZa1EqvhImja9GBwSP6XhR58tTrS3pYNgbh8SpmIiYA4ebTLuI1EY8YaC C6ERzodp11jzQTjRx2qEJzadrXjNZB+s3qREp3+Qm7E0TaSeQlVlBkjLM1aetN0tbmKbymaDknd BPOTiFxZiZHBIbNhWRUAvm8rGhFtgqAH6ARpWM06nM0cp21zsrN8pBX8wNdP93iUV7RC3X0c7Ld L8w27vMVyJoSfGCdDvly5w5TjsliOAoWgJawSsmJ/vxuVfcJTjG/r+rGw1VXujOiXMBO3mdkRa9 FaMvryjZ1dDoWXFzQdXD0T1ea4h96GiCHaKPx3FRCW6z5gYoXlvrWPr8Yl1mP7k5T74aQJ5ttJf 5qu17h9mYAIau6x5fgSQ06iYrjGc5WZEoxTap72BpUn18MCot09bScPCXlegBIjp0k9+zZxGYRa hxevRUzTIGK3Tapm6oklJbi/W3StYybLfY44QRfwGNtKqTwBkTwpgPQyhQMyX6YcYJG+5DLEjLD Pezoovf2GdyELrSWnpMq90IqAgUgjQgS+djBQ2Eg/ExKWW64J44hXE6yGgw6Q39XiFX+HyQFUGp oeGEp/6uEr5jCPjpLF0TpTO1AojaOcCz9LqAQqJBJE9P0VQrdL3H7znSoWkeLXiEFBC4QjMU21/ fScHr7zBr5ZFmTA== 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" With the introduction of v4l2-isp.h in the Linux kernel currently in progress: https://lore.kernel.org/all/20251007-extensible-parameters-validation-v6-0-5f719d9f39e5@ideasonboard.com/ the MaliC55 ISP driver at version in v11 has been ported to use a parameters format compatible with the one defined by v4l2 extensible parameters: https://lore.kernel.org/all/20250714-c55-v11-0-bc20e460e42a@ideasonboard.com/ This series 1) Imports v4l2-isp in libcamera 2) Update the Mali C55 header and IPA to compile with v11 of the patch series that introduces MaliC55 support in Linux 3) Introduces V4L2Params by generalizing RkISP1Params 4) Ports the Mali C55 IPA to use the newly introduced V4L2Params Tested on rkisp1 and rzv2h Signed-off-by: Jacopo Mondi --- Changes in v6: - Apply Dan's comments on documentation - Assert with Fatal if we run out of space - Link to v5: https://lore.kernel.org/r/20251007-v4l2-params-v5-0-8db451a81398@ideasonboard.com Changes in v5: - Update to v6 of v4l2 isp - Import linux/stddef.h instead of re-defining __counted_by() - Properly memset the whole mali-c55 buffer in the transitory patch before MaliC55Params introduction Changes in v4: - Mark RkISP1ParamBlock final - Fix code examples as suggested by Barnabas Changes in v3: - Fix Mali-C55 and re-work RkISP1 The Mali and RkISP1 IPA have a different requirements: struct mali_c55_params_awb_gains { struct v4l2_params_block_header header; __u16 gain00; __u16 gain01; __u16 gain10; __u16 gain11; }; struct rkisp1_ext_params_awb_gain_config { struct rkisp1_ext_params_block_header header; struct rkisp1_cif_isp_awb_gain_config config; } __attribute__((aligned(8))); The RkISP1 IPA needs to support legacy and extensible parameter formats, and wants to operate on 'struct rkisp1_cif_isp_' basically discarding the header. The Mali IPA (and all other IPA compatible with v4l2-isp) operates on the whole structure and do not need to discard the header. Rework V4L2ParamsBlock to return a Span<> matching the whole structure (header included) to support Mali correctly. This means the RkISP1ParamsBlock derived class has to override all the dereference operators to discard the header and allow the IPA to work with both the legacy and extensible formats. Tested with Mali C55, RkISP1 in extensible and legacy modes. - Link to v2: https://lore.kernel.org/r/20250916-v4l2-params-v2-0-764471ed6435@ideasonboard.com Changes in v2: - Address Barnabas' reviwe that allows to remove the block() overload in MaliC55 - Link to v1: https://lore.kernel.org/r/20250829-v4l2-params-v1-0-340773fb69ff@ideasonboard.com --- Jacopo Mondi (5): include: linux: Add stddef.h include: linux: Add v4l2-isp.h ipa: Update Mali C55 header file and adjust IPA ipa: libipa: Introduce V4L2Params ipa: mali-c55: Introduce MaliC55Params include/linux/mali-c55-config.h | 161 +++----------------- include/linux/media/v4l2-isp.h | 102 +++++++++++++ include/linux/stddef.h | 75 ++++++++++ src/ipa/libipa/meson.build | 2 + src/ipa/libipa/v4l2_params.cpp | 254 ++++++++++++++++++++++++++++++++ src/ipa/libipa/v4l2_params.h | 152 +++++++++++++++++++ src/ipa/mali-c55/algorithms/agc.cpp | 87 +++++------ src/ipa/mali-c55/algorithms/agc.h | 14 +- src/ipa/mali-c55/algorithms/algorithm.h | 2 +- src/ipa/mali-c55/algorithms/awb.cpp | 64 ++++---- src/ipa/mali-c55/algorithms/awb.h | 10 +- src/ipa/mali-c55/algorithms/blc.cpp | 20 +-- src/ipa/mali-c55/algorithms/blc.h | 3 +- src/ipa/mali-c55/algorithms/lsc.cpp | 58 +++----- src/ipa/mali-c55/algorithms/lsc.h | 8 +- src/ipa/mali-c55/mali-c55.cpp | 19 +-- src/ipa/mali-c55/module.h | 3 +- src/ipa/mali-c55/params.h | 77 ++++++++++ src/ipa/rkisp1/params.cpp | 93 +----------- src/ipa/rkisp1/params.h | 175 ++++++++++++---------- src/ipa/rkisp1/rkisp1.cpp | 2 +- utils/update-kernel-headers.sh | 2 + 22 files changed, 906 insertions(+), 477 deletions(-) --- base-commit: 05bfebed2657cc1d032c9796efd9041bfbdc881c change-id: 20250829-v4l2-params-d42aa599e78a Best regards,