162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci.. c:namespace:: V4L 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci.. _VIDIOC_SUBDEV_ENUM_FRAME_SIZE: 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci*********************************** 762306a36Sopenharmony_ciioctl VIDIOC_SUBDEV_ENUM_FRAME_SIZE 862306a36Sopenharmony_ci*********************************** 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ciName 1162306a36Sopenharmony_ci==== 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciVIDIOC_SUBDEV_ENUM_FRAME_SIZE - Enumerate media bus frame sizes 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ciSynopsis 1662306a36Sopenharmony_ci======== 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci.. c:macro:: VIDIOC_SUBDEV_ENUM_FRAME_SIZE 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci``int ioctl(int fd, VIDIOC_SUBDEV_ENUM_FRAME_SIZE, struct v4l2_subdev_frame_size_enum * argp)`` 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciArguments 2362306a36Sopenharmony_ci========= 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci``fd`` 2662306a36Sopenharmony_ci File descriptor returned by :c:func:`open()`. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci``argp`` 2962306a36Sopenharmony_ci Pointer to struct :c:type:`v4l2_subdev_frame_size_enum`. 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciDescription 3262306a36Sopenharmony_ci=========== 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ciThis ioctl allows applications to access the enumeration of frame sizes 3562306a36Sopenharmony_cisupported by a sub-device on the specified pad 3662306a36Sopenharmony_cifor the specified media bus format. 3762306a36Sopenharmony_ciSupported formats can be retrieved with the 3862306a36Sopenharmony_ci:ref:`VIDIOC_SUBDEV_ENUM_MBUS_CODE` 3962306a36Sopenharmony_ciioctl. 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ciThe enumerations are defined by the driver, and indexed using the ``index`` field 4262306a36Sopenharmony_ciof the struct :c:type:`v4l2_subdev_frame_size_enum`. 4362306a36Sopenharmony_ciEach pair of ``pad`` and ``code`` correspond to a separate enumeration. 4462306a36Sopenharmony_ciEach enumeration starts with the ``index`` of 0, and 4562306a36Sopenharmony_cithe lowest invalid index marks the end of the enumeration. 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ciTherefore, to enumerate frame sizes allowed on the specified pad 4862306a36Sopenharmony_ciand using the specified mbus format, initialize the 4962306a36Sopenharmony_ci``pad``, ``which``, and ``code`` fields to desired values, 5062306a36Sopenharmony_ciand set ``index`` to 0. 5162306a36Sopenharmony_ciThen call the :ref:`VIDIOC_SUBDEV_ENUM_FRAME_SIZE` ioctl with a pointer to the 5262306a36Sopenharmony_cistructure. 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciA successful call will return with minimum and maximum frame sizes filled in. 5562306a36Sopenharmony_ciRepeat with increasing ``index`` until ``EINVAL`` is received. 5662306a36Sopenharmony_ci``EINVAL`` means that either no more entries are available in the enumeration, 5762306a36Sopenharmony_cior that an input parameter was invalid. 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ciSub-devices that only support discrete frame sizes (such as most 6062306a36Sopenharmony_cisensors) will return one or more frame sizes with identical minimum and 6162306a36Sopenharmony_cimaximum values. 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ciNot all possible sizes in given [minimum, maximum] ranges need to be 6462306a36Sopenharmony_cisupported. For instance, a scaler that uses a fixed-point scaling ratio 6562306a36Sopenharmony_cimight not be able to produce every frame size between the minimum and 6662306a36Sopenharmony_cimaximum values. Applications must use the 6762306a36Sopenharmony_ci:ref:`VIDIOC_SUBDEV_S_FMT <VIDIOC_SUBDEV_G_FMT>` ioctl to try the 6862306a36Sopenharmony_cisub-device for an exact supported frame size. 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ciAvailable frame sizes may depend on the current 'try' formats at other 7162306a36Sopenharmony_cipads of the sub-device, as well as on the current active links and the 7262306a36Sopenharmony_cicurrent values of V4L2 controls. See 7362306a36Sopenharmony_ci:ref:`VIDIOC_SUBDEV_G_FMT` for more 7462306a36Sopenharmony_ciinformation about try formats. 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci.. c:type:: v4l2_subdev_frame_size_enum 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}| 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci.. flat-table:: struct v4l2_subdev_frame_size_enum 8162306a36Sopenharmony_ci :header-rows: 0 8262306a36Sopenharmony_ci :stub-columns: 0 8362306a36Sopenharmony_ci :widths: 1 1 2 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci * - __u32 8662306a36Sopenharmony_ci - ``index`` 8762306a36Sopenharmony_ci - Index of the frame size in the enumeration belonging to the given pad 8862306a36Sopenharmony_ci and format. Filled in by the application. 8962306a36Sopenharmony_ci * - __u32 9062306a36Sopenharmony_ci - ``pad`` 9162306a36Sopenharmony_ci - Pad number as reported by the media controller API. 9262306a36Sopenharmony_ci Filled in by the application. 9362306a36Sopenharmony_ci * - __u32 9462306a36Sopenharmony_ci - ``code`` 9562306a36Sopenharmony_ci - The media bus format code, as defined in 9662306a36Sopenharmony_ci :ref:`v4l2-mbus-format`. Filled in by the application. 9762306a36Sopenharmony_ci * - __u32 9862306a36Sopenharmony_ci - ``min_width`` 9962306a36Sopenharmony_ci - Minimum frame width, in pixels. Filled in by the driver. 10062306a36Sopenharmony_ci * - __u32 10162306a36Sopenharmony_ci - ``max_width`` 10262306a36Sopenharmony_ci - Maximum frame width, in pixels. Filled in by the driver. 10362306a36Sopenharmony_ci * - __u32 10462306a36Sopenharmony_ci - ``min_height`` 10562306a36Sopenharmony_ci - Minimum frame height, in pixels. Filled in by the driver. 10662306a36Sopenharmony_ci * - __u32 10762306a36Sopenharmony_ci - ``max_height`` 10862306a36Sopenharmony_ci - Maximum frame height, in pixels. Filled in by the driver. 10962306a36Sopenharmony_ci * - __u32 11062306a36Sopenharmony_ci - ``which`` 11162306a36Sopenharmony_ci - Frame sizes to be enumerated, from enum 11262306a36Sopenharmony_ci :ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`. 11362306a36Sopenharmony_ci * - __u32 11462306a36Sopenharmony_ci - ``stream`` 11562306a36Sopenharmony_ci - Stream identifier. 11662306a36Sopenharmony_ci * - __u32 11762306a36Sopenharmony_ci - ``reserved``\ [7] 11862306a36Sopenharmony_ci - Reserved for future extensions. Applications and drivers must set 11962306a36Sopenharmony_ci the array to zero. 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ciReturn Value 12262306a36Sopenharmony_ci============ 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set 12562306a36Sopenharmony_ciappropriately. The generic error codes are described at the 12662306a36Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter. 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ciEINVAL 12962306a36Sopenharmony_ci The struct 13062306a36Sopenharmony_ci :c:type:`v4l2_subdev_frame_size_enum` 13162306a36Sopenharmony_ci ``pad`` references a non-existing pad, the ``code`` is invalid for 13262306a36Sopenharmony_ci the given pad or the ``index`` field is out of bounds. 133