Add a enum_fmt format flag to specifically tag coded formats where
dynamic resolution switching is supported by the device.

This is useful for some codec drivers that can't support dynamic
resolution switching for all their listed coded formats. It allows
userspace to know whether it should extract the video parameters itself,
or if it can rely on the device to send V4L2_EVENT_SOURCE_CHANGE when
such changes are detected.

Signed-off-by: Maxime Jourdan <mjour...@baylibre.com>
---
 Documentation/media/uapi/v4l/vidioc-enum-fmt.rst | 7 +++++++
 include/uapi/linux/videodev2.h                   | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst 
b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
index 822d6730e7d2..92ddd4ddbce2 100644
--- a/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
+++ b/Documentation/media/uapi/v4l/vidioc-enum-fmt.rst
@@ -127,6 +127,13 @@ one until ``EINVAL`` is returned.
       - This format is not native to the device but emulated through
        software (usually libv4l2), where possible try to use a native
        format instead for better performance.
+    * - ``V4L2_FMT_FLAG_DYN_RESOLUTION``
+      - 0x0004
+      - Dynamic resolution switching is supported by the device for this
+       coded format. It will notify the user via the event
+       ``V4L2_EVENT_SOURCE_CHANGE`` when changes in the video parameters
+       are detected.
+
 
 
 Return Value
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 1050a75fb7ef..834550e20ee7 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -768,8 +768,9 @@ struct v4l2_fmtdesc {
        __u32               reserved[4];
 };
 
-#define V4L2_FMT_FLAG_COMPRESSED 0x0001
-#define V4L2_FMT_FLAG_EMULATED   0x0002
+#define V4L2_FMT_FLAG_COMPRESSED       0x0001
+#define V4L2_FMT_FLAG_EMULATED         0x0002
+#define V4L2_FMT_FLAG_DYN_RESOLUTION   0x0004
 
        /* Frame Size and frame rate enumeration */
 /*
-- 
2.21.0

Reply via email to