From: Deepa Guthyappa Madivalara <deepa.madivalara@oss.qualcomm.com>
To: Hans Verkuil <hverkuil+cisco@kernel.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
Abhinav Kumar <abhinav.kumar@linux.dev>,
Bryan O'Donoghue <bod@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v5 2/5] media: v4l2-core: Add support for video encoder ROI control
Date: Tue, 15 Sep 2026 15:53:24 -0700 [thread overview]
Message-ID: <be315a16-9eff-43fd-a255-b92aa774d1a3@oss.qualcomm.com> (raw)
In-Reply-To: <98399307-338b-4a16-9ac3-2a342c12b318@kernel.org>
On 9/10/2026 12:49 AM, Hans Verkuil wrote:
> On 15/08/2026 21:22, Deepa Guthyappa Madivalara wrote:
>> Add necessary support for controls V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP
>> and V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE.
> See my comment at the end of patch 1/5: this split should be done differently,
> the first patch adds V4L2_CTRL_TYPE_S8 support, the second adds support for
> the new controls.
Upated in v6.
>> Signed-off-by: Deepa Guthyappa Madivalara<deepa.madivalara@oss.qualcomm.com>
>> ---
>> drivers/media/v4l2-core/v4l2-ctrls-api.c | 1 +
>> drivers/media/v4l2-core/v4l2-ctrls-core.c | 23 ++++++++++++++++++++++-
>> drivers/media/v4l2-core/v4l2-ctrls-defs.c | 10 ++++++++++
>> include/media/v4l2-ctrls.h | 3 ++-
>> 4 files changed, 35 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c
>> index 93d8d4012d0f4fef004e417d0aee2ae44b1b30bd..7d41cfd7378baaa929d4da0266c45f731bb54285 100644
>> --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c
>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c
>> @@ -980,6 +980,7 @@ int __v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl,
>> case V4L2_CTRL_TYPE_U8:
>> case V4L2_CTRL_TYPE_U16:
>> case V4L2_CTRL_TYPE_U32:
>> + case V4L2_CTRL_TYPE_S8:
>> if (ctrl->is_array)
>> return -EINVAL;
>> ret = check_range(ctrl->type, min, max, step, def);
>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
>> index 5b8a594fb9e24e16128c9c763a3b1dd311fad2ba..db6577070ebd2eb6a60599b3b2394fe128236705 100644
>> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
>> @@ -290,6 +290,14 @@ static void __v4l2_ctrl_type_op_init(const struct v4l2_ctrl *ctrl, u32 from_idx,
>> memset(ptr.p_u32 + from_idx, 0, elems * sizeof(u32));
>> }
>> break;
>> + case V4L2_CTRL_TYPE_S8:
>> + if (value) {
>> + for (i = from_idx; i < tot_elems; i++)
>> + ptr.p_s8[i] = value;
>> + } else {
>> + memset(ptr.p_s8 + from_idx, 0, elems * sizeof(s8));
> It's a single byte, so you can just do memset with 'value'. Just cast value to u8.
>
>> + }
>> + break;
>> default:
>> for (i = from_idx; i < tot_elems; i++) {
>> switch (which) {
>> @@ -370,6 +378,9 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)
>> case V4L2_CTRL_TYPE_U32:
>> pr_cont("%u", (unsigned)*ptr.p_u32);
>> break;
>> + case V4L2_CTRL_TYPE_S8:
>> + pr_cont("%d", *ptr.p_s8);
>> + break;
>> case V4L2_CTRL_TYPE_AREA:
>> pr_cont("%ux%u", ptr.p_area->width, ptr.p_area->height);
>> break;
>> @@ -1397,6 +1408,8 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
>> return -EINVAL;
>> break;
>>
>> + case V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP:
>> + break;
>> default:
>> return -EINVAL;
>> }
>> @@ -1410,6 +1423,7 @@ static int std_validate_elem(const struct v4l2_ctrl *ctrl, u32 idx,
>> size_t len;
>> u64 offset;
>> s64 val;
>> + s32 tmp;
>>
>> switch ((u32)ctrl->type) {
>> case V4L2_CTRL_TYPE_INTEGER:
>> @@ -1435,7 +1449,11 @@ static int std_validate_elem(const struct v4l2_ctrl *ctrl, u32 idx,
>> return ROUND_TO_RANGE(ptr.p_u16[idx], u16, ctrl);
>> case V4L2_CTRL_TYPE_U32:
>> return ROUND_TO_RANGE(ptr.p_u32[idx], u32, ctrl);
>> -
>> + case V4L2_CTRL_TYPE_S8:
>> + tmp = ptr.p_s8[idx];
>> + ROUND_TO_RANGE(tmp, s32, ctrl);
>> + ptr.p_s8[idx] = (s8)tmp;
> 'ROUND_TO_RANGE(ptr.p_s8[idx], u8, ctrl)' should work just fine. No need for 'tmp'.
> The 'u8' type is used for an offset variable inside the macro that is always >= 0.
Got it, updated in v6
>> + return 0;
> Add back the newline you removed above. It separates the 'integer' types from the
> boolean type.
Done
>> case V4L2_CTRL_TYPE_BOOLEAN:
>> ptr.p_s32[idx] = !!ptr.p_s32[idx];
>> return 0;
>> @@ -2030,6 +2048,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
>> case V4L2_CTRL_TYPE_U32:
>> elem_size = sizeof(u32);
>> break;
>> + case V4L2_CTRL_TYPE_S8:
>> + elem_size = sizeof(s8);
>> + break;
>> case V4L2_CTRL_TYPE_MPEG2_SEQUENCE:
>> elem_size = sizeof(struct v4l2_ctrl_mpeg2_sequence);
>> break;
>> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>> index e062f2088490470c42d6c579ff7675be454a29b0..8f895060799ea13443143edd398dfb97f4ba0085 100644
>> --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>> +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c
>> @@ -974,6 +974,8 @@ const char *v4l2_ctrl_get_name(u32 id)
>> case V4L2_CID_MPEG_VIDEO_AVERAGE_QP: return "Average QP Value";
>> case V4L2_CID_FWHT_I_FRAME_QP: return "FWHT I-Frame QP Value";
>> case V4L2_CID_FWHT_P_FRAME_QP: return "FWHT P-Frame QP Value";
>> + case V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP: return "Encoder ROI MB Delta QP";
>> + case V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE: return "Encoder ROI MB Size";
>>
>> /* VPX controls */
>> case V4L2_CID_MPEG_VIDEO_VPX_NUM_PARTITIONS: return "VPX Number of Partitions";
>> @@ -1622,6 +1624,14 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
>> case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY:
>> *type = V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY;
>> break;
>> + case V4L2_CID_MPEG_VIDEO_ROI_MB_DELTA_QP:
>> + *type = V4L2_CTRL_TYPE_S8;
>> + *flags |= V4L2_CTRL_FLAG_DYNAMIC_ARRAY;
>> + break;
>> + case V4L2_CID_MPEG_VIDEO_ROI_MB_SIZE:
>> + *type = V4L2_CTRL_TYPE_U8;
>> + *flags |= V4L2_CTRL_FLAG_READ_ONLY;
>> + break;
>> default:
>> *type = V4L2_CTRL_TYPE_INTEGER;
>> break;
>> diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
>> index a1806ddbc797efa52e83cd3f685ef70d5b5483d2..9a68a3555e349f1e55aa01af5c10f08201d62bae 100644
>> --- a/include/media/v4l2-ctrls.h
>> +++ b/include/media/v4l2-ctrls.h
>> @@ -27,6 +27,7 @@ struct video_device;
>>
>> /**
>> * union v4l2_ctrl_ptr - A pointer to a control value.
>> + * @p_s8: Pointer to a 8-bit signed value.
>> * @p_s32: Pointer to a 32-bit signed value.
>> * @p_s64: Pointer to a 64-bit signed value.
>> * @p_u8: Pointer to a 8-bit unsigned value.
>> @@ -61,10 +62,10 @@ struct video_device;
>> * @p_const: Pointer to a constant compound value.
>> */
>> union v4l2_ctrl_ptr {
>> + s8 *p_s8;
>> s32 *p_s32;
>> s64 *p_s64;
>> u8 *p_u8;
>> - s8 *p_s8;
>> u16 *p_u16;
>> u32 *p_u32;
>> char *p_char;
>>
> Regards,
>
> Hans
next prev parent reply other threads:[~2026-09-15 22:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-15 19:22 [PATCH v5 0/5] Implement Region of Interest(ROI) support Deepa Guthyappa Madivalara
2026-08-15 19:22 ` [PATCH v5 1/5] media: uapi: Introduce new control for video encoder ROI Deepa Guthyappa Madivalara
2026-09-10 7:37 ` Hans Verkuil
2026-09-10 7:49 ` Hans Verkuil
2026-08-15 19:22 ` [PATCH v5 2/5] media: v4l2-core: Add support for video encoder ROI control Deepa Guthyappa Madivalara
2026-09-10 7:49 ` Hans Verkuil
2026-09-15 22:53 ` Deepa Guthyappa Madivalara [this message]
2026-08-15 19:22 ` [PATCH v5 3/5] media: iris: Add ROI delta QP control support for HFI Gen2 encoders Deepa Guthyappa Madivalara
2026-08-15 19:22 ` [PATCH v5 4/5] media: iris: Add HFI metadata buffer delivery support for " Deepa Guthyappa Madivalara
2026-08-15 19:22 ` [PATCH v5 5/5] media: iris: Add BUF_ROIMB_DELTAQP metadata buffer for ROI delta QP Deepa Guthyappa Madivalara
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=be315a16-9eff-43fd-a255-b92aa774d1a3@oss.qualcomm.com \
--to=deepa.madivalara@oss.qualcomm.com \
--cc=abhinav.kumar@linux.dev \
--cc=bod@kernel.org \
--cc=dikshita.agarwal@oss.qualcomm.com \
--cc=hverkuil+cisco@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mchehab@kernel.org \
--cc=vikash.garodia@oss.qualcomm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.