1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _VIDIOC_SUBDEV_ENUM_FRAME_SIZE:
6 ***********************************
7 ioctl VIDIOC_SUBDEV_ENUM_FRAME_SIZE
8 ***********************************
13 VIDIOC_SUBDEV_ENUM_FRAME_SIZE - Enumerate media bus frame sizes
18 .. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_SIZE
20 ``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, struct v4l2_subdev_frame_size_enum * argp)``
26 File descriptor returned by :c:func:`open()`.
29 Pointer to struct :c:type:`v4l2_subdev_frame_size_enum`.
34 This ioctl allows applications to access the enumeration of frame sizes
35 supported by a sub-device on the specified pad
36 for the specified media bus format.
37 Supported formats can be retrieved with the
38 :ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE`
41 The enumerations are defined by the driver, and indexed using the ``index`` field
42 of the struct :c:type:`v4l2_subdev_frame_size_enum`.
43 Each pair of ``pad`` and ``code`` correspond to a separate enumeration.
44 Each enumeration starts with the ``index`` of 0, and
45 the lowest invalid index marks the end of the enumeration.
47 Therefore, to enumerate frame sizes allowed on the specified pad
48 and using the specified mbus format, initialize the
49 ``pad``, ``which``, and ``code`` fields to desired values,
50 and set ``index`` to 0.
51 Then call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_SIZE` ioctl with a pointer to the
54 A successful call will return with minimum and maximum frame sizes filled in.
55 Repeat with increasing ``index`` until ``EINVAL`` is received.
56 ``EINVAL`` means that either no more entries are available in the enumeration,
57 or that an input parameter was invalid.
59 Sub-devices that only support discrete frame sizes (such as most
60 sensors) will return one or more frame sizes with identical minimum and
63 Not all possible sizes in given [minimum, maximum] ranges need to be
64 supported. For instance, a scaler that uses a fixed-point scaling ratio
65 might not be able to produce every frame size between the minimum and
66 maximum values. Applications must use the
67 :ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>` ioctl to try the
68 sub-device for an exact supported frame size.
70 Available frame sizes may depend on the current 'try' formats at other
71 pads of the sub-device, as well as on the current active links and the
72 current values of V4L2 controls. See
73 :ref:`VIDIOC_SUBDEV_G_FMT` for more
74 information about try formats.
76 .. c:type:: v4l2_subdev_frame_size_enum
78 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
80 .. flat-table:: struct v4l2_subdev_frame_size_enum
87 - Index of the frame size in the enumeration belonging to the given pad
88 and format. Filled in by the application.
91 - Pad number as reported by the media controller API.
92 Filled in by the application.
95 - The media bus format code, as defined in
96 :ref:`v4l2-mbus-format`. Filled in by the application.
99 - Minimum frame width, in pixels. Filled in by the driver.
102 - Maximum frame width, in pixels. Filled in by the driver.
105 - Minimum frame height, in pixels. Filled in by the driver.
108 - Maximum frame height, in pixels. Filled in by the driver.
111 - Frame sizes to be enumerated, from enum
112 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
118 - Reserved for future extensions. Applications and drivers must set
124 On success 0 is returned, on error -1 and the ``errno`` variable is set
125 appropriately. The generic error codes are described at the
126 :ref:`Generic Error Codes <gen-errors>` chapter.
130 :c:type:`v4l2_subdev_frame_size_enum`
131 ``pad`` references a non-existing pad, the ``code`` is invalid for
132 the given pad or the ``index`` field is out of bounds.