Re: [PATCH 58/74] media: uapi: Add CAMSS ISP statistics definition
From: Gjorgji Rosikopulos (Consultant)
Date: Thu Oct 08 2026 - 07:24:52 EST
Hi Bryan,
On 10/5/2026 8:14 PM, bod@xxxxxxxxxx wrote:
> From: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
>
> Add V4L2_META_FMT_QCOM_ISP_STATS, the statistics counterpart of the CAMSS
> ISP parameters. Statistics use the v4l2-isp extensible format: the driver
> serialises one block per statistics engine into a struct v4l2_isp_buffer,
> each block embedding a struct v4l2_isp_block_header with a type from
> enum camss_stats_block_type.
>
> The first block is the AEC Bayer histogram, CAMSS_STATS_AEC_BHIST:
> 1024 bins counting the luma of each 2x2 Bayer quad in the histogram's
> region.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>
> ---
> drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> include/uapi/linux/qcom-camss-config.h | 33 +++++++++++++++++++++++++++++++++
> include/uapi/linux/videodev2.h | 3 +++
> 3 files changed, 37 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index a2b650f4ec3c3..e5eccb62e76b2 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_META_FMT_C3ISP_STATS: descr = "Amlogic C3 ISP Statistics"; break;
> case V4L2_META_FMT_MALI_C55_PARAMS: descr = "ARM Mali-C55 ISP Parameters"; break;
> case V4L2_META_FMT_MALI_C55_STATS: descr = "ARM Mali-C55 ISP 3A Statistics"; break;
> + case V4L2_META_FMT_QCOM_ISP_STATS: descr = "Qualcomm CAMSS ISP Statistics"; break;
> case V4L2_PIX_FMT_NV12_8L128: descr = "NV12 (8x128 Linear)"; break;
> case V4L2_PIX_FMT_NV12M_8L128: descr = "NV12M (8x128 Linear)"; break;
> case V4L2_PIX_FMT_NV12_10BE_8L128: descr = "10-bit NV12 (8x128 Linear, BE)"; break;
> diff --git a/include/uapi/linux/qcom-camss-config.h b/include/uapi/linux/qcom-camss-config.h
> index aa3d97cfcc78e..23c12b8955ef6 100644
> --- a/include/uapi/linux/qcom-camss-config.h
> +++ b/include/uapi/linux/qcom-camss-config.h
> @@ -209,4 +209,37 @@ struct camss_params_gamma {
> sizeof(struct camss_params_color_correct) +\
> sizeof(struct camss_params_gamma))
>
> +/**
> + * enum camss_stats_block_type - CAMSS ISP statistics block identifiers
> + *
> + * Each value identifies one statistics block in a
> + * V4L2_META_FMT_QCOM_ISP_STATS buffer. The value is placed in the @type field
> + * of &struct v4l2_isp_block_header.
> + *
> + * @CAMSS_STATS_AEC_BHIST: AEC Bayer histogram, &struct camss_stats_bhist
> + */
> +enum camss_stats_block_type {
> + CAMSS_STATS_AEC_BHIST = 1,
> +};
> +
> +/* Number of bins in a Bayer histogram. */
> +#define CAMSS_STATS_BHIST_BINS 1024
> +
> +/**
> + * struct camss_stats_bhist - Bayer histogram
> + *
> + * Histogram of the luma of each 2x2 Bayer quad inside the histogram's region,
> + * over CAMSS_STATS_BHIST_BINS equal bins spanning its input range. Quads
> + * whose luma falls outside the input range are not counted.
> + *
> + * @header: block header; @header.type = CAMSS_STATS_AEC_BHIST
> + * @bins: number of quads per bin
> + */
> +struct camss_stats_bhist {
> + struct v4l2_isp_block_header header;
I think that the whole format is not correct, having header is preventing address alignment
of the buffer for the stats, as i have mentioned in the next patch copying the statistics
on each frame is not correct, just to have generic statistics format in userspace.
~Gjorgji