From patchwork Tue Sep 16 12:28:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 24369 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 932FBBE173 for ; Tue, 16 Sep 2025 12:28:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2C65D69379; Tue, 16 Sep 2025 14:28:45 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="SW/TyLcK"; 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 A053069377 for ; Tue, 16 Sep 2025 14:28:41 +0200 (CEST) Received: from [192.168.0.172] (mob-5-90-51-255.net.vodafone.it [5.90.51.255]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E9693C6F; Tue, 16 Sep 2025 14:27:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1758025643; bh=WLEQrRuf/BYMX0Z0xEaq9D9hy113lxygdvP4qq/1PE0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=SW/TyLcKJanT5b/a17sczKVKN/VCqndM2cQDWdKTfDYgKM/NjJyuzWq/WkMzeEJAh 3p6wg0i5+4syq688zibi+J7xde2HMIAnVhmT0pam5BGAgb87PpTwBXo2WSWOcIin2O bjcaogx9k3/FQe+j625O5aMtHDt1RGTNcT6CErGQ= From: Jacopo Mondi Date: Tue, 16 Sep 2025 14:28:23 +0200 Subject: [PATCH v2 2/4] ipa: Update Mali C55 header file and adjust IPA MIME-Version: 1.0 Message-Id: <20250916-v4l2-params-v2-2-764471ed6435@ideasonboard.com> References: <20250916-v4l2-params-v2-0-764471ed6435@ideasonboard.com> In-Reply-To: <20250916-v4l2-params-v2-0-764471ed6435@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi , Antoine Bouyer X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=26183; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=WLEQrRuf/BYMX0Z0xEaq9D9hy113lxygdvP4qq/1PE0=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBoyVfxdPo2JD3a4kR3tNLs2uS+BcttXykKF/uaa bfKXq12Au+JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaMlX8QAKCRByNAaPFqFW PC/8D/98OCRnlAsTz7RAcPoVfCnuwFn/i5W8BN6nSu7ZzC6Q5YjBQ+VLQPEVDmzauy5b8El7pVQ W+scF8xi60MPXtyt5fIWKUzbVkcGlisCP2Uhl8LOEqBtxYcbMoYQA82Eyyga5m0dzKbpJv+Orxo SZG90YNl0u0RvS5/beF6qHjR5AR3JeevtUEdRJB9IycUo64Wq7zXpAUxnfEcA+AChn+SBVOz+IQ a94bVbNMnpx2cfEFxHRIxSB0EwQEd/BrJF74zULnw2Y2nM0id3J5v6d6NaG1g3yV4GASKDKkSKv r8PE8bet00sJHXe4U8iHMWJ8Of+lJaxd9Kk29+d0E4oVpq0n6bwiX5ZweWbjHME8Ctc5Zqf9TLK 3uRkHk4iRovUQ3J+y73y2meXTprb6GqTBVQH33eKaQrXAvSzBatu6ucZpF1G8xUp1+xnjDFB0oq UIWBpd+bbmLt/F3ONhKnqmdk5pI3LUZEcIkxN19xleYc3u4YG1PEjtcq7nxpDEsasZn0l+HFCWd HoENdscgW9TpnNyOFwKVMhLXZboKm7ZZJhx0E6biaXvevC2L0LJY+S16pDL+IXJTaSY2m8t5mBp Naz3gyZZdYTr6De6QGDhGAnOtG9FO9TIC3BVF7IpXbfUCfmlAh9C2y+XaP0VAZYmQm3TtVTiQ2C 166uAqXdy44d53Q== 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" Update Mali C55 header file with the v11 version of the patch series, based on v4l2 extensible parameters, sent to the linux-media mailing list at: https://lore.kernel.org/all/20250714-c55-v11-0-bc20e460e42a@ideasonboard.com/ Adjust the IPA module to use the new v4l2-isp.h header file. Signed-off-by: Jacopo Mondi Tested-By: Antoine Bouyer --- include/linux/mali-c55-config.h | 162 +++++--------------------------- src/ipa/mali-c55/algorithms/agc.cpp | 28 +++--- src/ipa/mali-c55/algorithms/agc.h | 2 +- src/ipa/mali-c55/algorithms/algorithm.h | 2 +- src/ipa/mali-c55/algorithms/awb.cpp | 14 +-- src/ipa/mali-c55/algorithms/awb.h | 2 +- src/ipa/mali-c55/algorithms/blc.cpp | 8 +- src/ipa/mali-c55/algorithms/blc.h | 2 +- src/ipa/mali-c55/algorithms/lsc.cpp | 14 +-- src/ipa/mali-c55/algorithms/lsc.h | 2 +- src/ipa/mali-c55/mali-c55.cpp | 10 +- src/ipa/mali-c55/module.h | 2 +- 12 files changed, 67 insertions(+), 181 deletions(-) diff --git a/include/linux/mali-c55-config.h b/include/linux/mali-c55-config.h index b31415597e886496b65f8fb396c095618467f1ac..3e22a9e50dce85b69fc96f8e6cd03d199430eb8b 100644 --- a/include/linux/mali-c55-config.h +++ b/include/linux/mali-c55-config.h @@ -9,6 +9,22 @@ #define __UAPI_MALI_C55_CONFIG_H #include +#include + +#include + +#define V4L2_CID_MALI_C55_CAPABILITIES (V4L2_CID_USER_MALI_C55_BASE + 0x0) +#define MALI_C55_GPS_PONG (1U << 0) +#define MALI_C55_GPS_WDR (1U << 1) +#define MALI_C55_GPS_COMPRESSION (1U << 2) +#define MALI_C55_GPS_TEMPER (1U << 3) +#define MALI_C55_GPS_SINTER_LITE (1U << 4) +#define MALI_C55_GPS_SINTER (1U << 5) +#define MALI_C55_GPS_IRIDIX_LTM (1U << 6) +#define MALI_C55_GPS_IRIDIX_GTM (1U << 7) +#define MALI_C55_GPS_CNR (1U << 8) +#define MALI_C55_GPS_FRSCALER (1U << 9) +#define MALI_C55_GPS_DS_PIPE (1U << 10) /* * Frames are split into zones of almost equal width and height - a zone is a @@ -228,65 +244,6 @@ enum mali_c55_param_block_type { MALI_C55_PARAM_MESH_SHADING_SELECTION, }; -#define MALI_C55_PARAM_BLOCK_FL_NONE 0 -#define MALI_C55_PARAM_BLOCK_FL_DISABLED BIT(0) - -/** - * struct mali_c55_params_block_header - Mali-C55 parameter block header - * - * This structure represents the common part of all the ISP configuration - * blocks. Each parameters block embeds an instance of this structure type - * as its first member, followed by the block-specific configuration data. The - * driver inspects this common header to discern the block type and its size and - * properly handle the block content by casting it to the correct block-specific - * type. - * - * The @type field is one of the values enumerated by - * :c:type:`mali_c55_param_block_type` and specifies how the data should be - * interpreted by the driver. The @size field specifies the size of the - * parameters block and is used by the driver for validation purposes. The - * @flags field holds a bitmask of per-block flags MALI_C55_PARAM_BLOCK_FL_*. - * - * If userspace wants to disable an ISP block the - * MALI_C55_PARAM_BLOCK_FL_DISABLED bit should be set in the @flags field. In - * that case userspace may optionally omit the remainder of the configuration - * block, which will in any case be ignored by the driver. If a new - * configuration of an ISP block has to be applied userspace shall fully - * populate the ISP block and omit setting the MALI_C55_PARAM_BLOCK_FL_DISABLED - * bit in the @flags field. - * - * Userspace is responsible for correctly populating the parameters block header - * fields (@type, @flags and @size) and correctly populate the block-specific - * parameters. - * - * For example: - * - * .. code-block:: c - * - * void populate_sensor_offs(struct mali_c55_params_block_header *block) { - * block->type = MALI_C55_PARAM_BLOCK_SENSOR_OFFS; - * block->enabled = MALI_C55_PARAM_BLOCK_FL_NONE; - * block->size = sizeof(struct mali_c55_params_sensor_off_preshading); - * - * struct mali_c55_params_sensor_off_preshading *sensor_offs = - * (struct mali_c55_params_sensor_off_preshading *)block; - * - * sensor_offs->chan00 = offset00; - * sensor_offs->chan01 = offset01; - * sensor_offs->chan10 = offset10; - * sensor_offs->chan11 = offset11; - * } - * - * @type: The parameters block type from :c:type:`mali_c55_param_block_type` - * @flags: Bitmask of block flags - * @size: Size (in bytes) of the parameters block - */ -struct mali_c55_params_block_header { - __u16 type; - __u16 flags; - __u32 size; -} __attribute__((aligned(8))); - /** * struct mali_c55_params_sensor_off_preshading - offset subtraction for each * color channel @@ -305,7 +262,7 @@ struct mali_c55_params_block_header { * @chan11: Offset for color channel 11 (default: B) */ struct mali_c55_params_sensor_off_preshading { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u32 chan00; __u32 chan01; __u32 chan10; @@ -470,7 +427,7 @@ enum mali_c55_aexp_hist_plane_mode { * This parameter is unused for the post-Iridix Histogram */ struct mali_c55_params_aexp_hist { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u8 skip_x; __u8 offset_x; __u8 skip_y; @@ -502,7 +459,7 @@ struct mali_c55_params_aexp_hist { * @nodes_used_horiz */ struct mali_c55_params_aexp_weights { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u8 nodes_used_horiz; __u8 nodes_used_vert; __u8 zone_weights[MALI_C55_MAX_ZONES]; @@ -520,7 +477,7 @@ struct mali_c55_params_aexp_weights { * @gain: The digital gain value to apply, in Q5.8 format. */ struct mali_c55_params_digital_gain { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u16 gain; }; @@ -560,7 +517,7 @@ enum mali_c55_awb_stats_mode { * @gain11: Multiplier for colour channel 11 */ struct mali_c55_params_awb_gains { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u16 gain00; __u16 gain01; __u16 gain10; @@ -635,7 +592,7 @@ enum mali_c55_params_awb_tap_points { * @cb_low: B/G ratio trim low (Q4.8 format) */ struct mali_c55_params_awb_config { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u8 tap_point; __u8 stats_mode; __u16 white_level; @@ -745,7 +702,7 @@ struct mali_c55_params_awb_config { * @mesh: Mesh shading correction tables */ struct mali_c55_params_mesh_shading_config { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u8 mesh_show; __u8 mesh_scale; __u8 mesh_page_r; @@ -800,7 +757,7 @@ enum mali_c55_params_mesh_alpha_bank { * @mesh_strength: Mesh strength in Q4.12 format [0..4096] */ struct mali_c55_params_mesh_shading_selection { - struct mali_c55_params_block_header header; + struct v4l2_params_block_header header; __u8 mesh_alpha_bank_r; __u8 mesh_alpha_bank_g; __u8 mesh_alpha_bank_b; @@ -835,75 +792,4 @@ struct mali_c55_params_mesh_shading_selection { sizeof(struct mali_c55_params_mesh_shading_config) + \ sizeof(struct mali_c55_params_mesh_shading_selection)) -/** - * struct mali_c55_params_buffer - 3A configuration parameters - * - * This struct contains the configuration parameters of the Mali-C55 ISP - * algorithms, serialized by userspace into a data buffer. Each configuration - * parameter block is represented by a block-specific structure which contains a - * :c:type:`mali_c55_params_block_header` entry as first member. Userspace - * populates the @data buffer with configuration parameters for the blocks that - * it intends to configure. As a consequence, the data buffer effective size - * changes according to the number of ISP blocks that userspace intends to - * configure. - * - * The parameters buffer is versioned by the @version field to allow modifying - * and extending its definition. Userspace shall populate the @version field to - * inform the driver about the version it intends to use. The driver will parse - * and handle the @data buffer according to the data layout specific to the - * indicated version and return an error if the desired version is not - * supported. - * - * For each ISP block that userspace wants to configure, a block-specific - * structure is appended to the @data buffer, one after the other without gaps - * in between nor overlaps. Userspace shall populate the @total_size field with - * the effective size, in bytes, of the @data buffer. - * - * The expected memory layout of the parameters buffer is:: - * - * +-------------------- struct mali_c55_params_buffer ------------------+ - * | version = MALI_C55_PARAM_BUFFER_V1; | - * | total_size = sizeof(struct mali_c55_params_sensor_off_preshading) | - * | sizeof(struct mali_c55_params_aexp_hist); | - * | +------------------------- data ---------------------------------+ | - * | | +--------- struct mali_c55_params_sensor_off_preshading ------+ | | - * | | | +-------- struct mali_c55_params_block_header header -----+ | | | - * | | | | type = MALI_C55_PARAM_BLOCK_SENSOR_OFFS; | | | | - * | | | | flags = MALI_C55_PARAM_BLOCK_FL_NONE; | | | | - * | | | | size = | | | | - * | | | | sizeof(struct mali_c55_params_sensor_off_preshading);| | | | - * | | | +---------------------------------------------------------+ | | | - * | | | chan00 = ...; | | | - * | | | chan01 = ...; | | | - * | | | chan10 = ...; | | | - * | | | chan11 = ...; | | | - * | | +------------ struct mali_c55_params_aexp_hist ---------------+ | | - * | | | +-------- struct mali_c55_params_block_header header -----+ | | | - * | | | | type = MALI_C55_PARAM_BLOCK_AEXP_HIST; | | | | - * | | | | flags = MALI_C55_PARAM_BLOCK_FL_NONE; | | | | - * | | | | size = sizeof(struct mali_c55_params_aexp_hist); | | | | - * | | | +---------------------------------------------------------+ | | | - * | | | skip_x = ...; | | | - * | | | offset_x = ...; | | | - * | | | skip_y = ...; | | | - * | | | offset_y = ...; | | | - * | | | scale_bottom = ...; | | | - * | | | scale_top = ...; | | | - * | | | plane_mode = ...; | | | - * | | | tap_point = ...; | | | - * | | +-------------------------------------------------------------+ | | - * | +-----------------------------------------------------------------+ | - * +---------------------------------------------------------------------+ - * - * @version: The version from :c:type:`mali_c55_param_buffer_version` - * @total_size: The Mali-C55 configuration data effective size, excluding this - * header - * @data: The Mali-C55 configuration blocks data - */ -struct mali_c55_params_buffer { - __u8 version; - __u32 total_size; - __u8 data[MALI_C55_PARAMS_MAX_SIZE]; -}; - #endif /* __UAPI_MALI_C55_CONFIG_H */ diff --git a/src/ipa/mali-c55/algorithms/agc.cpp b/src/ipa/mali-c55/algorithms/agc.cpp index 15963994b2d626485b33bac10e3eb38803f239dc..80d9d956d07d1665e61876b0429fb94a30c7cbe1 100644 --- a/src/ipa/mali-c55/algorithms/agc.cpp +++ b/src/ipa/mali-c55/algorithms/agc.cpp @@ -252,7 +252,7 @@ size_t Agc::fillGainParamBlock(IPAContext &context, IPAFrameContext &frameContex gain = activeState.agc.manual.ispGain; block.header->type = MALI_C55_PARAM_BLOCK_DIGITAL_GAIN; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(struct mali_c55_params_digital_gain); block.digital_gain->gain = floatingToFixedPoint<5, 8, uint16_t, double>(gain); @@ -265,7 +265,7 @@ size_t Agc::fillParamsBuffer(mali_c55_params_block block, enum mali_c55_param_block_type type) { block.header->type = type; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(struct mali_c55_params_aexp_hist); /* Collect every 3rd pixel horizontally */ @@ -291,7 +291,7 @@ size_t Agc::fillWeightsArrayBuffer(mali_c55_params_block block, enum mali_c55_param_block_type type) { block.header->type = type; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(struct mali_c55_params_aexp_weights); /* We use every zone - a 15x15 grid */ @@ -313,30 +313,30 @@ size_t Agc::fillWeightsArrayBuffer(mali_c55_params_block block, } void Agc::prepare(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameContext, mali_c55_params_buffer *params) + IPAFrameContext &frameContext, v4l2_params_buffer *params) { mali_c55_params_block block; - block.data = ¶ms->data[params->total_size]; - params->total_size += fillGainParamBlock(context, frameContext, block); + block.data = ¶ms->data[params->data_size]; + params->data_size += fillGainParamBlock(context, frameContext, block); if (frame > 0) return; - block.data = ¶ms->data[params->total_size]; - params->total_size += fillParamsBuffer(block, + block.data = ¶ms->data[params->data_size]; + params->data_size += fillParamsBuffer(block, MALI_C55_PARAM_BLOCK_AEXP_HIST); - block.data = ¶ms->data[params->total_size]; - params->total_size += fillWeightsArrayBuffer(block, + block.data = ¶ms->data[params->data_size]; + params->data_size += fillWeightsArrayBuffer(block, MALI_C55_PARAM_BLOCK_AEXP_HIST_WEIGHTS); - block.data = ¶ms->data[params->total_size]; - params->total_size += fillParamsBuffer(block, + block.data = ¶ms->data[params->data_size]; + params->data_size += fillParamsBuffer(block, MALI_C55_PARAM_BLOCK_AEXP_IHIST); - block.data = ¶ms->data[params->total_size]; - params->total_size += fillWeightsArrayBuffer(block, + block.data = ¶ms->data[params->data_size]; + params->data_size += fillWeightsArrayBuffer(block, MALI_C55_PARAM_BLOCK_AEXP_IHIST_WEIGHTS); } diff --git a/src/ipa/mali-c55/algorithms/agc.h b/src/ipa/mali-c55/algorithms/agc.h index 0b4bf7eda1c2a7c9894f6932452fea5f53699b30..64caf99350c1d1835832311a94a88a2bfde5721c 100644 --- a/src/ipa/mali-c55/algorithms/agc.h +++ b/src/ipa/mali-c55/algorithms/agc.h @@ -57,7 +57,7 @@ public: const ControlList &controls) override; void prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, - mali_c55_params_buffer *params) override; + v4l2_params_buffer *params) override; void process(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, const mali_c55_stats_buffer *stats, diff --git a/src/ipa/mali-c55/algorithms/algorithm.h b/src/ipa/mali-c55/algorithms/algorithm.h index ec8dd3973eaf2d804d8de8620840f716340e9cfd..c28789f6a619cf7fc05ffb705098ed8d1fac93b8 100644 --- a/src/ipa/mali-c55/algorithms/algorithm.h +++ b/src/ipa/mali-c55/algorithms/algorithm.h @@ -22,7 +22,7 @@ class Algorithm : public libcamera::ipa::Algorithm }; union mali_c55_params_block { - struct mali_c55_params_block_header *header; + struct v4l2_params_block_header *header; struct mali_c55_params_sensor_off_preshading *sensor_offs; struct mali_c55_params_aexp_hist *aexp_hist; struct mali_c55_params_aexp_weights *aexp_weights; diff --git a/src/ipa/mali-c55/algorithms/awb.cpp b/src/ipa/mali-c55/algorithms/awb.cpp index 3d546e5a854b8aa02987c44f57109a6171e3794b..6b2cbed9de1ebfe9a2466ebe999eceac44fe5deb 100644 --- a/src/ipa/mali-c55/algorithms/awb.cpp +++ b/src/ipa/mali-c55/algorithms/awb.cpp @@ -47,7 +47,7 @@ size_t Awb::fillGainsParamBlock(mali_c55_params_block block, IPAContext &context IPAFrameContext &frameContext) { block.header->type = MALI_C55_PARAM_BLOCK_AWB_GAINS; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(struct mali_c55_params_awb_gains); double rGain = context.activeState.awb.rGain; @@ -77,7 +77,7 @@ size_t Awb::fillGainsParamBlock(mali_c55_params_block block, IPAContext &context size_t Awb::fillConfigParamBlock(mali_c55_params_block block) { block.header->type = MALI_C55_PARAM_BLOCK_AWB_CONFIG; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(struct mali_c55_params_awb_config); /* Tap the stats after the purple fringe block */ @@ -126,18 +126,18 @@ size_t Awb::fillConfigParamBlock(mali_c55_params_block block) } void Awb::prepare(IPAContext &context, const uint32_t frame, - IPAFrameContext &frameContext, mali_c55_params_buffer *params) + IPAFrameContext &frameContext, v4l2_params_buffer *params) { mali_c55_params_block block; - block.data = ¶ms->data[params->total_size]; + block.data = ¶ms->data[params->data_size]; - params->total_size += fillGainsParamBlock(block, context, frameContext); + params->data_size += fillGainsParamBlock(block, context, frameContext); if (frame > 0) return; - block.data = ¶ms->data[params->total_size]; - params->total_size += fillConfigParamBlock(block); + block.data = ¶ms->data[params->data_size]; + params->data_size += fillConfigParamBlock(block); } void Awb::process(IPAContext &context, const uint32_t frame, diff --git a/src/ipa/mali-c55/algorithms/awb.h b/src/ipa/mali-c55/algorithms/awb.h index 2351d405553058dbff569e9e09e265a56baaa23f..b5ff121041d1a01e3a51d64b87a90fb2e1d8dd10 100644 --- a/src/ipa/mali-c55/algorithms/awb.h +++ b/src/ipa/mali-c55/algorithms/awb.h @@ -22,7 +22,7 @@ public: const IPACameraSensorInfo &configInfo) override; void prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, - mali_c55_params_buffer *params) override; + v4l2_params_buffer *params) override; void process(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, const mali_c55_stats_buffer *stats, diff --git a/src/ipa/mali-c55/algorithms/blc.cpp b/src/ipa/mali-c55/algorithms/blc.cpp index 2a54c86a91f83d24183cb7236fcd5181302eb622..8fd0f10c3082030a36a256830042d733ed4c8c78 100644 --- a/src/ipa/mali-c55/algorithms/blc.cpp +++ b/src/ipa/mali-c55/algorithms/blc.cpp @@ -85,10 +85,10 @@ int BlackLevelCorrection::configure(IPAContext &context, void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context, const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, - mali_c55_params_buffer *params) + v4l2_params_buffer *params) { mali_c55_params_block block; - block.data = ¶ms->data[params->total_size]; + block.data = ¶ms->data[params->data_size]; if (frame > 0) return; @@ -97,7 +97,7 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context, return; block.header->type = MALI_C55_PARAM_BLOCK_SENSOR_OFFS; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(mali_c55_params_sensor_off_preshading); block.sensor_offs->chan00 = offset00; @@ -105,7 +105,7 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context, block.sensor_offs->chan10 = offset10; block.sensor_offs->chan11 = offset11; - params->total_size += block.header->size; + params->data_size += block.header->size; } void BlackLevelCorrection::process([[maybe_unused]] IPAContext &context, diff --git a/src/ipa/mali-c55/algorithms/blc.h b/src/ipa/mali-c55/algorithms/blc.h index 9696e8e9f2aa8b9076a3a41fb8f5ea356e32be12..cf10505ce2908df0d5e658d3fdce663729c7ea76 100644 --- a/src/ipa/mali-c55/algorithms/blc.h +++ b/src/ipa/mali-c55/algorithms/blc.h @@ -22,7 +22,7 @@ public: const IPACameraSensorInfo &configInfo) override; void prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, - mali_c55_params_buffer *params) override; + v4l2_params_buffer *params) override; void process(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, const mali_c55_stats_buffer *stats, diff --git a/src/ipa/mali-c55/algorithms/lsc.cpp b/src/ipa/mali-c55/algorithms/lsc.cpp index c43d034a181edb7559706189f8d75edd67a2dc08..35f1d876e60db252a45cadb771e541735749d106 100644 --- a/src/ipa/mali-c55/algorithms/lsc.cpp +++ b/src/ipa/mali-c55/algorithms/lsc.cpp @@ -111,7 +111,7 @@ int Lsc::init([[maybe_unused]] IPAContext &context, const YamlObject &tuningData size_t Lsc::fillConfigParamsBlock(mali_c55_params_block block) const { block.header->type = MALI_C55_PARAM_MESH_SHADING_CONFIG; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(struct mali_c55_params_mesh_shading_config); block.shading_config->mesh_show = false; @@ -131,7 +131,7 @@ size_t Lsc::fillSelectionParamsBlock(mali_c55_params_block block, uint8_t bank, uint8_t alpha) const { block.header->type = MALI_C55_PARAM_MESH_SHADING_SELECTION; - block.header->flags = MALI_C55_PARAM_BLOCK_FL_NONE; + block.header->flags = 0; block.header->size = sizeof(struct mali_c55_params_mesh_shading_selection); block.shading_selection->mesh_alpha_bank_r = bank; @@ -170,7 +170,7 @@ std::tuple Lsc::findBankAndAlpha(uint32_t ct) const void Lsc::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, - mali_c55_params_buffer *params) + v4l2_params_buffer *params) { /* * For each frame we assess the colour temperature of the **last** frame @@ -194,9 +194,9 @@ void Lsc::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame, } mali_c55_params_block block; - block.data = ¶ms->data[params->total_size]; + block.data = ¶ms->data[params->data_size]; - params->total_size += fillSelectionParamsBlock(block, bank, alpha); + params->data_size += fillSelectionParamsBlock(block, bank, alpha); if (frame > 0) return; @@ -205,8 +205,8 @@ void Lsc::prepare(IPAContext &context, [[maybe_unused]] const uint32_t frame, * If this is the first frame, we need to load the parsed coefficient * tables from tuning data to the ISP. */ - block.data = ¶ms->data[params->total_size]; - params->total_size += fillConfigParamsBlock(block); + block.data = ¶ms->data[params->data_size]; + params->data_size += fillConfigParamsBlock(block); } REGISTER_IPA_ALGORITHM(Lsc, "Lsc") diff --git a/src/ipa/mali-c55/algorithms/lsc.h b/src/ipa/mali-c55/algorithms/lsc.h index d11e23bc7c34fa3e1f45ccf015b50f3d390d7159..9019a61aa547e41154615eba88547d3eee1634e2 100644 --- a/src/ipa/mali-c55/algorithms/lsc.h +++ b/src/ipa/mali-c55/algorithms/lsc.h @@ -23,7 +23,7 @@ public: int init(IPAContext &context, const YamlObject &tuningData) override; void prepare(IPAContext &context, const uint32_t frame, IPAFrameContext &frameContext, - mali_c55_params_buffer *params) override; + v4l2_params_buffer *params) override; private: static constexpr unsigned int kRedOffset = 0; static constexpr unsigned int kGreenOffset = 1024; diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp index 7d45e7310aecdae0e47655e6d2e8830e776d74cd..a6d3e984a438c01509ed27469d9f20c25bc884cf 100644 --- a/src/ipa/mali-c55/mali-c55.cpp +++ b/src/ipa/mali-c55/mali-c55.cpp @@ -331,22 +331,22 @@ void IPAMaliC55::queueRequest(const uint32_t request, const ControlList &control void IPAMaliC55::fillParams(unsigned int request, [[maybe_unused]] uint32_t bufferId) { - struct mali_c55_params_buffer *params; + struct v4l2_params_buffer *params; IPAFrameContext &frameContext = context_.frameContexts.get(request); - params = reinterpret_cast( + params = reinterpret_cast( buffers_.at(bufferId).planes()[0].data()); - memset(params, 0, sizeof(mali_c55_params_buffer)); + memset(params, 0, sizeof(v4l2_params_buffer)); params->version = MALI_C55_PARAM_BUFFER_V1; for (auto const &algo : algorithms()) { algo->prepare(context_, request, frameContext, params); - ASSERT(params->total_size <= MALI_C55_PARAMS_MAX_SIZE); + ASSERT(params->data_size <= MALI_C55_PARAMS_MAX_SIZE); } - size_t bytesused = offsetof(struct mali_c55_params_buffer, data) + params->total_size; + size_t bytesused = offsetof(struct v4l2_params_buffer, data) + params->data_size; paramsComputed.emit(request, bytesused); } diff --git a/src/ipa/mali-c55/module.h b/src/ipa/mali-c55/module.h index 4f6a4f18bfaf83263ccb5b7eb1723da9b655cc3c..434d2c585d2f4eb03402c57e87302fc82e82a0f0 100644 --- a/src/ipa/mali-c55/module.h +++ b/src/ipa/mali-c55/module.h @@ -20,7 +20,7 @@ namespace libcamera { namespace ipa::mali_c55 { using Module = ipa::Module; + v4l2_params_buffer, mali_c55_stats_buffer>; } /* namespace ipa::mali_c55 */