132 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2.. c:namespace:: V4L3 4.. _VIDIOC_SUBDEV_ENUM_FRAME_SIZE:5 6***********************************7ioctl VIDIOC_SUBDEV_ENUM_FRAME_SIZE8***********************************9 10Name11====12 13VIDIOC_SUBDEV_ENUM_FRAME_SIZE - Enumerate media bus frame sizes14 15Synopsis16========17 18.. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_SIZE19 20``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, struct v4l2_subdev_frame_size_enum * argp)``21 22Arguments23=========24 25``fd``26 File descriptor returned by :c:func:`open()`.27 28``argp``29 Pointer to struct :c:type:`v4l2_subdev_frame_size_enum`.30 31Description32===========33 34This ioctl allows applications to access the enumeration of frame sizes35supported by a sub-device on the specified pad36for the specified media bus format.37Supported formats can be retrieved with the38:ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE`39ioctl.40 41The enumerations are defined by the driver, and indexed using the ``index`` field42of the struct :c:type:`v4l2_subdev_frame_size_enum`.43Each pair of ``pad`` and ``code`` correspond to a separate enumeration.44Each enumeration starts with the ``index`` of 0, and45the lowest invalid index marks the end of the enumeration.46 47Therefore, to enumerate frame sizes allowed on the specified pad48and using the specified mbus format, initialize the49``pad``, ``which``, and ``code`` fields to desired values,50and set ``index`` to 0.51Then call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_SIZE` ioctl with a pointer to the52structure.53 54A successful call will return with minimum and maximum frame sizes filled in.55Repeat with increasing ``index`` until ``EINVAL`` is received.56``EINVAL`` means that either no more entries are available in the enumeration,57or that an input parameter was invalid.58 59Sub-devices that only support discrete frame sizes (such as most60sensors) will return one or more frame sizes with identical minimum and61maximum values.62 63Not all possible sizes in given [minimum, maximum] ranges need to be64supported. For instance, a scaler that uses a fixed-point scaling ratio65might not be able to produce every frame size between the minimum and66maximum values. Applications must use the67:ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>` ioctl to try the68sub-device for an exact supported frame size.69 70Available frame sizes may depend on the current 'try' formats at other71pads of the sub-device, as well as on the current active links and the72current values of V4L2 controls. See73:ref:`VIDIOC_SUBDEV_G_FMT` for more74information about try formats.75 76.. c:type:: v4l2_subdev_frame_size_enum77 78.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|79 80.. flat-table:: struct v4l2_subdev_frame_size_enum81 :header-rows: 082 :stub-columns: 083 :widths: 1 1 284 85 * - __u3286 - ``index``87 - Index of the frame size in the enumeration belonging to the given pad88 and format. Filled in by the application.89 * - __u3290 - ``pad``91 - Pad number as reported by the media controller API.92 Filled in by the application.93 * - __u3294 - ``code``95 - The media bus format code, as defined in96 :ref:`v4l2-mbus-format`. Filled in by the application.97 * - __u3298 - ``min_width``99 - Minimum frame width, in pixels. Filled in by the driver.100 * - __u32101 - ``max_width``102 - Maximum frame width, in pixels. Filled in by the driver.103 * - __u32104 - ``min_height``105 - Minimum frame height, in pixels. Filled in by the driver.106 * - __u32107 - ``max_height``108 - Maximum frame height, in pixels. Filled in by the driver.109 * - __u32110 - ``which``111 - Frame sizes to be enumerated, from enum112 :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.113 * - __u32114 - ``stream``115 - Stream identifier.116 * - __u32117 - ``reserved``\ [7]118 - Reserved for future extensions. Applications and drivers must set119 the array to zero.120 121Return Value122============123 124On success 0 is returned, on error -1 and the ``errno`` variable is set125appropriately. The generic error codes are described at the126:ref:`Generic Error Codes <gen-errors>` chapter.127 128EINVAL129 The struct :c:type:`v4l2_subdev_frame_size_enum` ``pad`` references a130 non-existing pad, the ``which`` field has an unsupported value, the ``code``131 is invalid for the given pad, or the ``index`` field is out of bounds.132