Linux Media Controller development
 help / color / mirror / Atom feed
From: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Daniel Scally <dan.scally@ideasonboard.com>,
	Keke Li <keke.li@amlogic.com>,
	Antoine Bouyer <antoine.bouyer@nxp.com>,
	Jai Luthra <jai.luthra@ideasonboard.com>,
	Ricardo Ribalda <ribalda@chromium.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans Verkuil <hverkuil+cisco@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/6] media: v4l2-isp: Add per-block validation callback
Date: Fri, 15 May 2026 20:22:47 +0200	[thread overview]
Message-ID: <20260515182247.GT332351@ragnatech.se> (raw)
In-Reply-To: <20260505-extensible-stats-v1-4-e16f326b8dad@ideasonboard.com>

Hello Jacopo,

Thanks for your work.

On 2026-05-05 16:12:15 +0200, Jacopo Mondi wrote:
> Drivers are expected to provide to the helper function
> v4l2_isp_params_validate_buffer() a list of 'struct
> v4l2_isp_params_block_type_info' entries, one for each supported ISP block.
> 
> The type 'struct v4l2_isp_params_block_type_info' so far only contained the
> expected block size for the core framework to validate the declared block
> size against the expected one.
> 
> For some blocks, drivers might want to implement more precise per-block
> validations. Add a function pointer member to 'struct
> v4l2_isp_params_block_type_info' to allow drivers to register a callback
> and call it from the core framework during validation.
> 
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

This is a neat idea!

Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  drivers/media/v4l2-core/v4l2-isp.c |  4 ++++
>  include/media/v4l2-isp.h           | 11 ++++++++---
>  2 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-isp.c b/drivers/media/v4l2-core/v4l2-isp.c
> index 29831f7032e9..10760659f8a3 100644
> --- a/drivers/media/v4l2-core/v4l2-isp.c
> +++ b/drivers/media/v4l2-core/v4l2-isp.c
> @@ -114,6 +114,10 @@ int v4l2_isp_params_validate_buffer(struct device *dev, struct vb2_buffer *vb,
>  			return -EINVAL;
>  		}
>  
> +		if (type_info->block_validate &&
> +		    type_info->block_validate(dev, block))
> +			return -EINVAL;
> +
>  		block_offset += block->size;
>  		buffer_size -= block->size;
>  	}
> diff --git a/include/media/v4l2-isp.h b/include/media/v4l2-isp.h
> index d70ed6b431e7..1f35a52f978a 100644
> --- a/include/media/v4l2-isp.h
> +++ b/include/media/v4l2-isp.h
> @@ -55,17 +55,22 @@ int v4l2_isp_params_validate_buffer_size(struct device *dev,
>  /**
>   * struct v4l2_isp_params_block_type_info - V4L2 ISP per-block-type info
>   * @size: the block type expected size
> + * @block_validate: driver's callback to implement per-block validation
>   *
>   * 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.
> + * configuration block types for validation purposes. It contains the expected
> + * block type size and a function pointer where drivers can register a callback
> + * for additional per-block validation purposes. The validation function is
> + * expected to return 0 on success or a negative error number for errors.
>   *
>   * 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.
> + * expected block type size and the optional callback.
>   */
>  struct v4l2_isp_params_block_type_info {
>  	size_t size;
> +	int (*block_validate)(struct device *dev,
> +			      const struct v4l2_isp_block_header *block);
>  };
>  
>  /**
> 
> -- 
> 2.53.0
> 

-- 
Kind Regards,
Niklas Söderlund

  reply	other threads:[~2026-05-15 18:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 14:12 [PATCH 0/6] media: v4l2-isp: Add support for extensible statistics Jacopo Mondi
2026-05-05 14:12 ` [PATCH 1/6] media: uapi: v4l2-isp: Add " Jacopo Mondi
2026-05-15 18:17   ` Niklas Söderlund
2026-05-05 14:12 ` [PATCH 2/6] media: Documentation: uapi: Update V4L2 ISP for extensible stats Jacopo Mondi
2026-05-15 18:19   ` Niklas Söderlund
2026-05-05 14:12 ` [PATCH 3/6] media: v4l2-isp: Rename v4l2_isp_params_buffer_size Jacopo Mondi
2026-05-06  8:11   ` Antoine Bouyer
2026-05-06  8:35     ` Jacopo Mondi
2026-05-06  8:57       ` Antoine Bouyer
2026-05-15 18:21   ` Niklas Söderlund
2026-05-05 14:12 ` [PATCH 4/6] media: v4l2-isp: Add per-block validation callback Jacopo Mondi
2026-05-15 18:22   ` Niklas Söderlund [this message]
2026-05-05 14:12 ` [PATCH 5/6] media: amlogic-c3: Implement per-block validation Jacopo Mondi
2026-05-05 14:12 ` [PATCH 6/6] media: v4l2-isp: Add helpers for stats buffer Jacopo Mondi
2026-05-15 18:29   ` Niklas Söderlund
2026-05-05 16:49 ` [PATCH 0/6] media: v4l2-isp: Add support for extensible statistics Antoine Bouyer
2026-05-12  9:26   ` Antoine Bouyer
2026-05-13  1:04     ` Keke Li
2026-05-15 13:11       ` Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515182247.GT332351@ragnatech.se \
    --to=niklas.soderlund@ragnatech.se \
    --cc=antoine.bouyer@nxp.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=jai.luthra@ideasonboard.com \
    --cc=keke.li@amlogic.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox