media: v4l2-isp: Rename block_info to block_type_info

The v4l2_isp_params_block_info structure contains validation information
that apply to a block -type- and not only to a specific ISP block
implementation.

Clarify this by renaming v4l2_isp_params_block_info in
v4l2_isp_params_block_type_info and update the documentation and the
users of v4l2-isp accordingly.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
Jacopo Mondi 2025-11-14 12:02:11 +01:00 committed by Hans Verkuil
parent 48ecdf254d
commit d619dd9a3d
5 changed files with 35 additions and 32 deletions

View File

@ -536,7 +536,8 @@ static const c3_isp_block_handler c3_isp_params_handlers[] = {
.size = sizeof(struct c3_isp_params_ ## data), \
}
static const struct v4l2_isp_params_block_info c3_isp_params_blocks_info[] = {
static const struct v4l2_isp_params_block_type_info
c3_isp_params_block_types_info[] = {
C3_ISP_PARAMS_BLOCK_INFO(AWB_GAINS, awb_gains),
C3_ISP_PARAMS_BLOCK_INFO(AWB_CONFIG, awb_config),
C3_ISP_PARAMS_BLOCK_INFO(AE_CONFIG, ae_config),
@ -548,7 +549,7 @@ static const struct v4l2_isp_params_block_info c3_isp_params_blocks_info[] = {
};
static_assert(ARRAY_SIZE(c3_isp_params_handlers) ==
ARRAY_SIZE(c3_isp_params_blocks_info));
ARRAY_SIZE(c3_isp_params_block_types_info));
static void c3_isp_params_cfg_blocks(struct c3_isp_params *params)
{
@ -781,8 +782,8 @@ static int c3_isp_params_vb2_buf_prepare(struct vb2_buffer *vb)
return v4l2_isp_params_validate_buffer(params->isp->dev, vb,
(struct v4l2_isp_params_buffer *)cfg,
c3_isp_params_blocks_info,
ARRAY_SIZE(c3_isp_params_blocks_info));
c3_isp_params_block_types_info,
ARRAY_SIZE(c3_isp_params_block_types_info));
}
static int c3_isp_params_vb2_buf_init(struct vb2_buffer *vb)

View File

@ -428,7 +428,8 @@ static const mali_c55_params_handler mali_c55_params_handlers[] = {
[MALI_C55_PARAM_MESH_SHADING_SELECTION] = &mali_c55_params_lsc_selection,
};
static const struct v4l2_isp_params_block_info mali_c55_params_blocks_info[] = {
static const struct v4l2_isp_params_block_type_info
mali_c55_params_block_types_info[] = {
[MALI_C55_PARAM_BLOCK_SENSOR_OFFS] = {
.size = sizeof(struct mali_c55_params_sensor_off_preshading),
},
@ -599,8 +600,8 @@ static int mali_c55_params_buf_prepare(struct vb2_buffer *vb)
memcpy(buf->config, config, v4l2_isp_params_buffer_size(MALI_C55_PARAMS_MAX_SIZE));
return v4l2_isp_params_validate_buffer(mali_c55->dev, vb, buf->config,
mali_c55_params_blocks_info,
ARRAY_SIZE(mali_c55_params_blocks_info));
mali_c55_params_block_types_info,
ARRAY_SIZE(mali_c55_params_block_types_info));
}
static void mali_c55_params_buf_queue(struct vb2_buffer *vb)

View File

@ -2198,7 +2198,8 @@ static const struct rkisp1_ext_params_handler {
.size = sizeof(struct rkisp1_ext_params_ ## data ## _config), \
}
static const struct v4l2_isp_params_block_info rkisp1_ext_params_blocks_info[] = {
static const struct v4l2_isp_params_block_type_info
rkisp1_ext_params_block_types_info[] = {
RKISP1_PARAMS_BLOCK_INFO(BLS, bls),
RKISP1_PARAMS_BLOCK_INFO(DPCC, dpcc),
RKISP1_PARAMS_BLOCK_INFO(SDG, sdg),
@ -2223,7 +2224,7 @@ static const struct v4l2_isp_params_block_info rkisp1_ext_params_blocks_info[] =
};
static_assert(ARRAY_SIZE(rkisp1_ext_params_handlers) ==
ARRAY_SIZE(rkisp1_ext_params_blocks_info));
ARRAY_SIZE(rkisp1_ext_params_block_types_info));
static void rkisp1_ext_params_config(struct rkisp1_params *params,
struct rkisp1_ext_params_cfg *cfg,
@ -2677,8 +2678,8 @@ static int rkisp1_params_prepare_ext_params(struct rkisp1_params *params,
return v4l2_isp_params_validate_buffer(params->rkisp1->dev, vb,
(struct v4l2_isp_params_buffer *)cfg,
rkisp1_ext_params_blocks_info,
ARRAY_SIZE(rkisp1_ext_params_blocks_info));
rkisp1_ext_params_block_types_info,
ARRAY_SIZE(rkisp1_ext_params_block_types_info));
}
static int rkisp1_params_vb2_buf_prepare(struct vb2_buffer *vb)

View File

@ -38,8 +38,8 @@ EXPORT_SYMBOL_GPL(v4l2_isp_params_validate_buffer_size);
int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
const struct v4l2_isp_params_buffer *buffer,
const struct v4l2_isp_params_block_info *info,
size_t num_blocks)
const struct v4l2_isp_params_block_type_info *type_info,
size_t num_block_types)
{
size_t header_size = offsetof(struct v4l2_isp_params_buffer, data);
size_t payload_size = vb2_get_plane_payload(vb, 0);
@ -71,13 +71,13 @@ int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
/* Walk the list of ISP configuration blocks and validate them. */
buffer_size = buffer->data_size;
while (buffer_size >= sizeof(struct v4l2_isp_params_block_header)) {
const struct v4l2_isp_params_block_info *block_info;
const struct v4l2_isp_params_block_type_info *info;
const struct v4l2_isp_params_block_header *block;
block = (const struct v4l2_isp_params_block_header *)
(buffer->data + block_offset);
if (block->type >= num_blocks) {
if (block->type >= num_block_types) {
dev_dbg(dev,
"Invalid block type %u at offset %zu\n",
block->type, block_offset);
@ -100,17 +100,17 @@ int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
}
/*
* Match the block reported size against the info provided
* Match the block reported size against the type info provided
* one, but allow the block to only contain the header in
* case it is going to be disabled.
*/
block_info = &info[block->type];
if (block->size != block_info->size &&
info = &type_info[block->type];
if (block->size != info->size &&
(!(block->flags & V4L2_ISP_PARAMS_FL_BLOCK_DISABLE) ||
block->size != sizeof(*block))) {
dev_dbg(dev,
"Invalid block size %u (expected %zu) at offset %zu\n",
block->size, block_info->size, block_offset);
block->size, info->size, block_offset);
return -EINVAL;
}

View File

@ -49,18 +49,18 @@ int v4l2_isp_params_validate_buffer_size(struct device *dev,
size_t max_size);
/**
* struct v4l2_isp_params_block_info - V4L2 ISP per-block info
* @size: the block expected size
* struct v4l2_isp_params_block_type_info - V4L2 ISP per-block-type info
* @size: the block type expected size
*
* The v4l2_isp_params_block_info collects information of the ISP configuration
* blocks for validation purposes. It currently only contains the expected
* block size.
* The v4l2_isp_params_block_type_info collects information of the ISP
* configuration block types for validation purposes. It currently only contains
* the expected block type size.
*
* Drivers shall prepare a list of block info, indexed by block type, one for
* each supported ISP block and correctly populate them with the expected block
* size.
* Drivers shall prepare a list of block type info, indexed by block type, one
* for each supported ISP block type and correctly populate them with the
* expected block type size.
*/
struct v4l2_isp_params_block_info {
struct v4l2_isp_params_block_type_info {
size_t size;
};
@ -69,8 +69,8 @@ struct v4l2_isp_params_block_info {
* @dev: the driver's device pointer
* @vb: the videobuf2 buffer
* @buffer: the V4L2 ISP parameters buffer
* @info: the list of per-block validation info
* @num_blocks: the number of blocks
* @type_info: the array of per-block-type validation info
* @num_block_types: the number of block types in the type_info array
*
* This function completes the validation of a V4L2 ISP parameters buffer,
* verifying each configuration block correctness before the driver can use
@ -85,7 +85,7 @@ struct v4l2_isp_params_block_info {
*/
int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
const struct v4l2_isp_params_buffer *buffer,
const struct v4l2_isp_params_block_info *info,
size_t num_blocks);
const struct v4l2_isp_params_block_type_info *type_info,
size_t num_block_types);
#endif /* _V4L2_ISP_H_ */