From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH] media: vivid: always allow meta output streaming
Date: Wed, 1 Jul 2026 16:25:03 +0200 [thread overview]
Message-ID: <48124a09-873d-4f24-a6ad-523aba7cfa98@kernel.org> (raw)
The vivid metadata output emulation only works if the
video input is configured for a webcam. That makes no sense,
and it is in fact a copy-and-paste from the metadata capture
support.
Always allow metadata output, just make sure that when the
metadata is processed it only sets the brightness/saturation/
hue/contrast controls if they have been defined: if vivid was
instantiation without video capture support, then those controls
are missing.
This change ensures that the test-media regression script correctly
tests metadata output streaming.
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
---
.../media/test-drivers/vivid/vivid-meta-out.c | 23 +++++--------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/media/test-drivers/vivid/vivid-meta-out.c b/drivers/media/test-drivers/vivid/vivid-meta-out.c
index 55e5e5dec2f2..ca913b808225 100644
--- a/drivers/media/test-drivers/vivid/vivid-meta-out.c
+++ b/drivers/media/test-drivers/vivid/vivid-meta-out.c
@@ -17,12 +17,8 @@ static int meta_out_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
unsigned int *nplanes, unsigned int sizes[],
struct device *alloc_devs[])
{
- struct vivid_dev *dev = vb2_get_drv_priv(vq);
unsigned int size = sizeof(struct vivid_meta_out_buf);
- if (!vivid_is_webcam(dev))
- return -EINVAL;
-
if (*nplanes) {
if (sizes[0] < size)
return -EINVAL;
@@ -127,11 +123,6 @@ const struct vb2_ops vivid_meta_out_qops = {
int vidioc_enum_fmt_meta_out(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
- struct vivid_dev *dev = video_drvdata(file);
-
- if (!vivid_is_webcam(dev))
- return -EINVAL;
-
if (f->index > 0)
return -EINVAL;
@@ -143,12 +134,8 @@ int vidioc_enum_fmt_meta_out(struct file *file, void *priv,
int vidioc_g_fmt_meta_out(struct file *file, void *priv,
struct v4l2_format *f)
{
- struct vivid_dev *dev = video_drvdata(file);
struct v4l2_meta_format *meta = &f->fmt.meta;
- if (!vivid_is_webcam(dev) || !dev->has_meta_out)
- return -EINVAL;
-
meta->dataformat = V4L2_META_FMT_VIVID;
meta->buffersize = sizeof(struct vivid_meta_out_buf);
return 0;
@@ -159,10 +146,12 @@ void vivid_meta_out_process(struct vivid_dev *dev,
{
struct vivid_meta_out_buf *meta = vb2_plane_vaddr(&buf->vb.vb2_buf, 0);
- v4l2_ctrl_s_ctrl(dev->brightness, meta->brightness);
- v4l2_ctrl_s_ctrl(dev->contrast, meta->contrast);
- v4l2_ctrl_s_ctrl(dev->saturation, meta->saturation);
- v4l2_ctrl_s_ctrl(dev->hue, meta->hue);
+ if (dev->brightness) {
+ v4l2_ctrl_s_ctrl(dev->brightness, meta->brightness);
+ v4l2_ctrl_s_ctrl(dev->contrast, meta->contrast);
+ v4l2_ctrl_s_ctrl(dev->saturation, meta->saturation);
+ v4l2_ctrl_s_ctrl(dev->hue, meta->hue);
+ }
dprintk(dev, 2, " %s brightness %u contrast %u saturation %u hue %d\n",
__func__, meta->brightness, meta->contrast,
--
2.53.0
reply other threads:[~2026-07-01 14:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=48124a09-873d-4f24-a6ad-523aba7cfa98@kernel.org \
--to=hverkuil+cisco@kernel.org \
--cc=linux-media@vger.kernel.org \
/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.