Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) .. c:namespace:: V4L
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) .. _VIDIOC_SUBDEV_G_CROP:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) ************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) ioctl VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) ************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) Name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) VIDIOC_SUBDEV_G_CROP - VIDIOC_SUBDEV_S_CROP - Get or set the crop rectangle on a subdev pad
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) Synopsis
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) .. c:macro:: VIDIOC_SUBDEV_G_CROP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) ``int ioctl(int fd, VIDIOC_SUBDEV_G_CROP, struct v4l2_subdev_crop *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) .. c:macro:: VIDIOC_SUBDEV_S_CROP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) ``int ioctl(int fd, VIDIOC_SUBDEV_S_CROP, const struct v4l2_subdev_crop *argp)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) Arguments
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) ``fd``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)     File descriptor returned by :c:func:`open()`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) ``argp``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)     Pointer to struct :c:type:`v4l2_subdev_crop`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) ===========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)     This is an :ref:`obsolete` interface and may be removed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)     in the future. It is superseded by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)     :ref:`the selection API <VIDIOC_SUBDEV_G_SELECTION>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) To retrieve the current crop rectangle applications set the ``pad``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) field of a struct :c:type:`v4l2_subdev_crop` to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) desired pad number as reported by the media API and the ``which`` field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) to ``V4L2_SUBDEV_FORMAT_ACTIVE``. They then call the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) ``VIDIOC_SUBDEV_G_CROP`` ioctl with a pointer to this structure. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) driver fills the members of the ``rect`` field or returns ``EINVAL`` error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) code if the input arguments are invalid, or if cropping is not supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) on the given pad.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) To change the current crop rectangle applications set both the ``pad``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) and ``which`` fields and all members of the ``rect`` field. They then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) call the ``VIDIOC_SUBDEV_S_CROP`` ioctl with a pointer to this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) structure. The driver verifies the requested crop rectangle, adjusts it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) based on the hardware capabilities and configures the device. Upon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) return the struct :c:type:`v4l2_subdev_crop`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) contains the current format as would be returned by a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) ``VIDIOC_SUBDEV_G_CROP`` call.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) Applications can query the device capabilities by setting the ``which``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) to ``V4L2_SUBDEV_FORMAT_TRY``. When set, 'try' crop rectangles are not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) applied to the device by the driver, but are mangled exactly as active
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) crop rectangles and stored in the sub-device file handle. Two
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) applications querying the same sub-device would thus not interact with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) each other.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) If the subdev device node has been registered in read-only mode, calls to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) ``VIDIOC_SUBDEV_S_CROP`` are only valid if the ``which`` field is set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) ``V4L2_SUBDEV_FORMAT_TRY``, otherwise an error is returned and the errno
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) variable is set to ``-EPERM``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) Drivers must not return an error solely because the requested crop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) rectangle doesn't match the device capabilities. They must instead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) modify the rectangle to match what the hardware can provide. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) modified format should be as close as possible to the original request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) .. c:type:: v4l2_subdev_crop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) .. flat-table:: struct v4l2_subdev_crop
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)     :header-rows:  0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)     :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)     :widths:       1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88)     * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89)       - ``pad``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)       - Pad number as reported by the media framework.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)     * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)       - ``which``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)       - Crop rectangle to get or set, from enum
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	:ref:`v4l2_subdev_format_whence <v4l2-subdev-format-whence>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)     * - struct :c:type:`v4l2_rect`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)       - ``rect``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97)       - Crop rectangle boundaries, in pixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98)     * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)       - ``reserved``\ [8]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)       - Reserved for future extensions. Applications and drivers must set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	the array to zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) Return Value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) ============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) On success 0 is returned, on error -1 and the ``errno`` variable is set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) appropriately. The generic error codes are described at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) :ref:`Generic Error Codes <gen-errors>` chapter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) EBUSY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)     The crop rectangle can't be changed because the pad is currently
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)     busy. This can be caused, for instance, by an active video stream on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)     the pad. The ioctl must not be retried without performing another
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)     action to fix the problem first. Only returned by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)     ``VIDIOC_SUBDEV_S_CROP``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) EINVAL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)     The struct :c:type:`v4l2_subdev_crop` ``pad``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)     references a non-existing pad, the ``which`` field references a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)     non-existing format, or cropping is not supported on the given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)     subdev pad.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) EPERM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)     The ``VIDIOC_SUBDEV_S_CROP`` ioctl has been called on a read-only subdevice
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)     and the ``which`` field is set to ``V4L2_SUBDEV_FORMAT_ACTIVE``.