kernel: bump 5.15 to 5.15.77
[openwrt/staging/ldir.git] / target / linux / bcm27xx / patches-5.15 / 950-0464-videodev2.h-add-V4L2_CTRL_FLAG_DYNAMIC_ARRAY.patch
1 From 1ef126fb69d37c6958a0b945365e532b500d43bd Mon Sep 17 00:00:00 2001
2 From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
3 Date: Wed, 14 Apr 2021 15:01:16 +0200
4 Subject: [PATCH] videodev2.h: add V4L2_CTRL_FLAG_DYNAMIC_ARRAY
5
6 Add a new flag that indicates that this control is a dynamically sized
7 array. Also document this flag.
8
9 Currently dynamically sized arrays are limited to one dimensional arrays,
10 but that might change in the future if there is a need for it.
11
12 The initial use-case of dynamic arrays are stateless codecs. A frame
13 can be divided in many slices, so you want to provide an array containing
14 slice information for each slice. Typically the number of slices is small,
15 but the standard allow for hundreds or thousands of slices. Dynamic arrays
16 are a good solution since sizing the array for the worst case would waste
17 substantial amounts of memory.
18
19 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
20 (cherry picked from commit c095ad310b223b9de38d491c9f66533d05586b45)
21 ---
22 .../userspace-api/media/v4l/vidioc-queryctrl.rst | 8 ++++++++
23 include/uapi/linux/videodev2.h | 1 +
24 2 files changed, 9 insertions(+)
25
26 --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
27 +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst
28 @@ -607,6 +607,14 @@ See also the examples in :ref:`control`.
29 ``V4L2_CTRL_FLAG_GRABBED`` flag when buffers are allocated or
30 streaming is in progress since most drivers do not support changing
31 the format in that case.
32 + * - ``V4L2_CTRL_FLAG_DYNAMIC_ARRAY``
33 + - 0x0800
34 + - This control is a dynamically sized 1-dimensional array. It
35 + behaves the same as a regular array, except that the number
36 + of elements as reported by the ``elems`` field is between 1 and
37 + ``dims[0]``. So setting the control with a differently sized
38 + array will change the ``elems`` field when the control is
39 + queried afterwards.
40
41 Return Value
42 ============
43 --- a/include/uapi/linux/videodev2.h
44 +++ b/include/uapi/linux/videodev2.h
45 @@ -1883,6 +1883,7 @@ struct v4l2_querymenu {
46 #define V4L2_CTRL_FLAG_HAS_PAYLOAD 0x0100
47 #define V4L2_CTRL_FLAG_EXECUTE_ON_WRITE 0x0200
48 #define V4L2_CTRL_FLAG_MODIFY_LAYOUT 0x0400
49 +#define V4L2_CTRL_FLAG_DYNAMIC_ARRAY 0x0800
50
51 /* Query flags, to be ORed with the control ID */
52 #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000