xref: /openbmc/linux/Documentation/userspace-api/media/v4l/vidioc-g-fbuf.rst (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L
354f38fcaSMauro Carvalho Chehab
454f38fcaSMauro Carvalho Chehab.. _VIDIOC_G_FBUF:
554f38fcaSMauro Carvalho Chehab
654f38fcaSMauro Carvalho Chehab**********************************
754f38fcaSMauro Carvalho Chehabioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF
854f38fcaSMauro Carvalho Chehab**********************************
954f38fcaSMauro Carvalho Chehab
1054f38fcaSMauro Carvalho ChehabName
1154f38fcaSMauro Carvalho Chehab====
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabVIDIOC_G_FBUF - VIDIOC_S_FBUF - Get or set frame buffer overlay parameters
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho ChehabSynopsis
1654f38fcaSMauro Carvalho Chehab========
1754f38fcaSMauro Carvalho Chehab
18407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_G_FBUF
1954f38fcaSMauro Carvalho Chehab
20407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_G_FBUF, struct v4l2_framebuffer *argp)``
2154f38fcaSMauro Carvalho Chehab
22407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_S_FBUF
23407e84cdSMauro Carvalho Chehab
24407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_S_FBUF, const struct v4l2_framebuffer *argp)``
2554f38fcaSMauro Carvalho Chehab
2654f38fcaSMauro Carvalho ChehabArguments
2754f38fcaSMauro Carvalho Chehab=========
2854f38fcaSMauro Carvalho Chehab
2954f38fcaSMauro Carvalho Chehab``fd``
30407e84cdSMauro Carvalho Chehab    File descriptor returned by :c:func:`open()`.
3154f38fcaSMauro Carvalho Chehab
3254f38fcaSMauro Carvalho Chehab``argp``
3354f38fcaSMauro Carvalho Chehab    Pointer to struct :c:type:`v4l2_framebuffer`.
3454f38fcaSMauro Carvalho Chehab
3554f38fcaSMauro Carvalho ChehabDescription
3654f38fcaSMauro Carvalho Chehab===========
3754f38fcaSMauro Carvalho Chehab
3854f38fcaSMauro Carvalho ChehabApplications can use the :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` and :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` ioctl
3954f38fcaSMauro Carvalho Chehabto get and set the framebuffer parameters for a
4054f38fcaSMauro Carvalho Chehab:ref:`Video Overlay <overlay>` or :ref:`Video Output Overlay <osd>`
4154f38fcaSMauro Carvalho Chehab(OSD). The type of overlay is implied by the device type (capture or
4254f38fcaSMauro Carvalho Chehaboutput device) and can be determined with the
4354f38fcaSMauro Carvalho Chehab:ref:`VIDIOC_QUERYCAP` ioctl. One ``/dev/videoN``
4454f38fcaSMauro Carvalho Chehabdevice must not support both kinds of overlay.
4554f38fcaSMauro Carvalho Chehab
4654f38fcaSMauro Carvalho ChehabThe V4L2 API distinguishes destructive and non-destructive overlays. A
4754f38fcaSMauro Carvalho Chehabdestructive overlay copies captured video images into the video memory
4854f38fcaSMauro Carvalho Chehabof a graphics card. A non-destructive overlay blends video images into a
4954f38fcaSMauro Carvalho ChehabVGA signal or graphics into a video signal. *Video Output Overlays* are
5054f38fcaSMauro Carvalho Chehabalways non-destructive.
5154f38fcaSMauro Carvalho Chehab
52*ce875a29SHans VerkuilDestructive overlay support has been removed: with modern GPUs and CPUs
53*ce875a29SHans Verkuilthis is no longer needed, and it was always a very dangerous feature.
54*ce875a29SHans Verkuil
5554f38fcaSMauro Carvalho ChehabTo get the current parameters applications call the :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`
5654f38fcaSMauro Carvalho Chehabioctl with a pointer to a struct :c:type:`v4l2_framebuffer`
5754f38fcaSMauro Carvalho Chehabstructure. The driver fills all fields of the structure or returns an
5854f38fcaSMauro Carvalho ChehabEINVAL error code when overlays are not supported.
5954f38fcaSMauro Carvalho Chehab
6054f38fcaSMauro Carvalho ChehabTo set the parameters for a *Video Output Overlay*, applications must
6154f38fcaSMauro Carvalho Chehabinitialize the ``flags`` field of a struct
6254f38fcaSMauro Carvalho Chehab:c:type:`v4l2_framebuffer`. Since the framebuffer is
6354f38fcaSMauro Carvalho Chehabimplemented on the TV card all other parameters are determined by the
6454f38fcaSMauro Carvalho Chehabdriver. When an application calls :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` with a pointer to
6554f38fcaSMauro Carvalho Chehabthis structure, the driver prepares for the overlay and returns the
6654f38fcaSMauro Carvalho Chehabframebuffer parameters as :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` does, or it returns an error
6754f38fcaSMauro Carvalho Chehabcode.
6854f38fcaSMauro Carvalho Chehab
69*ce875a29SHans VerkuilTo set the parameters for a *Video Capture Overlay*
7054f38fcaSMauro Carvalho Chehabapplications must initialize the ``flags`` field, the ``fmt``
7154f38fcaSMauro Carvalho Chehabsubstructure, and call :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>`. Again the driver prepares for
7254f38fcaSMauro Carvalho Chehabthe overlay and returns the framebuffer parameters as :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`
7354f38fcaSMauro Carvalho Chehabdoes, or it returns an error code.
7454f38fcaSMauro Carvalho Chehab
75fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{6.6cm}|
7654f38fcaSMauro Carvalho Chehab
7754f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_framebuffer
7854f38fcaSMauro Carvalho Chehab
7954f38fcaSMauro Carvalho Chehab.. cssclass:: longtable
8054f38fcaSMauro Carvalho Chehab
8154f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_framebuffer
8254f38fcaSMauro Carvalho Chehab    :header-rows:  0
8354f38fcaSMauro Carvalho Chehab    :stub-columns: 0
8454f38fcaSMauro Carvalho Chehab    :widths:       1 1 1 2
8554f38fcaSMauro Carvalho Chehab
8654f38fcaSMauro Carvalho Chehab    * - __u32
8754f38fcaSMauro Carvalho Chehab      - ``capability``
8854f38fcaSMauro Carvalho Chehab      -
8954f38fcaSMauro Carvalho Chehab      - Overlay capability flags set by the driver, see
9054f38fcaSMauro Carvalho Chehab	:ref:`framebuffer-cap`.
9154f38fcaSMauro Carvalho Chehab    * - __u32
9254f38fcaSMauro Carvalho Chehab      - ``flags``
9354f38fcaSMauro Carvalho Chehab      -
9454f38fcaSMauro Carvalho Chehab      - Overlay control flags set by application and driver, see
9554f38fcaSMauro Carvalho Chehab	:ref:`framebuffer-flags`
9654f38fcaSMauro Carvalho Chehab    * - void *
9754f38fcaSMauro Carvalho Chehab      - ``base``
9854f38fcaSMauro Carvalho Chehab      -
9954f38fcaSMauro Carvalho Chehab      - Physical base address of the framebuffer, that is the address of
100*ce875a29SHans Verkuil	the pixel in the top left corner of the framebuffer.
101*ce875a29SHans Verkuil	For :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` this field is no longer supported
102*ce875a29SHans Verkuil	and the kernel will always set this to NULL.
103*ce875a29SHans Verkuil	For *Video Output Overlays*
104*ce875a29SHans Verkuil	the driver will return a valid base address, so applications can
10554f38fcaSMauro Carvalho Chehab	find the corresponding Linux framebuffer device (see
106*ce875a29SHans Verkuil	:ref:`osd`). For *Video Capture Overlays* this field will always be
107*ce875a29SHans Verkuil	NULL.
10854f38fcaSMauro Carvalho Chehab    * - struct
10954f38fcaSMauro Carvalho Chehab      - ``fmt``
11054f38fcaSMauro Carvalho Chehab      -
11154f38fcaSMauro Carvalho Chehab      - Layout of the frame buffer.
11254f38fcaSMauro Carvalho Chehab    * -
11354f38fcaSMauro Carvalho Chehab      - __u32
11454f38fcaSMauro Carvalho Chehab      - ``width``
11554f38fcaSMauro Carvalho Chehab      - Width of the frame buffer in pixels.
11654f38fcaSMauro Carvalho Chehab    * -
11754f38fcaSMauro Carvalho Chehab      - __u32
11854f38fcaSMauro Carvalho Chehab      - ``height``
11954f38fcaSMauro Carvalho Chehab      - Height of the frame buffer in pixels.
12054f38fcaSMauro Carvalho Chehab    * -
12154f38fcaSMauro Carvalho Chehab      - __u32
12254f38fcaSMauro Carvalho Chehab      - ``pixelformat``
12354f38fcaSMauro Carvalho Chehab      - The pixel format of the framebuffer.
12454f38fcaSMauro Carvalho Chehab    * -
12554f38fcaSMauro Carvalho Chehab      -
12654f38fcaSMauro Carvalho Chehab      -
12754f38fcaSMauro Carvalho Chehab      - For *non-destructive Video Overlays* this field only defines a
12854f38fcaSMauro Carvalho Chehab	format for the struct :c:type:`v4l2_window`
12954f38fcaSMauro Carvalho Chehab	``chromakey`` field.
13054f38fcaSMauro Carvalho Chehab    * -
13154f38fcaSMauro Carvalho Chehab      -
13254f38fcaSMauro Carvalho Chehab      -
133*ce875a29SHans Verkuil      - For *Video Output Overlays* the driver must return a valid
13454f38fcaSMauro Carvalho Chehab	format.
13554f38fcaSMauro Carvalho Chehab    * -
13654f38fcaSMauro Carvalho Chehab      -
13754f38fcaSMauro Carvalho Chehab      -
13854f38fcaSMauro Carvalho Chehab      - Usually this is an RGB format (for example
13954f38fcaSMauro Carvalho Chehab	:ref:`V4L2_PIX_FMT_RGB565 <V4L2-PIX-FMT-RGB565>`) but YUV
14054f38fcaSMauro Carvalho Chehab	formats (only packed YUV formats when chroma keying is used, not
14154f38fcaSMauro Carvalho Chehab	including ``V4L2_PIX_FMT_YUYV`` and ``V4L2_PIX_FMT_UYVY``) and the
14254f38fcaSMauro Carvalho Chehab	``V4L2_PIX_FMT_PAL8`` format are also permitted. The behavior of
14354f38fcaSMauro Carvalho Chehab	the driver when an application requests a compressed format is
14454f38fcaSMauro Carvalho Chehab	undefined. See :ref:`pixfmt` for information on pixel formats.
14554f38fcaSMauro Carvalho Chehab    * -
14654f38fcaSMauro Carvalho Chehab      - enum :c:type:`v4l2_field`
14754f38fcaSMauro Carvalho Chehab      - ``field``
14854f38fcaSMauro Carvalho Chehab      - Drivers and applications shall ignore this field. If applicable,
14954f38fcaSMauro Carvalho Chehab	the field order is selected with the
15054f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, using the ``field``
15154f38fcaSMauro Carvalho Chehab	field of struct :c:type:`v4l2_window`.
15254f38fcaSMauro Carvalho Chehab    * -
15354f38fcaSMauro Carvalho Chehab      - __u32
15454f38fcaSMauro Carvalho Chehab      - ``bytesperline``
15554f38fcaSMauro Carvalho Chehab      - Distance in bytes between the leftmost pixels in two adjacent
15654f38fcaSMauro Carvalho Chehab	lines.
15754f38fcaSMauro Carvalho Chehab    * - :cspan:`3`
15854f38fcaSMauro Carvalho Chehab
15954f38fcaSMauro Carvalho Chehab	This field is irrelevant to *non-destructive Video Overlays*.
16054f38fcaSMauro Carvalho Chehab
16154f38fcaSMauro Carvalho Chehab	For *Video Output Overlays* the driver must return a valid value.
16254f38fcaSMauro Carvalho Chehab
16354f38fcaSMauro Carvalho Chehab	Video hardware may access padding bytes, therefore they must
16454f38fcaSMauro Carvalho Chehab	reside in accessible memory. Consider for example the case where
16554f38fcaSMauro Carvalho Chehab	padding bytes after the last line of an image cross a system page
16654f38fcaSMauro Carvalho Chehab	boundary. Capture devices may write padding bytes, the value is
16754f38fcaSMauro Carvalho Chehab	undefined. Output devices ignore the contents of padding bytes.
16854f38fcaSMauro Carvalho Chehab
16954f38fcaSMauro Carvalho Chehab	When the image format is planar the ``bytesperline`` value applies
17054f38fcaSMauro Carvalho Chehab	to the first plane and is divided by the same factor as the
17154f38fcaSMauro Carvalho Chehab	``width`` field for the other planes. For example the Cb and Cr
17254f38fcaSMauro Carvalho Chehab	planes of a YUV 4:2:0 image have half as many padding bytes
17354f38fcaSMauro Carvalho Chehab	following each line as the Y plane. To avoid ambiguities drivers
17454f38fcaSMauro Carvalho Chehab	must return a ``bytesperline`` value rounded up to a multiple of
17554f38fcaSMauro Carvalho Chehab	the scale factor.
17654f38fcaSMauro Carvalho Chehab    * -
17754f38fcaSMauro Carvalho Chehab      - __u32
17854f38fcaSMauro Carvalho Chehab      - ``sizeimage``
179*ce875a29SHans Verkuil      - This field is irrelevant to *non-destructive Video Overlays*.
180*ce875a29SHans Verkuil	For *Video Output Overlays* the driver must return a valid
18154f38fcaSMauro Carvalho Chehab	format.
18254f38fcaSMauro Carvalho Chehab
18354f38fcaSMauro Carvalho Chehab	Together with ``base`` it defines the framebuffer memory
18454f38fcaSMauro Carvalho Chehab	accessible by the driver.
18554f38fcaSMauro Carvalho Chehab    * -
18654f38fcaSMauro Carvalho Chehab      - enum :c:type:`v4l2_colorspace`
18754f38fcaSMauro Carvalho Chehab      - ``colorspace``
18854f38fcaSMauro Carvalho Chehab      - This information supplements the ``pixelformat`` and must be set
18954f38fcaSMauro Carvalho Chehab	by the driver, see :ref:`colorspaces`.
19054f38fcaSMauro Carvalho Chehab    * -
19154f38fcaSMauro Carvalho Chehab      - __u32
19254f38fcaSMauro Carvalho Chehab      - ``priv``
19354f38fcaSMauro Carvalho Chehab      - Reserved. Drivers and applications must set this field to zero.
19454f38fcaSMauro Carvalho Chehab
195fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{7.4cm}|p{1.6cm}|p{8.3cm}|
19654f38fcaSMauro Carvalho Chehab
19754f38fcaSMauro Carvalho Chehab.. _framebuffer-cap:
19854f38fcaSMauro Carvalho Chehab
19954f38fcaSMauro Carvalho Chehab.. flat-table:: Frame Buffer Capability Flags
20054f38fcaSMauro Carvalho Chehab    :header-rows:  0
20154f38fcaSMauro Carvalho Chehab    :stub-columns: 0
20254f38fcaSMauro Carvalho Chehab    :widths:       3 1 4
20354f38fcaSMauro Carvalho Chehab
20454f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_EXTERNOVERLAY``
20554f38fcaSMauro Carvalho Chehab      - 0x0001
20654f38fcaSMauro Carvalho Chehab      - The device is capable of non-destructive overlays. When the driver
20754f38fcaSMauro Carvalho Chehab	clears this flag, only destructive overlays are supported. There
20854f38fcaSMauro Carvalho Chehab	are no drivers yet which support both destructive and
20954f38fcaSMauro Carvalho Chehab	non-destructive overlays. Video Output Overlays are in practice
21054f38fcaSMauro Carvalho Chehab	always non-destructive.
21154f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_CHROMAKEY``
21254f38fcaSMauro Carvalho Chehab      - 0x0002
21354f38fcaSMauro Carvalho Chehab      - The device supports clipping by chroma-keying the images. That is,
21454f38fcaSMauro Carvalho Chehab	image pixels replace pixels in the VGA or video signal only where
21554f38fcaSMauro Carvalho Chehab	the latter assume a certain color. Chroma-keying makes no sense
21654f38fcaSMauro Carvalho Chehab	for destructive overlays.
21754f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_LIST_CLIPPING``
21854f38fcaSMauro Carvalho Chehab      - 0x0004
21954f38fcaSMauro Carvalho Chehab      - The device supports clipping using a list of clip rectangles.
220*ce875a29SHans Verkuil        Note that this is no longer supported.
22154f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_BITMAP_CLIPPING``
22254f38fcaSMauro Carvalho Chehab      - 0x0008
22354f38fcaSMauro Carvalho Chehab      - The device supports clipping using a bit mask.
224*ce875a29SHans Verkuil        Note that this is no longer supported.
22554f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_LOCAL_ALPHA``
22654f38fcaSMauro Carvalho Chehab      - 0x0010
22754f38fcaSMauro Carvalho Chehab      - The device supports clipping/blending using the alpha channel of
22854f38fcaSMauro Carvalho Chehab	the framebuffer or VGA signal. Alpha blending makes no sense for
22954f38fcaSMauro Carvalho Chehab	destructive overlays.
23054f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_GLOBAL_ALPHA``
23154f38fcaSMauro Carvalho Chehab      - 0x0020
23254f38fcaSMauro Carvalho Chehab      - The device supports alpha blending using a global alpha value.
23354f38fcaSMauro Carvalho Chehab	Alpha blending makes no sense for destructive overlays.
23454f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_LOCAL_INV_ALPHA``
23554f38fcaSMauro Carvalho Chehab      - 0x0040
23654f38fcaSMauro Carvalho Chehab      - The device supports clipping/blending using the inverted alpha
23754f38fcaSMauro Carvalho Chehab	channel of the framebuffer or VGA signal. Alpha blending makes no
23854f38fcaSMauro Carvalho Chehab	sense for destructive overlays.
23954f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_CAP_SRC_CHROMAKEY``
24054f38fcaSMauro Carvalho Chehab      - 0x0080
24154f38fcaSMauro Carvalho Chehab      - The device supports Source Chroma-keying. Video pixels with the
24254f38fcaSMauro Carvalho Chehab	chroma-key colors are replaced by framebuffer pixels, which is
24354f38fcaSMauro Carvalho Chehab	exactly opposite of ``V4L2_FBUF_CAP_CHROMAKEY``
24454f38fcaSMauro Carvalho Chehab
245fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{7.4cm}|p{1.6cm}|p{8.3cm}|
24654f38fcaSMauro Carvalho Chehab
24754f38fcaSMauro Carvalho Chehab.. _framebuffer-flags:
24854f38fcaSMauro Carvalho Chehab
24954f38fcaSMauro Carvalho Chehab.. cssclass:: longtable
25054f38fcaSMauro Carvalho Chehab
25154f38fcaSMauro Carvalho Chehab.. flat-table:: Frame Buffer Flags
25254f38fcaSMauro Carvalho Chehab    :header-rows:  0
25354f38fcaSMauro Carvalho Chehab    :stub-columns: 0
25454f38fcaSMauro Carvalho Chehab    :widths:       3 1 4
25554f38fcaSMauro Carvalho Chehab
25654f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_FLAG_PRIMARY``
25754f38fcaSMauro Carvalho Chehab      - 0x0001
25854f38fcaSMauro Carvalho Chehab      - The framebuffer is the primary graphics surface. In other words,
25954f38fcaSMauro Carvalho Chehab	the overlay is destructive. This flag is typically set by any
26054f38fcaSMauro Carvalho Chehab	driver that doesn't have the ``V4L2_FBUF_CAP_EXTERNOVERLAY``
26154f38fcaSMauro Carvalho Chehab	capability and it is cleared otherwise.
26254f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_FLAG_OVERLAY``
26354f38fcaSMauro Carvalho Chehab      - 0x0002
26454f38fcaSMauro Carvalho Chehab      - If this flag is set for a video capture device, then the driver
26554f38fcaSMauro Carvalho Chehab	will set the initial overlay size to cover the full framebuffer
26654f38fcaSMauro Carvalho Chehab	size, otherwise the existing overlay size (as set by
26754f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`) will be used. Only one
26854f38fcaSMauro Carvalho Chehab	video capture driver (bttv) supports this flag. The use of this
26954f38fcaSMauro Carvalho Chehab	flag for capture devices is deprecated. There is no way to detect
27054f38fcaSMauro Carvalho Chehab	which drivers support this flag, so the only reliable method of
27154f38fcaSMauro Carvalho Chehab	setting the overlay size is through
27254f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`. If this flag is set for a
27354f38fcaSMauro Carvalho Chehab	video output device, then the video output overlay window is
27454f38fcaSMauro Carvalho Chehab	relative to the top-left corner of the framebuffer and restricted
27554f38fcaSMauro Carvalho Chehab	to the size of the framebuffer. If it is cleared, then the video
27654f38fcaSMauro Carvalho Chehab	output overlay window is relative to the video output display.
27754f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_FLAG_CHROMAKEY``
27854f38fcaSMauro Carvalho Chehab      - 0x0004
27954f38fcaSMauro Carvalho Chehab      - Use chroma-keying. The chroma-key color is determined by the
28054f38fcaSMauro Carvalho Chehab	``chromakey`` field of struct :c:type:`v4l2_window`
28154f38fcaSMauro Carvalho Chehab	and negotiated with the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`
28254f38fcaSMauro Carvalho Chehab	ioctl, see :ref:`overlay` and :ref:`osd`.
28354f38fcaSMauro Carvalho Chehab    * - :cspan:`2` There are no flags to enable clipping using a list of
28454f38fcaSMauro Carvalho Chehab	clip rectangles or a bitmap. These methods are negotiated with the
28554f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
28654f38fcaSMauro Carvalho Chehab	and :ref:`osd`.
28754f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_FLAG_LOCAL_ALPHA``
28854f38fcaSMauro Carvalho Chehab      - 0x0008
28954f38fcaSMauro Carvalho Chehab      - Use the alpha channel of the framebuffer to clip or blend
29054f38fcaSMauro Carvalho Chehab	framebuffer pixels with video images. The blend function is:
29154f38fcaSMauro Carvalho Chehab	output = framebuffer pixel * alpha + video pixel * (1 - alpha).
29254f38fcaSMauro Carvalho Chehab	The actual alpha depth depends on the framebuffer pixel format.
29354f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_FLAG_GLOBAL_ALPHA``
29454f38fcaSMauro Carvalho Chehab      - 0x0010
29554f38fcaSMauro Carvalho Chehab      - Use a global alpha value to blend the framebuffer with video
29654f38fcaSMauro Carvalho Chehab	images. The blend function is: output = (framebuffer pixel * alpha
29754f38fcaSMauro Carvalho Chehab	+ video pixel * (255 - alpha)) / 255. The alpha value is
29854f38fcaSMauro Carvalho Chehab	determined by the ``global_alpha`` field of struct
29954f38fcaSMauro Carvalho Chehab	:c:type:`v4l2_window` and negotiated with the
30054f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
30154f38fcaSMauro Carvalho Chehab	and :ref:`osd`.
30254f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_FLAG_LOCAL_INV_ALPHA``
30354f38fcaSMauro Carvalho Chehab      - 0x0020
30454f38fcaSMauro Carvalho Chehab      - Like ``V4L2_FBUF_FLAG_LOCAL_ALPHA``, use the alpha channel of the
30554f38fcaSMauro Carvalho Chehab	framebuffer to clip or blend framebuffer pixels with video images,
30654f38fcaSMauro Carvalho Chehab	but with an inverted alpha value. The blend function is: output =
30754f38fcaSMauro Carvalho Chehab	framebuffer pixel * (1 - alpha) + video pixel * alpha. The actual
30854f38fcaSMauro Carvalho Chehab	alpha depth depends on the framebuffer pixel format.
30954f38fcaSMauro Carvalho Chehab    * - ``V4L2_FBUF_FLAG_SRC_CHROMAKEY``
31054f38fcaSMauro Carvalho Chehab      - 0x0040
31154f38fcaSMauro Carvalho Chehab      - Use source chroma-keying. The source chroma-key color is
31254f38fcaSMauro Carvalho Chehab	determined by the ``chromakey`` field of struct
31354f38fcaSMauro Carvalho Chehab	:c:type:`v4l2_window` and negotiated with the
31454f38fcaSMauro Carvalho Chehab	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
31554f38fcaSMauro Carvalho Chehab	and :ref:`osd`. Both chroma-keying are mutual exclusive to each
31654f38fcaSMauro Carvalho Chehab	other, so same ``chromakey`` field of struct
31754f38fcaSMauro Carvalho Chehab	:c:type:`v4l2_window` is being used.
31854f38fcaSMauro Carvalho Chehab
31954f38fcaSMauro Carvalho ChehabReturn Value
32054f38fcaSMauro Carvalho Chehab============
32154f38fcaSMauro Carvalho Chehab
32254f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set
32354f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the
32454f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter.
32554f38fcaSMauro Carvalho Chehab
32654f38fcaSMauro Carvalho ChehabEPERM
32754f38fcaSMauro Carvalho Chehab    :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` can only be called by a privileged user to
32854f38fcaSMauro Carvalho Chehab    negotiate the parameters for a destructive overlay.
32954f38fcaSMauro Carvalho Chehab
33054f38fcaSMauro Carvalho ChehabEINVAL
33154f38fcaSMauro Carvalho Chehab    The :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` parameters are unsuitable.
332