From: Hans de Goede <hansg@kernel.org>
To: Ricardo Ribalda <ribalda@chromium.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Yunke Cao <yunkec@google.com>
Subject: Re: [PATCH 2/3] media: uvcvideo: uvc_queue_to_stream(): Support meta queues
Date: Mon, 16 Mar 2026 12:49:46 +0100 [thread overview]
Message-ID: <656a9f49-e316-4ccd-afe7-1966719ab85b@kernel.org> (raw)
In-Reply-To: <20260309-uvc-metadata-dmabuf-v1-2-fc8b87bd29c5@chromium.org>
Hi,
On 9-Mar-26 4:01 PM, Ricardo Ribalda wrote:
> The stream data structure has two queues: the metadata and the data
> queues, but uvc_queue_to_stream() only supports the data queue. If we
> pass the metadata queue the function will return an invalid pointer.
>
> This patch add a parameter to the function to explicitly tell the
> function which queue are we using.
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Regards,
Hans
> ---
> drivers/media/usb/uvc/uvc_isight.c | 3 ++-
> drivers/media/usb/uvc/uvc_queue.c | 13 ++++++-------
> drivers/media/usb/uvc/uvcvideo.h | 4 +++-
> 3 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_isight.c b/drivers/media/usb/uvc/uvc_isight.c
> index 43cda5e760a3..ea9dc31dfbad 100644
> --- a/drivers/media/usb/uvc/uvc_isight.c
> +++ b/drivers/media/usb/uvc/uvc_isight.c
> @@ -41,7 +41,8 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,
> 0xde, 0xad, 0xfa, 0xce
> };
>
> - struct uvc_streaming *stream = uvc_queue_to_stream(queue);
> + struct uvc_streaming *stream = uvc_queue_to_stream(queue,
> + V4L2_BUF_TYPE_VIDEO_CAPTURE);
> unsigned int maxlen, nbytes;
> u8 *mem;
> int is_header = 0;
> diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c
> index 0eddd4f872ca..68ed2883edb2 100644
> --- a/drivers/media/usb/uvc/uvc_queue.c
> +++ b/drivers/media/usb/uvc/uvc_queue.c
> @@ -78,7 +78,7 @@ static int uvc_queue_setup(struct vb2_queue *vq,
> unsigned int sizes[], struct device *alloc_devs[])
> {
> struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
> - struct uvc_streaming *stream;
> + struct uvc_streaming *stream = uvc_queue_to_stream(queue, vq->type);
> unsigned int size;
>
> switch (vq->type) {
> @@ -87,7 +87,6 @@ static int uvc_queue_setup(struct vb2_queue *vq,
> break;
>
> default:
> - stream = uvc_queue_to_stream(queue);
> size = stream->ctrl.dwMaxVideoFrameSize;
> break;
> }
> @@ -113,7 +112,7 @@ static int uvc_buffer_prepare(struct vb2_buffer *vb)
>
> if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
> vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) {
> - uvc_dbg(uvc_queue_to_stream(queue)->dev, CAPTURE,
> + uvc_dbg(uvc_queue_to_stream(queue, vb->type)->dev, CAPTURE,
> "[E] Bytes used out of bounds\n");
> return -EINVAL;
> }
> @@ -160,7 +159,7 @@ static void uvc_buffer_finish(struct vb2_buffer *vb)
> {
> struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
> struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue);
> - struct uvc_streaming *stream = uvc_queue_to_stream(queue);
> + struct uvc_streaming *stream = uvc_queue_to_stream(queue, vb->type);
> struct uvc_buffer *buf = uvc_vbuf_to_buffer(vbuf);
>
> if (vb->state == VB2_BUF_STATE_DONE)
> @@ -170,7 +169,7 @@ static void uvc_buffer_finish(struct vb2_buffer *vb)
> static int uvc_start_streaming_video(struct vb2_queue *vq, unsigned int count)
> {
> struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
> - struct uvc_streaming *stream = uvc_queue_to_stream(queue);
> + struct uvc_streaming *stream = uvc_queue_to_stream(queue, vq->type);
> int ret;
>
> lockdep_assert_irqs_enabled();
> @@ -197,11 +196,11 @@ static int uvc_start_streaming_video(struct vb2_queue *vq, unsigned int count)
> static void uvc_stop_streaming_video(struct vb2_queue *vq)
> {
> struct uvc_video_queue *queue = vb2_get_drv_priv(vq);
> - struct uvc_streaming *stream = uvc_queue_to_stream(queue);
> + struct uvc_streaming *stream = uvc_queue_to_stream(queue, vq->type);
>
> lockdep_assert_irqs_enabled();
>
> - uvc_video_stop_streaming(uvc_queue_to_stream(queue));
> + uvc_video_stop_streaming(stream);
>
> uvc_pm_put(stream->dev);
>
> diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h
> index 8480d65ecb85..9b4849fda12f 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -703,8 +703,10 @@ static inline int uvc_queue_streaming(struct uvc_video_queue *queue)
> }
>
> static inline struct uvc_streaming *
> -uvc_queue_to_stream(struct uvc_video_queue *queue)
> +uvc_queue_to_stream(struct uvc_video_queue *queue, unsigned int type)
> {
> + if (type == V4L2_BUF_TYPE_META_CAPTURE)
> + return container_of(queue, struct uvc_streaming, meta.queue);
> return container_of(queue, struct uvc_streaming, queue);
> }
>
>
next prev parent reply other threads:[~2026-03-16 11:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 15:01 [PATCH 0/3] media: uvcvideo: Improvements for UVC metadata Ricardo Ribalda
2026-03-09 15:01 ` [PATCH 1/3] media: uvcvideo: Enable VB2_DMABUF for metadata stream Ricardo Ribalda
2026-03-16 11:47 ` Hans de Goede
2026-03-18 19:15 ` Laurent Pinchart
2026-03-09 15:01 ` [PATCH 2/3] media: uvcvideo: uvc_queue_to_stream(): Support meta queues Ricardo Ribalda
2026-03-16 11:49 ` Hans de Goede [this message]
2026-03-18 19:18 ` Laurent Pinchart
2026-03-09 15:01 ` [PATCH 3/3] media: uvcvideo: Allow userspace to increase the meta buffersize Ricardo Ribalda
2026-03-16 11:53 ` Hans de Goede
2026-03-18 19:22 ` Laurent Pinchart
2026-03-18 19:29 ` Ricardo Ribalda
2026-03-18 19:36 ` Laurent Pinchart
2026-03-16 12:05 ` [PATCH 0/3] media: uvcvideo: Improvements for UVC metadata Hans de Goede
2026-03-18 19:23 ` Laurent Pinchart
2026-03-18 20:22 ` [PATCH] media: uvcvideo: Add a stream backpointer in uvc_video_queue Ricardo Ribalda
2026-03-23 22:34 ` 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=656a9f49-e316-4ccd-afe7-1966719ab85b@kernel.org \
--to=hansg@kernel.org \
--cc=guennadi.liakhovetski@intel.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=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