18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _overlay:
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci***********************
68c2ecf20Sopenharmony_ciVideo Overlay Interface
78c2ecf20Sopenharmony_ci***********************
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci**Also known as Framebuffer Overlay or Previewing.**
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciVideo overlay devices have the ability to genlock (TV-)video into the
128c2ecf20Sopenharmony_ci(VGA-)video signal of a graphics card, or to store captured images
138c2ecf20Sopenharmony_cidirectly in video memory of a graphics card, typically with clipping.
148c2ecf20Sopenharmony_ciThis can be considerable more efficient than capturing images and
158c2ecf20Sopenharmony_cidisplaying them by other means. In the old days when only nuclear power
168c2ecf20Sopenharmony_ciplants needed cooling towers this used to be the only way to put live
178c2ecf20Sopenharmony_civideo into a window.
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciVideo overlay devices are accessed through the same character special
208c2ecf20Sopenharmony_cifiles as :ref:`video capture <capture>` devices.
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci.. note::
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci   The default function of a ``/dev/video`` device is video
258c2ecf20Sopenharmony_ci   capturing. The overlay function is only available after calling
268c2ecf20Sopenharmony_ci   the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciThe driver may support simultaneous overlay and capturing using the
298c2ecf20Sopenharmony_ciread/write and streaming I/O methods. If so, operation at the nominal
308c2ecf20Sopenharmony_ciframe rate of the video standard is not guaranteed. Frames may be
318c2ecf20Sopenharmony_cidirected away from overlay to capture, or one field may be used for
328c2ecf20Sopenharmony_cioverlay and the other for capture if the capture parameters permit this.
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciApplications should use different file descriptors for capturing and
358c2ecf20Sopenharmony_cioverlay. This must be supported by all drivers capable of simultaneous
368c2ecf20Sopenharmony_cicapturing and overlay. Optionally these drivers may also permit
378c2ecf20Sopenharmony_cicapturing and overlay with a single file descriptor for compatibility
388c2ecf20Sopenharmony_ciwith V4L and earlier versions of V4L2. [#f1]_
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciQuerying Capabilities
428c2ecf20Sopenharmony_ci=====================
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ciDevices supporting the video overlay interface set the
458c2ecf20Sopenharmony_ci``V4L2_CAP_VIDEO_OVERLAY`` flag in the ``capabilities`` field of struct
468c2ecf20Sopenharmony_ci:c:type:`v4l2_capability` returned by the
478c2ecf20Sopenharmony_ci:ref:`VIDIOC_QUERYCAP` ioctl. The overlay I/O
488c2ecf20Sopenharmony_cimethod specified below must be supported. Tuners and audio inputs are
498c2ecf20Sopenharmony_cioptional.
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciSupplemental Functions
538c2ecf20Sopenharmony_ci======================
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciVideo overlay devices shall support :ref:`audio input <audio>`,
568c2ecf20Sopenharmony_ci:ref:`tuner`, :ref:`controls <control>`,
578c2ecf20Sopenharmony_ci:ref:`cropping and scaling <crop>` and
588c2ecf20Sopenharmony_ci:ref:`streaming parameter <streaming-par>` ioctls as needed. The
598c2ecf20Sopenharmony_ci:ref:`video input <video>` and :ref:`video standard <standard>`
608c2ecf20Sopenharmony_ciioctls must be supported by all video overlay devices.
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciSetup
648c2ecf20Sopenharmony_ci=====
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciBefore overlay can commence applications must program the driver with
678c2ecf20Sopenharmony_ciframe buffer parameters, namely the address and size of the frame buffer
688c2ecf20Sopenharmony_ciand the image format, for example RGB 5:6:5. The
698c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` and
708c2ecf20Sopenharmony_ci:ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` ioctls are available to get and
718c2ecf20Sopenharmony_ciset these parameters, respectively. The :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` ioctl is
728c2ecf20Sopenharmony_ciprivileged because it allows to set up DMA into physical memory,
738c2ecf20Sopenharmony_cibypassing the memory protection mechanisms of the kernel. Only the
748c2ecf20Sopenharmony_cisuperuser can change the frame buffer address and size. Users are not
758c2ecf20Sopenharmony_cisupposed to run TV applications as root or with SUID bit set. A small
768c2ecf20Sopenharmony_cihelper application with suitable privileges should query the graphics
778c2ecf20Sopenharmony_cisystem and program the V4L2 driver at the appropriate time.
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciSome devices add the video overlay to the output signal of the graphics
808c2ecf20Sopenharmony_cicard. In this case the frame buffer is not modified by the video device,
818c2ecf20Sopenharmony_ciand the frame buffer address and pixel format are not needed by the
828c2ecf20Sopenharmony_cidriver. The :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` ioctl is not privileged. An application
838c2ecf20Sopenharmony_cican check for this type of device by calling the :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`
848c2ecf20Sopenharmony_ciioctl.
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ciA driver may support any (or none) of five clipping/blending methods:
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci1. Chroma-keying displays the overlaid image only where pixels in the
898c2ecf20Sopenharmony_ci   primary graphics surface assume a certain color.
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci2. A bitmap can be specified where each bit corresponds to a pixel in
928c2ecf20Sopenharmony_ci   the overlaid image. When the bit is set, the corresponding video
938c2ecf20Sopenharmony_ci   pixel is displayed, otherwise a pixel of the graphics surface.
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci3. A list of clipping rectangles can be specified. In these regions *no*
968c2ecf20Sopenharmony_ci   video is displayed, so the graphics surface can be seen here.
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci4. The framebuffer has an alpha channel that can be used to clip or
998c2ecf20Sopenharmony_ci   blend the framebuffer with the video.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci5. A global alpha value can be specified to blend the framebuffer
1028c2ecf20Sopenharmony_ci   contents with video images.
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ciWhen simultaneous capturing and overlay is supported and the hardware
1058c2ecf20Sopenharmony_ciprohibits different image and frame buffer formats, the format requested
1068c2ecf20Sopenharmony_cifirst takes precedence. The attempt to capture
1078c2ecf20Sopenharmony_ci(:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`) or overlay
1088c2ecf20Sopenharmony_ci(:ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>`) may fail with an ``EBUSY`` error
1098c2ecf20Sopenharmony_cicode or return accordingly modified parameters..
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciOverlay Window
1138c2ecf20Sopenharmony_ci==============
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ciThe overlaid image is determined by cropping and overlay window
1168c2ecf20Sopenharmony_ciparameters. The former select an area of the video picture to capture,
1178c2ecf20Sopenharmony_cithe latter how images are overlaid and clipped. Cropping initialization
1188c2ecf20Sopenharmony_ciat minimum requires to reset the parameters to defaults. An example is
1198c2ecf20Sopenharmony_cigiven in :ref:`crop`.
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ciThe overlay window is described by a struct
1228c2ecf20Sopenharmony_ci:c:type:`v4l2_window`. It defines the size of the image,
1238c2ecf20Sopenharmony_ciits position over the graphics surface and the clipping to be applied.
1248c2ecf20Sopenharmony_ciTo get the current parameters applications set the ``type`` field of a
1258c2ecf20Sopenharmony_cistruct :c:type:`v4l2_format` to
1268c2ecf20Sopenharmony_ci``V4L2_BUF_TYPE_VIDEO_OVERLAY`` and call the
1278c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` ioctl. The driver fills the
1288c2ecf20Sopenharmony_cistruct :c:type:`v4l2_window` substructure named ``win``. It is not
1298c2ecf20Sopenharmony_cipossible to retrieve a previously programmed clipping list or bitmap.
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ciTo program the overlay window applications set the ``type`` field of a
1328c2ecf20Sopenharmony_cistruct :c:type:`v4l2_format` to
1338c2ecf20Sopenharmony_ci``V4L2_BUF_TYPE_VIDEO_OVERLAY``, initialize the ``win`` substructure and
1348c2ecf20Sopenharmony_cicall the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl. The driver
1358c2ecf20Sopenharmony_ciadjusts the parameters against hardware limits and returns the actual
1368c2ecf20Sopenharmony_ciparameters as :ref:`VIDIOC_G_FMT <VIDIOC_G_FMT>` does. Like :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`, the
1378c2ecf20Sopenharmony_ci:ref:`VIDIOC_TRY_FMT <VIDIOC_G_FMT>` ioctl can be used to learn
1388c2ecf20Sopenharmony_ciabout driver capabilities without actually changing driver state. Unlike
1398c2ecf20Sopenharmony_ci:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` this also works after the overlay has been enabled.
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ciThe scaling factor of the overlaid image is implied by the width and
1428c2ecf20Sopenharmony_ciheight given in struct :c:type:`v4l2_window` and the size
1438c2ecf20Sopenharmony_ciof the cropping rectangle. For more information see :ref:`crop`.
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ciWhen simultaneous capturing and overlay is supported and the hardware
1468c2ecf20Sopenharmony_ciprohibits different image and window sizes, the size requested first
1478c2ecf20Sopenharmony_citakes precedence. The attempt to capture or overlay as well
1488c2ecf20Sopenharmony_ci(:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`) may fail with an ``EBUSY`` error
1498c2ecf20Sopenharmony_cicode or return accordingly modified parameters.
1508c2ecf20Sopenharmony_ci
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci.. c:type:: v4l2_window
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_cistruct v4l2_window
1558c2ecf20Sopenharmony_ci------------------
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci``struct v4l2_rect w``
1588c2ecf20Sopenharmony_ci    Size and position of the window relative to the top, left corner of
1598c2ecf20Sopenharmony_ci    the frame buffer defined with
1608c2ecf20Sopenharmony_ci    :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>`. The window can extend the
1618c2ecf20Sopenharmony_ci    frame buffer width and height, the ``x`` and ``y`` coordinates can
1628c2ecf20Sopenharmony_ci    be negative, and it can lie completely outside the frame buffer. The
1638c2ecf20Sopenharmony_ci    driver clips the window accordingly, or if that is not possible,
1648c2ecf20Sopenharmony_ci    modifies its size and/or position.
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci``enum v4l2_field field``
1678c2ecf20Sopenharmony_ci    Applications set this field to determine which video field shall be
1688c2ecf20Sopenharmony_ci    overlaid, typically one of ``V4L2_FIELD_ANY`` (0),
1698c2ecf20Sopenharmony_ci    ``V4L2_FIELD_TOP``, ``V4L2_FIELD_BOTTOM`` or
1708c2ecf20Sopenharmony_ci    ``V4L2_FIELD_INTERLACED``. Drivers may have to choose a different
1718c2ecf20Sopenharmony_ci    field order and return the actual setting here.
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci``__u32 chromakey``
1748c2ecf20Sopenharmony_ci    When chroma-keying has been negotiated with
1758c2ecf20Sopenharmony_ci    :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` applications set this field
1768c2ecf20Sopenharmony_ci    to the desired pixel value for the chroma key. The format is the
1778c2ecf20Sopenharmony_ci    same as the pixel format of the framebuffer (struct
1788c2ecf20Sopenharmony_ci    :c:type:`v4l2_framebuffer` ``fmt.pixelformat``
1798c2ecf20Sopenharmony_ci    field), with bytes in host order. E. g. for
1808c2ecf20Sopenharmony_ci    :ref:`V4L2_PIX_FMT_BGR24 <V4L2-PIX-FMT-BGR32>` the value should
1818c2ecf20Sopenharmony_ci    be 0xRRGGBB on a little endian, 0xBBGGRR on a big endian host.
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci``struct v4l2_clip * clips``
1848c2ecf20Sopenharmony_ci    When chroma-keying has *not* been negotiated and
1858c2ecf20Sopenharmony_ci    :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` indicated this capability,
1868c2ecf20Sopenharmony_ci    applications can set this field to point to an array of clipping
1878c2ecf20Sopenharmony_ci    rectangles.
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci    Like the window coordinates w, clipping rectangles are defined
1908c2ecf20Sopenharmony_ci    relative to the top, left corner of the frame buffer. However
1918c2ecf20Sopenharmony_ci    clipping rectangles must not extend the frame buffer width and
1928c2ecf20Sopenharmony_ci    height, and they must not overlap. If possible applications
1938c2ecf20Sopenharmony_ci    should merge adjacent rectangles. Whether this must create
1948c2ecf20Sopenharmony_ci    x-y or y-x bands, or the order of rectangles, is not defined. When
1958c2ecf20Sopenharmony_ci    clip lists are not supported the driver ignores this field. Its
1968c2ecf20Sopenharmony_ci    contents after calling :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`
1978c2ecf20Sopenharmony_ci    are undefined.
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci``__u32 clipcount``
2008c2ecf20Sopenharmony_ci    When the application set the ``clips`` field, this field must
2018c2ecf20Sopenharmony_ci    contain the number of clipping rectangles in the list. When clip
2028c2ecf20Sopenharmony_ci    lists are not supported the driver ignores this field, its contents
2038c2ecf20Sopenharmony_ci    after calling :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` are undefined. When clip lists are
2048c2ecf20Sopenharmony_ci    supported but no clipping is desired this field must be set to zero.
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci``void * bitmap``
2078c2ecf20Sopenharmony_ci    When chroma-keying has *not* been negotiated and
2088c2ecf20Sopenharmony_ci    :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` indicated this capability,
2098c2ecf20Sopenharmony_ci    applications can set this field to point to a clipping bit mask.
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ciIt must be of the same size as the window, ``w.width`` and ``w.height``.
2128c2ecf20Sopenharmony_ciEach bit corresponds to a pixel in the overlaid image, which is
2138c2ecf20Sopenharmony_cidisplayed only when the bit is *set*. Pixel coordinates translate to
2148c2ecf20Sopenharmony_cibits like:
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci.. code-block:: c
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci    ((__u8 *) bitmap)[w.width * y + x / 8] & (1 << (x & 7))
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ciwhere ``0`` ≤ x < ``w.width`` and ``0`` ≤ y <``w.height``. [#f2]_
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ciWhen a clipping bit mask is not supported the driver ignores this field,
2248c2ecf20Sopenharmony_ciits contents after calling :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` are
2258c2ecf20Sopenharmony_ciundefined. When a bit mask is supported but no clipping is desired this
2268c2ecf20Sopenharmony_cifield must be set to ``NULL``.
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ciApplications need not create a clip list or bit mask. When they pass
2298c2ecf20Sopenharmony_ciboth, or despite negotiating chroma-keying, the results are undefined.
2308c2ecf20Sopenharmony_ciRegardless of the chosen method, the clipping abilities of the hardware
2318c2ecf20Sopenharmony_cimay be limited in quantity or quality. The results when these limits are
2328c2ecf20Sopenharmony_ciexceeded are undefined. [#f3]_
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci``__u8 global_alpha``
2358c2ecf20Sopenharmony_ci    The global alpha value used to blend the framebuffer with video
2368c2ecf20Sopenharmony_ci    images, if global alpha blending has been negotiated
2378c2ecf20Sopenharmony_ci    (``V4L2_FBUF_FLAG_GLOBAL_ALPHA``, see
2388c2ecf20Sopenharmony_ci    :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>`,
2398c2ecf20Sopenharmony_ci    :ref:`framebuffer-flags`).
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci.. note::
2428c2ecf20Sopenharmony_ci
2438c2ecf20Sopenharmony_ci   This field was added in Linux 2.6.23, extending the
2448c2ecf20Sopenharmony_ci   structure. However the :ref:`VIDIOC_[G|S|TRY]_FMT <VIDIOC_G_FMT>`
2458c2ecf20Sopenharmony_ci   ioctls, which take a pointer to a :c:type:`v4l2_format`
2468c2ecf20Sopenharmony_ci   parent structure with padding bytes at the end, are not affected.
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci.. c:type:: v4l2_clip
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_cistruct v4l2_clip [#f4]_
2528c2ecf20Sopenharmony_ci-----------------------
2538c2ecf20Sopenharmony_ci
2548c2ecf20Sopenharmony_ci``struct v4l2_rect c``
2558c2ecf20Sopenharmony_ci    Coordinates of the clipping rectangle, relative to the top, left
2568c2ecf20Sopenharmony_ci    corner of the frame buffer. Only window pixels *outside* all
2578c2ecf20Sopenharmony_ci    clipping rectangles are displayed.
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci``struct v4l2_clip * next``
2608c2ecf20Sopenharmony_ci    Pointer to the next clipping rectangle, ``NULL`` when this is the last
2618c2ecf20Sopenharmony_ci    rectangle. Drivers ignore this field, it cannot be used to pass a
2628c2ecf20Sopenharmony_ci    linked list of clipping rectangles.
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ci.. c:type:: v4l2_rect
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_cistruct v4l2_rect
2688c2ecf20Sopenharmony_ci----------------
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci``__s32 left``
2718c2ecf20Sopenharmony_ci    Horizontal offset of the top, left corner of the rectangle, in
2728c2ecf20Sopenharmony_ci    pixels.
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci``__s32 top``
2758c2ecf20Sopenharmony_ci    Vertical offset of the top, left corner of the rectangle, in pixels.
2768c2ecf20Sopenharmony_ci    Offsets increase to the right and down.
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci``__u32 width``
2798c2ecf20Sopenharmony_ci    Width of the rectangle, in pixels.
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci``__u32 height``
2828c2ecf20Sopenharmony_ci    Height of the rectangle, in pixels.
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_ciEnabling Overlay
2868c2ecf20Sopenharmony_ci================
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ciTo start or stop the frame buffer overlay applications call the
2898c2ecf20Sopenharmony_ci:ref:`VIDIOC_OVERLAY` ioctl.
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci.. [#f1]
2928c2ecf20Sopenharmony_ci   A common application of two file descriptors is the XFree86
2938c2ecf20Sopenharmony_ci   :ref:`Xv/V4L <xvideo>` interface driver and a V4L2 application.
2948c2ecf20Sopenharmony_ci   While the X server controls video overlay, the application can take
2958c2ecf20Sopenharmony_ci   advantage of memory mapping and DMA.
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci   In the opinion of the designers of this API, no driver writer taking
2988c2ecf20Sopenharmony_ci   the efforts to support simultaneous capturing and overlay will
2998c2ecf20Sopenharmony_ci   restrict this ability by requiring a single file descriptor, as in
3008c2ecf20Sopenharmony_ci   V4L and earlier versions of V4L2. Making this optional means
3018c2ecf20Sopenharmony_ci   applications depending on two file descriptors need backup routines
3028c2ecf20Sopenharmony_ci   to be compatible with all drivers, which is considerable more work
3038c2ecf20Sopenharmony_ci   than using two fds in applications which do not. Also two fd's fit
3048c2ecf20Sopenharmony_ci   the general concept of one file descriptor for each logical stream.
3058c2ecf20Sopenharmony_ci   Hence as a complexity trade-off drivers *must* support two file
3068c2ecf20Sopenharmony_ci   descriptors and *may* support single fd operation.
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci.. [#f2]
3098c2ecf20Sopenharmony_ci   Should we require ``w.width`` to be a multiple of eight?
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci.. [#f3]
3128c2ecf20Sopenharmony_ci   When the image is written into frame buffer memory it will be
3138c2ecf20Sopenharmony_ci   undesirable if the driver clips out less pixels than expected,
3148c2ecf20Sopenharmony_ci   because the application and graphics system are not aware these
3158c2ecf20Sopenharmony_ci   regions need to be refreshed. The driver should clip out more pixels
3168c2ecf20Sopenharmony_ci   or not write the image at all.
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci.. [#f4]
3198c2ecf20Sopenharmony_ci   The X Window system defines "regions" which are vectors of ``struct
3208c2ecf20Sopenharmony_ci   BoxRec { short x1, y1, x2, y2; }`` with ``width = x2 - x1`` and
3218c2ecf20Sopenharmony_ci   ``height = y2 - y1``, so one cannot pass X11 clip lists directly.
322