xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/vidioc-g-fbuf.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: V4L
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _VIDIOC_G_FBUF:
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun**********************************
7*4882a593Smuzhiyunioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF
8*4882a593Smuzhiyun**********************************
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunName
11*4882a593Smuzhiyun====
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunVIDIOC_G_FBUF - VIDIOC_S_FBUF - Get or set frame buffer overlay parameters
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunSynopsis
16*4882a593Smuzhiyun========
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:macro:: VIDIOC_G_FBUF
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_G_FBUF, struct v4l2_framebuffer *argp)``
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun.. c:macro:: VIDIOC_S_FBUF
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun``int ioctl(int fd, VIDIOC_S_FBUF, const struct v4l2_framebuffer *argp)``
25*4882a593Smuzhiyun
26*4882a593SmuzhiyunArguments
27*4882a593Smuzhiyun=========
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun``fd``
30*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun``argp``
33*4882a593Smuzhiyun    Pointer to struct :c:type:`v4l2_framebuffer`.
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunDescription
36*4882a593Smuzhiyun===========
37*4882a593Smuzhiyun
38*4882a593SmuzhiyunApplications can use the :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` and :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` ioctl
39*4882a593Smuzhiyunto get and set the framebuffer parameters for a
40*4882a593Smuzhiyun:ref:`Video Overlay <overlay>` or :ref:`Video Output Overlay <osd>`
41*4882a593Smuzhiyun(OSD). The type of overlay is implied by the device type (capture or
42*4882a593Smuzhiyunoutput device) and can be determined with the
43*4882a593Smuzhiyun:ref:`VIDIOC_QUERYCAP` ioctl. One ``/dev/videoN``
44*4882a593Smuzhiyundevice must not support both kinds of overlay.
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunThe V4L2 API distinguishes destructive and non-destructive overlays. A
47*4882a593Smuzhiyundestructive overlay copies captured video images into the video memory
48*4882a593Smuzhiyunof a graphics card. A non-destructive overlay blends video images into a
49*4882a593SmuzhiyunVGA signal or graphics into a video signal. *Video Output Overlays* are
50*4882a593Smuzhiyunalways non-destructive.
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunTo get the current parameters applications call the :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`
53*4882a593Smuzhiyunioctl with a pointer to a struct :c:type:`v4l2_framebuffer`
54*4882a593Smuzhiyunstructure. The driver fills all fields of the structure or returns an
55*4882a593SmuzhiyunEINVAL error code when overlays are not supported.
56*4882a593Smuzhiyun
57*4882a593SmuzhiyunTo set the parameters for a *Video Output Overlay*, applications must
58*4882a593Smuzhiyuninitialize the ``flags`` field of a struct
59*4882a593Smuzhiyun:c:type:`v4l2_framebuffer`. Since the framebuffer is
60*4882a593Smuzhiyunimplemented on the TV card all other parameters are determined by the
61*4882a593Smuzhiyundriver. When an application calls :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` with a pointer to
62*4882a593Smuzhiyunthis structure, the driver prepares for the overlay and returns the
63*4882a593Smuzhiyunframebuffer parameters as :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>` does, or it returns an error
64*4882a593Smuzhiyuncode.
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunTo set the parameters for a *non-destructive Video Overlay*,
67*4882a593Smuzhiyunapplications must initialize the ``flags`` field, the ``fmt``
68*4882a593Smuzhiyunsubstructure, and call :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>`. Again the driver prepares for
69*4882a593Smuzhiyunthe overlay and returns the framebuffer parameters as :ref:`VIDIOC_G_FBUF <VIDIOC_G_FBUF>`
70*4882a593Smuzhiyundoes, or it returns an error code.
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunFor a *destructive Video Overlay* applications must additionally provide
73*4882a593Smuzhiyuna ``base`` address. Setting up a DMA to a random memory location can
74*4882a593Smuzhiyunjeopardize the system security, its stability or even damage the
75*4882a593Smuzhiyunhardware, therefore only the superuser can set the parameters for a
76*4882a593Smuzhiyundestructive video overlay.
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun.. tabularcolumns:: |p{3.5cm}|p{3.5cm}|p{3.5cm}|p{7.0cm}|
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun.. c:type:: v4l2_framebuffer
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun.. cssclass:: longtable
83*4882a593Smuzhiyun
84*4882a593Smuzhiyun.. flat-table:: struct v4l2_framebuffer
85*4882a593Smuzhiyun    :header-rows:  0
86*4882a593Smuzhiyun    :stub-columns: 0
87*4882a593Smuzhiyun    :widths:       1 1 1 2
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun    * - __u32
90*4882a593Smuzhiyun      - ``capability``
91*4882a593Smuzhiyun      -
92*4882a593Smuzhiyun      - Overlay capability flags set by the driver, see
93*4882a593Smuzhiyun	:ref:`framebuffer-cap`.
94*4882a593Smuzhiyun    * - __u32
95*4882a593Smuzhiyun      - ``flags``
96*4882a593Smuzhiyun      -
97*4882a593Smuzhiyun      - Overlay control flags set by application and driver, see
98*4882a593Smuzhiyun	:ref:`framebuffer-flags`
99*4882a593Smuzhiyun    * - void *
100*4882a593Smuzhiyun      - ``base``
101*4882a593Smuzhiyun      -
102*4882a593Smuzhiyun      - Physical base address of the framebuffer, that is the address of
103*4882a593Smuzhiyun	the pixel in the top left corner of the framebuffer. [#f1]_
104*4882a593Smuzhiyun    * -
105*4882a593Smuzhiyun      -
106*4882a593Smuzhiyun      -
107*4882a593Smuzhiyun      - This field is irrelevant to *non-destructive Video Overlays*. For
108*4882a593Smuzhiyun	*destructive Video Overlays* applications must provide a base
109*4882a593Smuzhiyun	address. The driver may accept only base addresses which are a
110*4882a593Smuzhiyun	multiple of two, four or eight bytes. For *Video Output Overlays*
111*4882a593Smuzhiyun	the driver must return a valid base address, so applications can
112*4882a593Smuzhiyun	find the corresponding Linux framebuffer device (see
113*4882a593Smuzhiyun	:ref:`osd`).
114*4882a593Smuzhiyun    * - struct
115*4882a593Smuzhiyun      - ``fmt``
116*4882a593Smuzhiyun      -
117*4882a593Smuzhiyun      - Layout of the frame buffer.
118*4882a593Smuzhiyun    * -
119*4882a593Smuzhiyun      - __u32
120*4882a593Smuzhiyun      - ``width``
121*4882a593Smuzhiyun      - Width of the frame buffer in pixels.
122*4882a593Smuzhiyun    * -
123*4882a593Smuzhiyun      - __u32
124*4882a593Smuzhiyun      - ``height``
125*4882a593Smuzhiyun      - Height of the frame buffer in pixels.
126*4882a593Smuzhiyun    * -
127*4882a593Smuzhiyun      - __u32
128*4882a593Smuzhiyun      - ``pixelformat``
129*4882a593Smuzhiyun      - The pixel format of the framebuffer.
130*4882a593Smuzhiyun    * -
131*4882a593Smuzhiyun      -
132*4882a593Smuzhiyun      -
133*4882a593Smuzhiyun      - For *non-destructive Video Overlays* this field only defines a
134*4882a593Smuzhiyun	format for the struct :c:type:`v4l2_window`
135*4882a593Smuzhiyun	``chromakey`` field.
136*4882a593Smuzhiyun    * -
137*4882a593Smuzhiyun      -
138*4882a593Smuzhiyun      -
139*4882a593Smuzhiyun      - For *destructive Video Overlays* applications must initialize this
140*4882a593Smuzhiyun	field. For *Video Output Overlays* the driver must return a valid
141*4882a593Smuzhiyun	format.
142*4882a593Smuzhiyun    * -
143*4882a593Smuzhiyun      -
144*4882a593Smuzhiyun      -
145*4882a593Smuzhiyun      - Usually this is an RGB format (for example
146*4882a593Smuzhiyun	:ref:`V4L2_PIX_FMT_RGB565 <V4L2-PIX-FMT-RGB565>`) but YUV
147*4882a593Smuzhiyun	formats (only packed YUV formats when chroma keying is used, not
148*4882a593Smuzhiyun	including ``V4L2_PIX_FMT_YUYV`` and ``V4L2_PIX_FMT_UYVY``) and the
149*4882a593Smuzhiyun	``V4L2_PIX_FMT_PAL8`` format are also permitted. The behavior of
150*4882a593Smuzhiyun	the driver when an application requests a compressed format is
151*4882a593Smuzhiyun	undefined. See :ref:`pixfmt` for information on pixel formats.
152*4882a593Smuzhiyun    * -
153*4882a593Smuzhiyun      - enum :c:type:`v4l2_field`
154*4882a593Smuzhiyun      - ``field``
155*4882a593Smuzhiyun      - Drivers and applications shall ignore this field. If applicable,
156*4882a593Smuzhiyun	the field order is selected with the
157*4882a593Smuzhiyun	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, using the ``field``
158*4882a593Smuzhiyun	field of struct :c:type:`v4l2_window`.
159*4882a593Smuzhiyun    * -
160*4882a593Smuzhiyun      - __u32
161*4882a593Smuzhiyun      - ``bytesperline``
162*4882a593Smuzhiyun      - Distance in bytes between the leftmost pixels in two adjacent
163*4882a593Smuzhiyun	lines.
164*4882a593Smuzhiyun    * - :cspan:`3`
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun	This field is irrelevant to *non-destructive Video Overlays*.
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun	For *destructive Video Overlays* both applications and drivers can
169*4882a593Smuzhiyun	set this field to request padding bytes at the end of each line.
170*4882a593Smuzhiyun	Drivers however may ignore the requested value, returning
171*4882a593Smuzhiyun	``width`` times bytes-per-pixel or a larger value required by the
172*4882a593Smuzhiyun	hardware. That implies applications can just set this field to
173*4882a593Smuzhiyun	zero to get a reasonable default.
174*4882a593Smuzhiyun
175*4882a593Smuzhiyun	For *Video Output Overlays* the driver must return a valid value.
176*4882a593Smuzhiyun
177*4882a593Smuzhiyun	Video hardware may access padding bytes, therefore they must
178*4882a593Smuzhiyun	reside in accessible memory. Consider for example the case where
179*4882a593Smuzhiyun	padding bytes after the last line of an image cross a system page
180*4882a593Smuzhiyun	boundary. Capture devices may write padding bytes, the value is
181*4882a593Smuzhiyun	undefined. Output devices ignore the contents of padding bytes.
182*4882a593Smuzhiyun
183*4882a593Smuzhiyun	When the image format is planar the ``bytesperline`` value applies
184*4882a593Smuzhiyun	to the first plane and is divided by the same factor as the
185*4882a593Smuzhiyun	``width`` field for the other planes. For example the Cb and Cr
186*4882a593Smuzhiyun	planes of a YUV 4:2:0 image have half as many padding bytes
187*4882a593Smuzhiyun	following each line as the Y plane. To avoid ambiguities drivers
188*4882a593Smuzhiyun	must return a ``bytesperline`` value rounded up to a multiple of
189*4882a593Smuzhiyun	the scale factor.
190*4882a593Smuzhiyun    * -
191*4882a593Smuzhiyun      - __u32
192*4882a593Smuzhiyun      - ``sizeimage``
193*4882a593Smuzhiyun      - This field is irrelevant to *non-destructive Video Overlays*. For
194*4882a593Smuzhiyun	*destructive Video Overlays* applications must initialize this
195*4882a593Smuzhiyun	field. For *Video Output Overlays* the driver must return a valid
196*4882a593Smuzhiyun	format.
197*4882a593Smuzhiyun
198*4882a593Smuzhiyun	Together with ``base`` it defines the framebuffer memory
199*4882a593Smuzhiyun	accessible by the driver.
200*4882a593Smuzhiyun    * -
201*4882a593Smuzhiyun      - enum :c:type:`v4l2_colorspace`
202*4882a593Smuzhiyun      - ``colorspace``
203*4882a593Smuzhiyun      - This information supplements the ``pixelformat`` and must be set
204*4882a593Smuzhiyun	by the driver, see :ref:`colorspaces`.
205*4882a593Smuzhiyun    * -
206*4882a593Smuzhiyun      - __u32
207*4882a593Smuzhiyun      - ``priv``
208*4882a593Smuzhiyun      - Reserved. Drivers and applications must set this field to zero.
209*4882a593Smuzhiyun
210*4882a593Smuzhiyun.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
211*4882a593Smuzhiyun
212*4882a593Smuzhiyun.. _framebuffer-cap:
213*4882a593Smuzhiyun
214*4882a593Smuzhiyun.. flat-table:: Frame Buffer Capability Flags
215*4882a593Smuzhiyun    :header-rows:  0
216*4882a593Smuzhiyun    :stub-columns: 0
217*4882a593Smuzhiyun    :widths:       3 1 4
218*4882a593Smuzhiyun
219*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_EXTERNOVERLAY``
220*4882a593Smuzhiyun      - 0x0001
221*4882a593Smuzhiyun      - The device is capable of non-destructive overlays. When the driver
222*4882a593Smuzhiyun	clears this flag, only destructive overlays are supported. There
223*4882a593Smuzhiyun	are no drivers yet which support both destructive and
224*4882a593Smuzhiyun	non-destructive overlays. Video Output Overlays are in practice
225*4882a593Smuzhiyun	always non-destructive.
226*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_CHROMAKEY``
227*4882a593Smuzhiyun      - 0x0002
228*4882a593Smuzhiyun      - The device supports clipping by chroma-keying the images. That is,
229*4882a593Smuzhiyun	image pixels replace pixels in the VGA or video signal only where
230*4882a593Smuzhiyun	the latter assume a certain color. Chroma-keying makes no sense
231*4882a593Smuzhiyun	for destructive overlays.
232*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_LIST_CLIPPING``
233*4882a593Smuzhiyun      - 0x0004
234*4882a593Smuzhiyun      - The device supports clipping using a list of clip rectangles.
235*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_BITMAP_CLIPPING``
236*4882a593Smuzhiyun      - 0x0008
237*4882a593Smuzhiyun      - The device supports clipping using a bit mask.
238*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_LOCAL_ALPHA``
239*4882a593Smuzhiyun      - 0x0010
240*4882a593Smuzhiyun      - The device supports clipping/blending using the alpha channel of
241*4882a593Smuzhiyun	the framebuffer or VGA signal. Alpha blending makes no sense for
242*4882a593Smuzhiyun	destructive overlays.
243*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_GLOBAL_ALPHA``
244*4882a593Smuzhiyun      - 0x0020
245*4882a593Smuzhiyun      - The device supports alpha blending using a global alpha value.
246*4882a593Smuzhiyun	Alpha blending makes no sense for destructive overlays.
247*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_LOCAL_INV_ALPHA``
248*4882a593Smuzhiyun      - 0x0040
249*4882a593Smuzhiyun      - The device supports clipping/blending using the inverted alpha
250*4882a593Smuzhiyun	channel of the framebuffer or VGA signal. Alpha blending makes no
251*4882a593Smuzhiyun	sense for destructive overlays.
252*4882a593Smuzhiyun    * - ``V4L2_FBUF_CAP_SRC_CHROMAKEY``
253*4882a593Smuzhiyun      - 0x0080
254*4882a593Smuzhiyun      - The device supports Source Chroma-keying. Video pixels with the
255*4882a593Smuzhiyun	chroma-key colors are replaced by framebuffer pixels, which is
256*4882a593Smuzhiyun	exactly opposite of ``V4L2_FBUF_CAP_CHROMAKEY``
257*4882a593Smuzhiyun
258*4882a593Smuzhiyun.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
259*4882a593Smuzhiyun
260*4882a593Smuzhiyun.. _framebuffer-flags:
261*4882a593Smuzhiyun
262*4882a593Smuzhiyun.. cssclass:: longtable
263*4882a593Smuzhiyun
264*4882a593Smuzhiyun.. flat-table:: Frame Buffer Flags
265*4882a593Smuzhiyun    :header-rows:  0
266*4882a593Smuzhiyun    :stub-columns: 0
267*4882a593Smuzhiyun    :widths:       3 1 4
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun    * - ``V4L2_FBUF_FLAG_PRIMARY``
270*4882a593Smuzhiyun      - 0x0001
271*4882a593Smuzhiyun      - The framebuffer is the primary graphics surface. In other words,
272*4882a593Smuzhiyun	the overlay is destructive. This flag is typically set by any
273*4882a593Smuzhiyun	driver that doesn't have the ``V4L2_FBUF_CAP_EXTERNOVERLAY``
274*4882a593Smuzhiyun	capability and it is cleared otherwise.
275*4882a593Smuzhiyun    * - ``V4L2_FBUF_FLAG_OVERLAY``
276*4882a593Smuzhiyun      - 0x0002
277*4882a593Smuzhiyun      - If this flag is set for a video capture device, then the driver
278*4882a593Smuzhiyun	will set the initial overlay size to cover the full framebuffer
279*4882a593Smuzhiyun	size, otherwise the existing overlay size (as set by
280*4882a593Smuzhiyun	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`) will be used. Only one
281*4882a593Smuzhiyun	video capture driver (bttv) supports this flag. The use of this
282*4882a593Smuzhiyun	flag for capture devices is deprecated. There is no way to detect
283*4882a593Smuzhiyun	which drivers support this flag, so the only reliable method of
284*4882a593Smuzhiyun	setting the overlay size is through
285*4882a593Smuzhiyun	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`. If this flag is set for a
286*4882a593Smuzhiyun	video output device, then the video output overlay window is
287*4882a593Smuzhiyun	relative to the top-left corner of the framebuffer and restricted
288*4882a593Smuzhiyun	to the size of the framebuffer. If it is cleared, then the video
289*4882a593Smuzhiyun	output overlay window is relative to the video output display.
290*4882a593Smuzhiyun    * - ``V4L2_FBUF_FLAG_CHROMAKEY``
291*4882a593Smuzhiyun      - 0x0004
292*4882a593Smuzhiyun      - Use chroma-keying. The chroma-key color is determined by the
293*4882a593Smuzhiyun	``chromakey`` field of struct :c:type:`v4l2_window`
294*4882a593Smuzhiyun	and negotiated with the :ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>`
295*4882a593Smuzhiyun	ioctl, see :ref:`overlay` and :ref:`osd`.
296*4882a593Smuzhiyun    * - :cspan:`2` There are no flags to enable clipping using a list of
297*4882a593Smuzhiyun	clip rectangles or a bitmap. These methods are negotiated with the
298*4882a593Smuzhiyun	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
299*4882a593Smuzhiyun	and :ref:`osd`.
300*4882a593Smuzhiyun    * - ``V4L2_FBUF_FLAG_LOCAL_ALPHA``
301*4882a593Smuzhiyun      - 0x0008
302*4882a593Smuzhiyun      - Use the alpha channel of the framebuffer to clip or blend
303*4882a593Smuzhiyun	framebuffer pixels with video images. The blend function is:
304*4882a593Smuzhiyun	output = framebuffer pixel * alpha + video pixel * (1 - alpha).
305*4882a593Smuzhiyun	The actual alpha depth depends on the framebuffer pixel format.
306*4882a593Smuzhiyun    * - ``V4L2_FBUF_FLAG_GLOBAL_ALPHA``
307*4882a593Smuzhiyun      - 0x0010
308*4882a593Smuzhiyun      - Use a global alpha value to blend the framebuffer with video
309*4882a593Smuzhiyun	images. The blend function is: output = (framebuffer pixel * alpha
310*4882a593Smuzhiyun	+ video pixel * (255 - alpha)) / 255. The alpha value is
311*4882a593Smuzhiyun	determined by the ``global_alpha`` field of struct
312*4882a593Smuzhiyun	:c:type:`v4l2_window` and negotiated with the
313*4882a593Smuzhiyun	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
314*4882a593Smuzhiyun	and :ref:`osd`.
315*4882a593Smuzhiyun    * - ``V4L2_FBUF_FLAG_LOCAL_INV_ALPHA``
316*4882a593Smuzhiyun      - 0x0020
317*4882a593Smuzhiyun      - Like ``V4L2_FBUF_FLAG_LOCAL_ALPHA``, use the alpha channel of the
318*4882a593Smuzhiyun	framebuffer to clip or blend framebuffer pixels with video images,
319*4882a593Smuzhiyun	but with an inverted alpha value. The blend function is: output =
320*4882a593Smuzhiyun	framebuffer pixel * (1 - alpha) + video pixel * alpha. The actual
321*4882a593Smuzhiyun	alpha depth depends on the framebuffer pixel format.
322*4882a593Smuzhiyun    * - ``V4L2_FBUF_FLAG_SRC_CHROMAKEY``
323*4882a593Smuzhiyun      - 0x0040
324*4882a593Smuzhiyun      - Use source chroma-keying. The source chroma-key color is
325*4882a593Smuzhiyun	determined by the ``chromakey`` field of struct
326*4882a593Smuzhiyun	:c:type:`v4l2_window` and negotiated with the
327*4882a593Smuzhiyun	:ref:`VIDIOC_S_FMT <VIDIOC_G_FMT>` ioctl, see :ref:`overlay`
328*4882a593Smuzhiyun	and :ref:`osd`. Both chroma-keying are mutual exclusive to each
329*4882a593Smuzhiyun	other, so same ``chromakey`` field of struct
330*4882a593Smuzhiyun	:c:type:`v4l2_window` is being used.
331*4882a593Smuzhiyun
332*4882a593SmuzhiyunReturn Value
333*4882a593Smuzhiyun============
334*4882a593Smuzhiyun
335*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
336*4882a593Smuzhiyunappropriately. The generic error codes are described at the
337*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
338*4882a593Smuzhiyun
339*4882a593SmuzhiyunEPERM
340*4882a593Smuzhiyun    :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` can only be called by a privileged user to
341*4882a593Smuzhiyun    negotiate the parameters for a destructive overlay.
342*4882a593Smuzhiyun
343*4882a593SmuzhiyunEINVAL
344*4882a593Smuzhiyun    The :ref:`VIDIOC_S_FBUF <VIDIOC_G_FBUF>` parameters are unsuitable.
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun.. [#f1]
347*4882a593Smuzhiyun   A physical base address may not suit all platforms. GK notes in
348*4882a593Smuzhiyun   theory we should pass something like PCI device + memory region +
349*4882a593Smuzhiyun   offset instead. If you encounter problems please discuss on the
350*4882a593Smuzhiyun   linux-media mailing list:
351*4882a593Smuzhiyun   `https://linuxtv.org/lists.php <https://linuxtv.org/lists.php>`__.
352