18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_G_FBUF:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci**********************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF
88c2ecf20Sopenharmony_ci**********************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_G_FBUF - VIDIOC_S_FBUF - Get or set frame buffer overlay parameters
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_G_FBUF
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_FBUF, struct v4l2_framebuffer *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_S_FBUF
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_FBUF, const struct v4l2_framebuffer *argp)``
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciArguments
278c2ecf20Sopenharmony_ci=========
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci``fd``
308c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci``argp``
338c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`v4l2_framebuffer`.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciDescription
368c2ecf20Sopenharmony_ci===========
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciApplications can use the :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` and :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` ioctl
398c2ecf20Sopenharmony_cito get and set the framebuffer parameters for a
408c2ecf20Sopenharmony_ci:ref:`Video Overlay <overlay>` or :ref:`Video Output Overlay <osd>`
418c2ecf20Sopenharmony_ci(OSD). The type of overlay is implied by the device type (capture or
428c2ecf20Sopenharmony_cioutput device) and can be determined with the
438c2ecf20Sopenharmony_ci:ref:`VIDIOC_QUERYCAP` ioctl. One ``/dev/videoN``
448c2ecf20Sopenharmony_cidevice must not support both kinds of overlay.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciThe V4L2 API distinguishes destructive and non-destructive overlays. A
478c2ecf20Sopenharmony_cidestructive overlay copies captured video images into the video memory
488c2ecf20Sopenharmony_ciof a graphics card. A non-destructive overlay blends video images into a
498c2ecf20Sopenharmony_ciVGA signal or graphics into a video signal. *Video Output Overlays* are
508c2ecf20Sopenharmony_cialways non-destructive.
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciTo get the current parameters applications call the :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`
538c2ecf20Sopenharmony_ciioctl with a pointer to a struct :c:type:`v4l2_framebuffer`
548c2ecf20Sopenharmony_cistructure. The driver fills all fields of the structure or returns an
558c2ecf20Sopenharmony_ciEINVAL error code when overlays are not supported.
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciTo set the parameters for a *Video Output Overlay*, applications must
588c2ecf20Sopenharmony_ciinitialize the ``flags`` field of a struct
598c2ecf20Sopenharmony_ci:c:type:`v4l2_framebuffer`. Since the framebuffer is
608c2ecf20Sopenharmony_ciimplemented on the TV card all other parameters are determined by the
618c2ecf20Sopenharmony_cidriver. When an application calls :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` with a pointer to
628c2ecf20Sopenharmony_cithis structure, the driver prepares for the overlay and returns the
638c2ecf20Sopenharmony_ciframebuffer parameters as :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` does, or it returns an error
648c2ecf20Sopenharmony_cicode.
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciTo set the parameters for a *non-destructive Video Overlay*,
678c2ecf20Sopenharmony_ciapplications must initialize the ``flags`` field, the ``fmt``
688c2ecf20Sopenharmony_cisubstructure, and call :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>`. Again the driver prepares for
698c2ecf20Sopenharmony_cithe overlay and returns the framebuffer parameters as :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`
708c2ecf20Sopenharmony_cidoes, or it returns an error code.
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ciFor a *destructive Video Overlay* applications must additionally provide
738c2ecf20Sopenharmony_cia ``base`` address. Setting up a DMA to a random memory location can
748c2ecf20Sopenharmony_cijeopardize the system security, its stability or even damage the
758c2ecf20Sopenharmony_cihardware, therefore only the superuser can set the parameters for a
768c2ecf20Sopenharmony_cidestructive video overlay.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci.. c:type:: v4l2_framebuffer
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci.. cssclass:: longtable
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci.. flat-table:: struct v4l2_framebuffer
858c2ecf20Sopenharmony_ci    :header-rows:  0
868c2ecf20Sopenharmony_ci    :stub-columns: 0
878c2ecf20Sopenharmony_ci    :widths:       1 1 1 2
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci    * - __u32
908c2ecf20Sopenharmony_ci      - ``capability``
918c2ecf20Sopenharmony_ci      -
928c2ecf20Sopenharmony_ci      - Overlay capability flags set by the driver, see
938c2ecf20Sopenharmony_ci	:ref:`framebuffer-cap`.
948c2ecf20Sopenharmony_ci    * - __u32
958c2ecf20Sopenharmony_ci      - ``flags``
968c2ecf20Sopenharmony_ci      -
978c2ecf20Sopenharmony_ci      - Overlay control flags set by application and driver, see
988c2ecf20Sopenharmony_ci	:ref:`framebuffer-flags`
998c2ecf20Sopenharmony_ci    * - void *
1008c2ecf20Sopenharmony_ci      - ``base``
1018c2ecf20Sopenharmony_ci      -
1028c2ecf20Sopenharmony_ci      - Physical base address of the framebuffer, that is the address of
1038c2ecf20Sopenharmony_ci	the pixel in the top left corner of the framebuffer. [#f1]_
1048c2ecf20Sopenharmony_ci    * -
1058c2ecf20Sopenharmony_ci      -
1068c2ecf20Sopenharmony_ci      -
1078c2ecf20Sopenharmony_ci      - This field is irrelevant to *non-destructive Video Overlays*. For
1088c2ecf20Sopenharmony_ci	*destructive Video Overlays* applications must provide a base
1098c2ecf20Sopenharmony_ci	address. The driver may accept only base addresses which are a
1108c2ecf20Sopenharmony_ci	multiple of two, four or eight bytes. For *Video Output Overlays*
1118c2ecf20Sopenharmony_ci	the driver must return a valid base address, so applications can
1128c2ecf20Sopenharmony_ci	find the corresponding Linux framebuffer device (see
1138c2ecf20Sopenharmony_ci	:ref:`osd`).
1148c2ecf20Sopenharmony_ci    * - struct
1158c2ecf20Sopenharmony_ci      - ``fmt``
1168c2ecf20Sopenharmony_ci      -
1178c2ecf20Sopenharmony_ci      - Layout of the frame buffer.
1188c2ecf20Sopenharmony_ci    * -
1198c2ecf20Sopenharmony_ci      - __u32
1208c2ecf20Sopenharmony_ci      - ``width``
1218c2ecf20Sopenharmony_ci      - Width of the frame buffer in pixels.
1228c2ecf20Sopenharmony_ci    * -
1238c2ecf20Sopenharmony_ci      - __u32
1248c2ecf20Sopenharmony_ci      - ``height``
1258c2ecf20Sopenharmony_ci      - Height of the frame buffer in pixels.
1268c2ecf20Sopenharmony_ci    * -
1278c2ecf20Sopenharmony_ci      - __u32
1288c2ecf20Sopenharmony_ci      - ``pixelformat``
1298c2ecf20Sopenharmony_ci      - The pixel format of the framebuffer.
1308c2ecf20Sopenharmony_ci    * -
1318c2ecf20Sopenharmony_ci      -
1328c2ecf20Sopenharmony_ci      -
1338c2ecf20Sopenharmony_ci      - For *non-destructive Video Overlays* this field only defines a
1348c2ecf20Sopenharmony_ci	format for the struct :c:type:`v4l2_window`
1358c2ecf20Sopenharmony_ci	``chromakey`` field.
1368c2ecf20Sopenharmony_ci    * -
1378c2ecf20Sopenharmony_ci      -
1388c2ecf20Sopenharmony_ci      -
1398c2ecf20Sopenharmony_ci      - For *destructive Video Overlays* applications must initialize this
1408c2ecf20Sopenharmony_ci	field. For *Video Output Overlays* the driver must return a valid
1418c2ecf20Sopenharmony_ci	format.
1428c2ecf20Sopenharmony_ci    * -
1438c2ecf20Sopenharmony_ci      -
1448c2ecf20Sopenharmony_ci      -
1458c2ecf20Sopenharmony_ci      - Usually this is an RGB format (for example
1468c2ecf20Sopenharmony_ci	:ref:`V4L2_PIX_FMT_RGB565 <V4L2-PIX-FMT-RGB565>`) but YUV
1478c2ecf20Sopenharmony_ci	formats (only packed YUV formats when chroma keying is used, not
1488c2ecf20Sopenharmony_ci	including ``V4L2_PIX_FMT_YUYV`` and ``V4L2_PIX_FMT_UYVY``) and the
1498c2ecf20Sopenharmony_ci	``V4L2_PIX_FMT_PAL8`` format are also permitted. The behavior of
1508c2ecf20Sopenharmony_ci	the driver when an application requests a compressed format is
1518c2ecf20Sopenharmony_ci	undefined. See :ref:`pixfmt` for information on pixel formats.
1528c2ecf20Sopenharmony_ci    * -
1538c2ecf20Sopenharmony_ci      - enum :c:type:`v4l2_field`
1548c2ecf20Sopenharmony_ci      - ``field``
1558c2ecf20Sopenharmony_ci      - Drivers and applications shall ignore this field. If applicable,
1568c2ecf20Sopenharmony_ci	the field order is selected with the
1578c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, using the ``field``
1588c2ecf20Sopenharmony_ci	field of struct :c:type:`v4l2_window`.
1598c2ecf20Sopenharmony_ci    * -
1608c2ecf20Sopenharmony_ci      - __u32
1618c2ecf20Sopenharmony_ci      - ``bytesperline``
1628c2ecf20Sopenharmony_ci      - Distance in bytes between the leftmost pixels in two adjacent
1638c2ecf20Sopenharmony_ci	lines.
1648c2ecf20Sopenharmony_ci    * - :cspan:`3`
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci	This field is irrelevant to *non-destructive Video Overlays*.
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci	For *destructive Video Overlays* both applications and drivers can
1698c2ecf20Sopenharmony_ci	set this field to request padding bytes at the end of each line.
1708c2ecf20Sopenharmony_ci	Drivers however may ignore the requested value, returning
1718c2ecf20Sopenharmony_ci	``width`` times bytes-per-pixel or a larger value required by the
1728c2ecf20Sopenharmony_ci	hardware. That implies applications can just set this field to
1738c2ecf20Sopenharmony_ci	zero to get a reasonable default.
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci	For *Video Output Overlays* the driver must return a valid value.
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci	Video hardware may access padding bytes, therefore they must
1788c2ecf20Sopenharmony_ci	reside in accessible memory. Consider for example the case where
1798c2ecf20Sopenharmony_ci	padding bytes after the last line of an image cross a system page
1808c2ecf20Sopenharmony_ci	boundary. Capture devices may write padding bytes, the value is
1818c2ecf20Sopenharmony_ci	undefined. Output devices ignore the contents of padding bytes.
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci	When the image format is planar the ``bytesperline`` value applies
1848c2ecf20Sopenharmony_ci	to the first plane and is divided by the same factor as the
1858c2ecf20Sopenharmony_ci	``width`` field for the other planes. For example the Cb and Cr
1868c2ecf20Sopenharmony_ci	planes of a YUV 4:2:0 image have half as many padding bytes
1878c2ecf20Sopenharmony_ci	following each line as the Y plane. To avoid ambiguities drivers
1888c2ecf20Sopenharmony_ci	must return a ``bytesperline`` value rounded up to a multiple of
1898c2ecf20Sopenharmony_ci	the scale factor.
1908c2ecf20Sopenharmony_ci    * -
1918c2ecf20Sopenharmony_ci      - __u32
1928c2ecf20Sopenharmony_ci      - ``sizeimage``
1938c2ecf20Sopenharmony_ci      - This field is irrelevant to *non-destructive Video Overlays*. For
1948c2ecf20Sopenharmony_ci	*destructive Video Overlays* applications must initialize this
1958c2ecf20Sopenharmony_ci	field. For *Video Output Overlays* the driver must return a valid
1968c2ecf20Sopenharmony_ci	format.
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci	Together with ``base`` it defines the framebuffer memory
1998c2ecf20Sopenharmony_ci	accessible by the driver.
2008c2ecf20Sopenharmony_ci    * -
2018c2ecf20Sopenharmony_ci      - enum :c:type:`v4l2_colorspace`
2028c2ecf20Sopenharmony_ci      - ``colorspace``
2038c2ecf20Sopenharmony_ci      - This information supplements the ``pixelformat`` and must be set
2048c2ecf20Sopenharmony_ci	by the driver, see :ref:`colorspaces`.
2058c2ecf20Sopenharmony_ci    * -
2068c2ecf20Sopenharmony_ci      - __u32
2078c2ecf20Sopenharmony_ci      - ``priv``
2088c2ecf20Sopenharmony_ci      - Reserved. Drivers and applications must set this field to zero.
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci.. _framebuffer-cap:
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci.. flat-table:: Frame Buffer Capability Flags
2158c2ecf20Sopenharmony_ci    :header-rows:  0
2168c2ecf20Sopenharmony_ci    :stub-columns: 0
2178c2ecf20Sopenharmony_ci    :widths:       3 1 4
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_EXTERNOVERLAY``
2208c2ecf20Sopenharmony_ci      - 0x0001
2218c2ecf20Sopenharmony_ci      - The device is capable of non-destructive overlays. When the driver
2228c2ecf20Sopenharmony_ci	clears this flag, only destructive overlays are supported. There
2238c2ecf20Sopenharmony_ci	are no drivers yet which support both destructive and
2248c2ecf20Sopenharmony_ci	non-destructive overlays. Video Output Overlays are in practice
2258c2ecf20Sopenharmony_ci	always non-destructive.
2268c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_CHROMAKEY``
2278c2ecf20Sopenharmony_ci      - 0x0002
2288c2ecf20Sopenharmony_ci      - The device supports clipping by chroma-keying the images. That is,
2298c2ecf20Sopenharmony_ci	image pixels replace pixels in the VGA or video signal only where
2308c2ecf20Sopenharmony_ci	the latter assume a certain color. Chroma-keying makes no sense
2318c2ecf20Sopenharmony_ci	for destructive overlays.
2328c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_LIST_CLIPPING``
2338c2ecf20Sopenharmony_ci      - 0x0004
2348c2ecf20Sopenharmony_ci      - The device supports clipping using a list of clip rectangles.
2358c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_BITMAP_CLIPPING``
2368c2ecf20Sopenharmony_ci      - 0x0008
2378c2ecf20Sopenharmony_ci      - The device supports clipping using a bit mask.
2388c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_LOCAL_ALPHA``
2398c2ecf20Sopenharmony_ci      - 0x0010
2408c2ecf20Sopenharmony_ci      - The device supports clipping/blending using the alpha channel of
2418c2ecf20Sopenharmony_ci	the framebuffer or VGA signal. Alpha blending makes no sense for
2428c2ecf20Sopenharmony_ci	destructive overlays.
2438c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_GLOBAL_ALPHA``
2448c2ecf20Sopenharmony_ci      - 0x0020
2458c2ecf20Sopenharmony_ci      - The device supports alpha blending using a global alpha value.
2468c2ecf20Sopenharmony_ci	Alpha blending makes no sense for destructive overlays.
2478c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_LOCAL_INV_ALPHA``
2488c2ecf20Sopenharmony_ci      - 0x0040
2498c2ecf20Sopenharmony_ci      - The device supports clipping/blending using the inverted alpha
2508c2ecf20Sopenharmony_ci	channel of the framebuffer or VGA signal. Alpha blending makes no
2518c2ecf20Sopenharmony_ci	sense for destructive overlays.
2528c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_CAP_SRC_CHROMAKEY``
2538c2ecf20Sopenharmony_ci      - 0x0080
2548c2ecf20Sopenharmony_ci      - The device supports Source Chroma-keying. Video pixels with the
2558c2ecf20Sopenharmony_ci	chroma-key colors are replaced by framebuffer pixels, which is
2568c2ecf20Sopenharmony_ci	exactly opposite of ``V4L2_FBUF_CAP_CHROMAKEY``
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci.. _framebuffer-flags:
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci.. cssclass:: longtable
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci.. flat-table:: Frame Buffer Flags
2658c2ecf20Sopenharmony_ci    :header-rows:  0
2668c2ecf20Sopenharmony_ci    :stub-columns: 0
2678c2ecf20Sopenharmony_ci    :widths:       3 1 4
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_FLAG_PRIMARY``
2708c2ecf20Sopenharmony_ci      - 0x0001
2718c2ecf20Sopenharmony_ci      - The framebuffer is the primary graphics surface. In other words,
2728c2ecf20Sopenharmony_ci	the overlay is destructive. This flag is typically set by any
2738c2ecf20Sopenharmony_ci	driver that doesn't have the ``V4L2_FBUF_CAP_EXTERNOVERLAY``
2748c2ecf20Sopenharmony_ci	capability and it is cleared otherwise.
2758c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_FLAG_OVERLAY``
2768c2ecf20Sopenharmony_ci      - 0x0002
2778c2ecf20Sopenharmony_ci      - If this flag is set for a video capture device, then the driver
2788c2ecf20Sopenharmony_ci	will set the initial overlay size to cover the full framebuffer
2798c2ecf20Sopenharmony_ci	size, otherwise the existing overlay size (as set by
2808c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`) will be used. Only one
2818c2ecf20Sopenharmony_ci	video capture driver (bttv) supports this flag. The use of this
2828c2ecf20Sopenharmony_ci	flag for capture devices is deprecated. There is no way to detect
2838c2ecf20Sopenharmony_ci	which drivers support this flag, so the only reliable method of
2848c2ecf20Sopenharmony_ci	setting the overlay size is through
2858c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`. If this flag is set for a
2868c2ecf20Sopenharmony_ci	video output device, then the video output overlay window is
2878c2ecf20Sopenharmony_ci	relative to the top-left corner of the framebuffer and restricted
2888c2ecf20Sopenharmony_ci	to the size of the framebuffer. If it is cleared, then the video
2898c2ecf20Sopenharmony_ci	output overlay window is relative to the video output display.
2908c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_FLAG_CHROMAKEY``
2918c2ecf20Sopenharmony_ci      - 0x0004
2928c2ecf20Sopenharmony_ci      - Use chroma-keying. The chroma-key color is determined by the
2938c2ecf20Sopenharmony_ci	``chromakey`` field of struct :c:type:`v4l2_window`
2948c2ecf20Sopenharmony_ci	and negotiated with the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`
2958c2ecf20Sopenharmony_ci	ioctl, see :ref:`overlay` and :ref:`osd`.
2968c2ecf20Sopenharmony_ci    * - :cspan:`2` There are no flags to enable clipping using a list of
2978c2ecf20Sopenharmony_ci	clip rectangles or a bitmap. These methods are negotiated with the
2988c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
2998c2ecf20Sopenharmony_ci	and :ref:`osd`.
3008c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_FLAG_LOCAL_ALPHA``
3018c2ecf20Sopenharmony_ci      - 0x0008
3028c2ecf20Sopenharmony_ci      - Use the alpha channel of the framebuffer to clip or blend
3038c2ecf20Sopenharmony_ci	framebuffer pixels with video images. The blend function is:
3048c2ecf20Sopenharmony_ci	output = framebuffer pixel * alpha + video pixel * (1 - alpha).
3058c2ecf20Sopenharmony_ci	The actual alpha depth depends on the framebuffer pixel format.
3068c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_FLAG_GLOBAL_ALPHA``
3078c2ecf20Sopenharmony_ci      - 0x0010
3088c2ecf20Sopenharmony_ci      - Use a global alpha value to blend the framebuffer with video
3098c2ecf20Sopenharmony_ci	images. The blend function is: output = (framebuffer pixel * alpha
3108c2ecf20Sopenharmony_ci	+ video pixel * (255 - alpha)) / 255. The alpha value is
3118c2ecf20Sopenharmony_ci	determined by the ``global_alpha`` field of struct
3128c2ecf20Sopenharmony_ci	:c:type:`v4l2_window` and negotiated with the
3138c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
3148c2ecf20Sopenharmony_ci	and :ref:`osd`.
3158c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_FLAG_LOCAL_INV_ALPHA``
3168c2ecf20Sopenharmony_ci      - 0x0020
3178c2ecf20Sopenharmony_ci      - Like ``V4L2_FBUF_FLAG_LOCAL_ALPHA``, use the alpha channel of the
3188c2ecf20Sopenharmony_ci	framebuffer to clip or blend framebuffer pixels with video images,
3198c2ecf20Sopenharmony_ci	but with an inverted alpha value. The blend function is: output =
3208c2ecf20Sopenharmony_ci	framebuffer pixel * (1 - alpha) + video pixel * alpha. The actual
3218c2ecf20Sopenharmony_ci	alpha depth depends on the framebuffer pixel format.
3228c2ecf20Sopenharmony_ci    * - ``V4L2_FBUF_FLAG_SRC_CHROMAKEY``
3238c2ecf20Sopenharmony_ci      - 0x0040
3248c2ecf20Sopenharmony_ci      - Use source chroma-keying. The source chroma-key color is
3258c2ecf20Sopenharmony_ci	determined by the ``chromakey`` field of struct
3268c2ecf20Sopenharmony_ci	:c:type:`v4l2_window` and negotiated with the
3278c2ecf20Sopenharmony_ci	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
3288c2ecf20Sopenharmony_ci	and :ref:`osd`. Both chroma-keying are mutual exclusive to each
3298c2ecf20Sopenharmony_ci	other, so same ``chromakey`` field of struct
3308c2ecf20Sopenharmony_ci	:c:type:`v4l2_window` is being used.
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ciReturn Value
3338c2ecf20Sopenharmony_ci============
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
3368c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
3378c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ciEPERM
3408c2ecf20Sopenharmony_ci    :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` can only be called by a privileged user to
3418c2ecf20Sopenharmony_ci    negotiate the parameters for a destructive overlay.
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ciEINVAL
3448c2ecf20Sopenharmony_ci    The :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` parameters are unsuitable.
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci.. [#f1]
3478c2ecf20Sopenharmony_ci   A physical base address may not suit all platforms. GK notes in
3488c2ecf20Sopenharmony_ci   theory we should pass something like PCI device + memory region +
3498c2ecf20Sopenharmony_ci   offset instead. If you encounter problems please discuss on the
3508c2ecf20Sopenharmony_ci   linux-media mailing list:
3518c2ecf20Sopenharmony_ci   `https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__.
352