From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Yunke Cao <yunkec@google.com>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Daniel Scally <dan.scally@ideasonboard.com>,
Tomasz Figa <tfiga@chromium.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Ricardo Ribalda <ribalda@chromium.org>,
linux-media@vger.kernel.org
Subject: Re: [PATCH v14 01/11] media: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT
Date: Tue, 12 Dec 2023 03:37:07 +0200 [thread overview]
Message-ID: <20231212013707.GM27535@pendragon.ideasonboard.com> (raw)
In-Reply-To: <CANqU6Fe-GzKWMwOrmbPKRvBqW+Z1x-vWH=XU_G7ax4pxqHUMPg@mail.gmail.com>
On Tue, Dec 12, 2023 at 10:33:02AM +0900, Yunke Cao wrote:
> On Fri, Dec 8, 2023 at 10:41 PM Laurent Pinchart wrote:
> > On Fri, Dec 01, 2023 at 09:35:21AM +0100, Hans Verkuil wrote:
> > > On 01/12/2023 08:18, Yunke Cao wrote:
> > > > Add p_rect to struct v4l2_ext_control with basic support in
> > > > v4l2-ctrls.
> > > >
> > > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
> > > > Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> > > > Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
> > > > Signed-off-by: Yunke Cao <yunkec@google.com>
> > > > Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> > > > ---
> > > > Changelog since v12:
> > > > - No Change.
> > > > Changelog since v11:
> > > > - Added reviewed-by from Hans
> > > > Changelog since v10:
> > > > - Added reviewed-by from Sergey and Daniel.
> > > > Changelog since v9:
> > > > - No Change.
> > > > Changelog since v8:
> > > > - No change.
> > > > Changelog since v7:
> > > > - Document V4L2_CTRL_TYPE_RECT in vidioc-queryctrl.rst.
> > > > - Rebased to media-stage master.
> > > > - Do not assign each field in std_equal
> > > >
> > > > .../media/v4l/vidioc-g-ext-ctrls.rst | 4 ++++
> > > > .../userspace-api/media/v4l/vidioc-queryctrl.rst | 7 +++++++
> > > > .../media/videodev2.h.rst.exceptions | 1 +
> > > > drivers/media/v4l2-core/v4l2-ctrls-core.c | 16 +++++++++++++++-
> > > > include/media/v4l2-ctrls.h | 2 ++
> > > > include/uapi/linux/videodev2.h | 2 ++
> > > > 6 files changed, 31 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> > > > index f9f73530a6be..7b1001d11f9c 100644
> > > > --- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> > > > +++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst
> > > > @@ -199,6 +199,10 @@ still cause this situation.
> > > > - ``p_area``
> > > > - A pointer to a struct :c:type:`v4l2_area`. Valid if this control is
> > > > of type ``V4L2_CTRL_TYPE_AREA``.
> > > > + * - struct :c:type:`v4l2_rect` *
> > > > + - ``p_rect``
> > > > + - A pointer to a struct :c:type:`v4l2_rect`. Valid if this control is
> > > > + of type ``V4L2_CTRL_TYPE_RECT``.
> > > > * - struct :c:type:`v4l2_ctrl_h264_sps` *
> > > > - ``p_h264_sps``
> > > > - A pointer to a struct :c:type:`v4l2_ctrl_h264_sps`. Valid if this control is
> > > > diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
> > > > index 4d38acafe8e1..56d5c8b0b88b 100644
> > > > --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
> > > > +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
> > > > @@ -441,6 +441,13 @@ See also the examples in :ref:`control`.
> > > > - n/a
> > > > - A struct :c:type:`v4l2_area`, containing the width and the height
> > > > of a rectangular area. Units depend on the use case.
> > > > + * - ``V4L2_CTRL_TYPE_RECT``
> > > > + - n/a
> > > > + - n/a
> > > > + - n/a
> > > > + - A struct :c:type:`v4l2_rect`, containing a rectangle described by
> > > > + the position of its top-left corner, the width and the height. Units
> > > > + depend on the use case.
> > > > * - ``V4L2_CTRL_TYPE_H264_SPS``
> > > > - n/a
> > > > - n/a
> > > > diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> > > > index 3e58aac4ef0b..c46082ef0e4d 100644
> > > > --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> > > > +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions
> > > > @@ -150,6 +150,7 @@ replace symbol V4L2_CTRL_TYPE_HEVC_SPS :c:type:`v4l2_ctrl_type`
> > > > replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type`
> > > > replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type`
> > > > replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type`
> > > > +replace symbol V4L2_CTRL_TYPE_RECT :c:type:`v4l2_ctrl_type`
> > > > replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type`
> > > > replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type`
> > > > replace symbol V4L2_CTRL_TYPE_VP9_COMPRESSED_HDR :c:type:`v4l2_ctrl_type`
> > > > diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> > > > index a662fb60f73f..f1486ab032cf 100644
> > > > --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
> > > > +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> > > > @@ -367,7 +367,11 @@ void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl)
> > > > case V4L2_CTRL_TYPE_AV1_FILM_GRAIN:
> > > > pr_cont("AV1_FILM_GRAIN");
> > > > break;
> > > > -
> > > > + case V4L2_CTRL_TYPE_RECT:
> > > > + pr_cont("%ux%u@%dx%d",
> > > > + ptr.p_rect->width, ptr.p_rect->height,
> > > > + ptr.p_rect->left, ptr.p_rect->top);
> > > > + break;
> > > > default:
> > > > pr_cont("unknown type %d", ctrl->type);
> > > > break;
> > > > @@ -812,6 +816,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
> > > > struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering;
> > > > struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params;
> > > > struct v4l2_area *area;
> > > > + struct v4l2_rect *rect;
> > > > void *p = ptr.p + idx * ctrl->elem_size;
> > > > unsigned int i;
> > > >
> > > > @@ -1169,6 +1174,12 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
> > > > return -EINVAL;
> > > > break;
> > > >
> > > > + case V4L2_CTRL_TYPE_RECT:
> > > > + rect = p;
> > > > + if (!rect->width || !rect->height)
> > > > + return -EINVAL;
> > > > + break;
> > > > +
> > > > default:
> > > > return -EINVAL;
> > > > }
> > > > @@ -1868,6 +1879,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
> > > > case V4L2_CTRL_TYPE_AREA:
> > > > elem_size = sizeof(struct v4l2_area);
> > > > break;
> > > > + case V4L2_CTRL_TYPE_RECT:
> > > > + elem_size = sizeof(struct v4l2_rect);
> > > > + break;
> > > > default:
> > > > if (type < V4L2_CTRL_COMPOUND_TYPES)
> > > > elem_size = sizeof(s32);
> > > > diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
> > > > index 59679a42b3e7..b0db167a3ac4 100644
> > > > --- a/include/media/v4l2-ctrls.h
> > > > +++ b/include/media/v4l2-ctrls.h
> > > > @@ -56,6 +56,7 @@ struct video_device;
> > > > * @p_av1_tile_group_entry: Pointer to an AV1 tile group entry structure.
> > > > * @p_av1_frame: Pointer to an AV1 frame structure.
> > > > * @p_av1_film_grain: Pointer to an AV1 film grain structure.
> > > > + * @p_rect: Pointer to a rectangle.
> > > > * @p: Pointer to a compound value.
> > > > * @p_const: Pointer to a constant compound value.
> > > > */
> > > > @@ -89,6 +90,7 @@ union v4l2_ctrl_ptr {
> > > > struct v4l2_ctrl_av1_tile_group_entry *p_av1_tile_group_entry;
> > > > struct v4l2_ctrl_av1_frame *p_av1_frame;
> > > > struct v4l2_ctrl_av1_film_grain *p_av1_film_grain;
> > > > + struct v4l2_rect *p_rect;
> > > > void *p;
> > > > const void *p_const;
> > > > };
> > > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> > > > index c3d4e490ce7c..82d86abcf89c 100644
> > > > --- a/include/uapi/linux/videodev2.h
> > > > +++ b/include/uapi/linux/videodev2.h
> > > > @@ -1815,6 +1815,7 @@ struct v4l2_ext_control {
> > > > __s32 __user *p_s32;
> > > > __s64 __user *p_s64;
> > > > struct v4l2_area __user *p_area;
> > > > + struct v4l2_rect __user *p_rect;
> > > > struct v4l2_ctrl_h264_sps __user *p_h264_sps;
> > > > struct v4l2_ctrl_h264_pps *p_h264_pps;
> > > > struct v4l2_ctrl_h264_scaling_matrix __user *p_h264_scaling_matrix;
> > >
> > > This will probably not apply cleanly anymore to the latest staging tree due
> > > to a change to this struct that was merged there.
> > >
> > > Laurent, are you planning to make a PR for this? If so, then you can fix this
> > > up yourself, ditto for the very small typo in patch 06/11 that I found.
> >
> > 'git am' complained indeed, but 'patch' was happy with a bit of fuzz.
> > I've checked the result and it's all fine.
> >
> > I'm reviewing the rest of the series now.
> >
>
> Thanks for reviewing the series!!!! I will prepare a v15.
> Should I base v15 on top of git.linuxtv.org/media_stage.git ?
Yes, that's the best base I think.
> > > I'm happy with the v4l2 control changes, so this is ready to go as far as I am
> > > concerned.
> > >
> > > > @@ -1883,6 +1884,7 @@ enum v4l2_ctrl_type {
> > > > V4L2_CTRL_TYPE_U16 = 0x0101,
> > > > V4L2_CTRL_TYPE_U32 = 0x0102,
> > > > V4L2_CTRL_TYPE_AREA = 0x0106,
> > > > + V4L2_CTRL_TYPE_RECT = 0x0107,
> > > >
> > > > V4L2_CTRL_TYPE_HDR10_CLL_INFO = 0x0110,
> > > > V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY = 0x0111,
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-12-12 1:37 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 7:18 [PATCH v14 00/11] Implement UVC v1.5 ROI Yunke Cao
2023-12-01 7:18 ` [PATCH v14 01/11] media: v4l2_ctrl: Add V4L2_CTRL_TYPE_RECT Yunke Cao
2023-12-01 8:35 ` Hans Verkuil
2023-12-08 13:41 ` Laurent Pinchart
2023-12-12 1:33 ` Yunke Cao
2023-12-12 1:37 ` Laurent Pinchart [this message]
2023-12-01 7:18 ` [PATCH v14 02/11] media: uvcvideo: add uvc_ctrl_get_boundary for getting default value Yunke Cao
2023-12-08 15:13 ` Laurent Pinchart
2023-12-01 7:18 ` [PATCH v14 03/11] media: uvcvideo: introduce __uvc_ctrl_get_std() Yunke Cao
2023-12-08 15:12 ` Laurent Pinchart
2023-12-01 7:18 ` [PATCH v14 04/11] media: uvcvideo: Split uvc_control_mapping.size to v4l2 and data size Yunke Cao
2023-12-08 14:15 ` Laurent Pinchart
2023-12-12 7:59 ` Yunke Cao
2023-12-18 3:17 ` Laurent Pinchart
2023-12-01 7:18 ` [PATCH v14 05/11] media: uvcvideo: Add support for compound controls Yunke Cao
2023-12-06 5:45 ` Dan Carpenter
2023-12-08 15:07 ` Laurent Pinchart
2023-12-13 7:38 ` Yunke Cao
2023-12-18 3:27 ` Laurent Pinchart
2023-12-20 2:28 ` Yunke Cao
2023-12-01 7:18 ` [PATCH v14 06/11] v4l2-ctrls: add support for V4L2_CTRL_WHICH_MIN/MAX_VAL Yunke Cao
2023-12-01 8:32 ` Hans Verkuil
2023-12-05 22:30 ` kernel test robot
2023-12-06 4:34 ` kernel test robot
2023-12-06 5:59 ` kernel test robot
2023-12-08 15:20 ` Laurent Pinchart
2023-12-13 4:06 ` Yunke Cao
2023-12-14 17:34 ` kernel test robot
2023-12-01 7:18 ` [PATCH v14 07/11] media: vivid: Add an rectangle control Yunke Cao
2023-12-01 7:18 ` [PATCH v14 08/11] media: uvcvideo: support V4L2_CTRL_WHICH_MIN/MAX_VAL Yunke Cao
2023-12-08 15:26 ` Laurent Pinchart
2023-12-01 7:19 ` [PATCH v14 09/11] media: uvcvideo: implement UVC v1.5 ROI Yunke Cao
2023-12-08 15:43 ` Laurent Pinchart
2024-03-14 13:24 ` Gergo Koteles
2023-12-01 7:19 ` [PATCH v14 10/11] media: uvcvideo: initilaize ROI control to default value Yunke Cao
2023-12-08 15:50 ` Laurent Pinchart
2023-12-01 7:19 ` [PATCH v14 11/11] media: uvcvideo: document UVC v1.5 ROI Yunke Cao
2023-12-08 16:00 ` Laurent Pinchart
2023-12-12 4:45 ` Yunke Cao
2023-12-18 3:44 ` Laurent Pinchart
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=20231212013707.GM27535@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=dan.scally@ideasonboard.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=ribalda@chromium.org \
--cc=senozhatsky@chromium.org \
--cc=tfiga@chromium.org \
--cc=yunkec@google.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