This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: utils/common: Set V4L2_SUBDEV_CLIENT_CAP_STREAMS for subdevs
Author:  Tomi Valkeinen <[email protected]>
Date:    Tue Aug 8 09:19:26 2023 +0300

Use the new VIDIOC_SUBDEV_S_CLIENT_CAP ioctl to inform the kernel that
we support streams, and use the return values of
VIDIOC_SUBDEV_S_CLIENT_CAP and VIDIOC_SUBDEV_QUERYCAP to decide if the
entity supports streams.

Signed-off-by: Tomi Valkeinen <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>

 utils/common/cv4l-helpers.h |  1 +
 utils/common/v4l-helpers.h  | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=467b4e0e45f3198930bfac376afe16336704c38d
diff --git a/utils/common/cv4l-helpers.h b/utils/common/cv4l-helpers.h
index 3cee372b145f..91a04146cea1 100644
--- a/utils/common/cv4l-helpers.h
+++ b/utils/common/cv4l-helpers.h
@@ -82,6 +82,7 @@ public:
        bool has_rw() const { return v4l_has_rw(this); }
        bool has_streaming() const { return v4l_has_streaming(this); }
        bool has_ext_pix_format() const { return v4l_has_ext_pix_format(this); }
+       bool has_streams() const { return have_streams; }
 
        int querycap(v4l2_capability &cap, bool force = false)
        {
diff --git a/utils/common/v4l-helpers.h b/utils/common/v4l-helpers.h
index c09cd987d2dd..f8e96d58530e 100644
--- a/utils/common/v4l-helpers.h
+++ b/utils/common/v4l-helpers.h
@@ -9,6 +9,7 @@
 #ifndef _V4L_HELPERS_H_
 #define _V4L_HELPERS_H_
 
+#include <linux/v4l2-subdev.h>
 #include <linux/videodev2.h>
 #include <string.h>
 #include <stdlib.h>
@@ -39,6 +40,7 @@ struct v4l_fd {
        bool have_selection;
        bool is_subdev;
        bool is_media;
+       bool have_streams;
 
        int (*open)(struct v4l_fd *f, const char *file, int oflag, ...);
        int (*close)(struct v4l_fd *f);
@@ -507,6 +509,12 @@ static inline int v4l_open(struct v4l_fd *f, const char 
*devname, bool non_block
 
 static inline int v4l_subdev_s_fd(struct v4l_fd *f, int fd, const char 
*devname)
 {
+       struct v4l2_subdev_client_capability clientcap = {};
+       struct v4l2_subdev_capability subdevcap = {};
+       bool subdev_streams;
+       bool client_streams;
+       int ret;
+
        if (f->fd >= 0)
                f->close(f);
 
@@ -528,6 +536,16 @@ static inline int v4l_subdev_s_fd(struct v4l_fd *f, int 
fd, const char *devname)
        f->have_next_ctrl = false;
        f->have_selection = false;
 
+       ret = ioctl(f->fd, VIDIOC_SUBDEV_QUERYCAP, &subdevcap);
+       subdev_streams = !ret && (subdevcap.capabilities & 
V4L2_SUBDEV_CAP_STREAMS);
+
+       clientcap.capabilities = V4L2_SUBDEV_CLIENT_CAP_STREAMS;
+
+       ret = ioctl(f->fd, VIDIOC_SUBDEV_S_CLIENT_CAP, &clientcap);
+       client_streams = !ret && (clientcap.capabilities & 
V4L2_SUBDEV_CLIENT_CAP_STREAMS);
+
+       f->have_streams = subdev_streams && client_streams;
+
        return f->fd;
 }
 

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to