On Wed Jul 1 16:25:03 2026 +0200, Hans Verkuil wrote:
> 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 <[email protected]>
> Signed-off-by: Mauro Carvalho Chehab <[email protected]>

Patch committed.

Thanks,
Mauro Carvalho Chehab

 drivers/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,
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to