1*6c119a46SAndroid Build Coastguard Worker<?xml version="1.0" encoding="UTF-8"?>
2*6c119a46SAndroid Build Coastguard Worker<protocol name="linux_dmabuf_unstable_v1">
3*6c119a46SAndroid Build Coastguard Worker
4*6c119a46SAndroid Build Coastguard Worker  <copyright>
5*6c119a46SAndroid Build Coastguard Worker    Copyright © 2014, 2015 Collabora, Ltd.
6*6c119a46SAndroid Build Coastguard Worker
7*6c119a46SAndroid Build Coastguard Worker    Permission is hereby granted, free of charge, to any person obtaining a
8*6c119a46SAndroid Build Coastguard Worker    copy of this software and associated documentation files (the "Software"),
9*6c119a46SAndroid Build Coastguard Worker    to deal in the Software without restriction, including without limitation
10*6c119a46SAndroid Build Coastguard Worker    the rights to use, copy, modify, merge, publish, distribute, sublicense,
11*6c119a46SAndroid Build Coastguard Worker    and/or sell copies of the Software, and to permit persons to whom the
12*6c119a46SAndroid Build Coastguard Worker    Software is furnished to do so, subject to the following conditions:
13*6c119a46SAndroid Build Coastguard Worker
14*6c119a46SAndroid Build Coastguard Worker    The above copyright notice and this permission notice (including the next
15*6c119a46SAndroid Build Coastguard Worker    paragraph) shall be included in all copies or substantial portions of the
16*6c119a46SAndroid Build Coastguard Worker    Software.
17*6c119a46SAndroid Build Coastguard Worker
18*6c119a46SAndroid Build Coastguard Worker    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19*6c119a46SAndroid Build Coastguard Worker    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20*6c119a46SAndroid Build Coastguard Worker    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21*6c119a46SAndroid Build Coastguard Worker    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22*6c119a46SAndroid Build Coastguard Worker    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23*6c119a46SAndroid Build Coastguard Worker    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24*6c119a46SAndroid Build Coastguard Worker    DEALINGS IN THE SOFTWARE.
25*6c119a46SAndroid Build Coastguard Worker  </copyright>
26*6c119a46SAndroid Build Coastguard Worker
27*6c119a46SAndroid Build Coastguard Worker  <interface name="zwp_linux_dmabuf_v1" version="3">
28*6c119a46SAndroid Build Coastguard Worker    <description summary="factory for creating dmabuf-based wl_buffers">
29*6c119a46SAndroid Build Coastguard Worker      Following the interfaces from:
30*6c119a46SAndroid Build Coastguard Worker      https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
31*6c119a46SAndroid Build Coastguard Worker      https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt
32*6c119a46SAndroid Build Coastguard Worker      and the Linux DRM sub-system's AddFb2 ioctl.
33*6c119a46SAndroid Build Coastguard Worker
34*6c119a46SAndroid Build Coastguard Worker      This interface offers ways to create generic dmabuf-based
35*6c119a46SAndroid Build Coastguard Worker      wl_buffers. Immediately after a client binds to this interface,
36*6c119a46SAndroid Build Coastguard Worker      the set of supported formats and format modifiers is sent with
37*6c119a46SAndroid Build Coastguard Worker      'format' and 'modifier' events.
38*6c119a46SAndroid Build Coastguard Worker
39*6c119a46SAndroid Build Coastguard Worker      The following are required from clients:
40*6c119a46SAndroid Build Coastguard Worker
41*6c119a46SAndroid Build Coastguard Worker      - Clients must ensure that either all data in the dma-buf is
42*6c119a46SAndroid Build Coastguard Worker        coherent for all subsequent read access or that coherency is
43*6c119a46SAndroid Build Coastguard Worker        correctly handled by the underlying kernel-side dma-buf
44*6c119a46SAndroid Build Coastguard Worker        implementation.
45*6c119a46SAndroid Build Coastguard Worker
46*6c119a46SAndroid Build Coastguard Worker      - Don't make any more attachments after sending the buffer to the
47*6c119a46SAndroid Build Coastguard Worker        compositor. Making more attachments later increases the risk of
48*6c119a46SAndroid Build Coastguard Worker        the compositor not being able to use (re-import) an existing
49*6c119a46SAndroid Build Coastguard Worker        dmabuf-based wl_buffer.
50*6c119a46SAndroid Build Coastguard Worker
51*6c119a46SAndroid Build Coastguard Worker      The underlying graphics stack must ensure the following:
52*6c119a46SAndroid Build Coastguard Worker
53*6c119a46SAndroid Build Coastguard Worker      - The dmabuf file descriptors relayed to the server will stay valid
54*6c119a46SAndroid Build Coastguard Worker        for the whole lifetime of the wl_buffer. This means the server may
55*6c119a46SAndroid Build Coastguard Worker        at any time use those fds to import the dmabuf into any kernel
56*6c119a46SAndroid Build Coastguard Worker        sub-system that might accept it.
57*6c119a46SAndroid Build Coastguard Worker
58*6c119a46SAndroid Build Coastguard Worker      However, when the underlying graphics stack fails to deliver the
59*6c119a46SAndroid Build Coastguard Worker      promise, because of e.g. a device hot-unplug which raises internal
60*6c119a46SAndroid Build Coastguard Worker      errors, after the wl_buffer has been successfully created the
61*6c119a46SAndroid Build Coastguard Worker      compositor must not raise protocol errors to the client when dmabuf
62*6c119a46SAndroid Build Coastguard Worker      import later fails.
63*6c119a46SAndroid Build Coastguard Worker
64*6c119a46SAndroid Build Coastguard Worker      To create a wl_buffer from one or more dmabufs, a client creates a
65*6c119a46SAndroid Build Coastguard Worker      zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params
66*6c119a46SAndroid Build Coastguard Worker      request. All planes required by the intended format are added with
67*6c119a46SAndroid Build Coastguard Worker      the 'add' request. Finally, a 'create' or 'create_immed' request is
68*6c119a46SAndroid Build Coastguard Worker      issued, which has the following outcome depending on the import success.
69*6c119a46SAndroid Build Coastguard Worker
70*6c119a46SAndroid Build Coastguard Worker      The 'create' request,
71*6c119a46SAndroid Build Coastguard Worker      - on success, triggers a 'created' event which provides the final
72*6c119a46SAndroid Build Coastguard Worker        wl_buffer to the client.
73*6c119a46SAndroid Build Coastguard Worker      - on failure, triggers a 'failed' event to convey that the server
74*6c119a46SAndroid Build Coastguard Worker        cannot use the dmabufs received from the client.
75*6c119a46SAndroid Build Coastguard Worker
76*6c119a46SAndroid Build Coastguard Worker      For the 'create_immed' request,
77*6c119a46SAndroid Build Coastguard Worker      - on success, the server immediately imports the added dmabufs to
78*6c119a46SAndroid Build Coastguard Worker        create a wl_buffer. No event is sent from the server in this case.
79*6c119a46SAndroid Build Coastguard Worker      - on failure, the server can choose to either:
80*6c119a46SAndroid Build Coastguard Worker        - terminate the client by raising a fatal error.
81*6c119a46SAndroid Build Coastguard Worker        - mark the wl_buffer as failed, and send a 'failed' event to the
82*6c119a46SAndroid Build Coastguard Worker          client. If the client uses a failed wl_buffer as an argument to any
83*6c119a46SAndroid Build Coastguard Worker          request, the behaviour is compositor implementation-defined.
84*6c119a46SAndroid Build Coastguard Worker
85*6c119a46SAndroid Build Coastguard Worker      Warning! The protocol described in this file is experimental and
86*6c119a46SAndroid Build Coastguard Worker      backward incompatible changes may be made. Backward compatible changes
87*6c119a46SAndroid Build Coastguard Worker      may be added together with the corresponding interface version bump.
88*6c119a46SAndroid Build Coastguard Worker      Backward incompatible changes are done by bumping the version number in
89*6c119a46SAndroid Build Coastguard Worker      the protocol and interface names and resetting the interface version.
90*6c119a46SAndroid Build Coastguard Worker      Once the protocol is to be declared stable, the 'z' prefix and the
91*6c119a46SAndroid Build Coastguard Worker      version number in the protocol and interface names are removed and the
92*6c119a46SAndroid Build Coastguard Worker      interface version number is reset.
93*6c119a46SAndroid Build Coastguard Worker    </description>
94*6c119a46SAndroid Build Coastguard Worker
95*6c119a46SAndroid Build Coastguard Worker    <request name="destroy" type="destructor">
96*6c119a46SAndroid Build Coastguard Worker      <description summary="unbind the factory">
97*6c119a46SAndroid Build Coastguard Worker        Objects created through this interface, especially wl_buffers, will
98*6c119a46SAndroid Build Coastguard Worker        remain valid.
99*6c119a46SAndroid Build Coastguard Worker      </description>
100*6c119a46SAndroid Build Coastguard Worker    </request>
101*6c119a46SAndroid Build Coastguard Worker
102*6c119a46SAndroid Build Coastguard Worker    <request name="create_params">
103*6c119a46SAndroid Build Coastguard Worker      <description summary="create a temporary object for buffer parameters">
104*6c119a46SAndroid Build Coastguard Worker        This temporary object is used to collect multiple dmabuf handles into
105*6c119a46SAndroid Build Coastguard Worker        a single batch to create a wl_buffer. It can only be used once and
106*6c119a46SAndroid Build Coastguard Worker        should be destroyed after a 'created' or 'failed' event has been
107*6c119a46SAndroid Build Coastguard Worker        received.
108*6c119a46SAndroid Build Coastguard Worker      </description>
109*6c119a46SAndroid Build Coastguard Worker      <arg name="params_id" type="new_id" interface="zwp_linux_buffer_params_v1"
110*6c119a46SAndroid Build Coastguard Worker           summary="the new temporary"/>
111*6c119a46SAndroid Build Coastguard Worker    </request>
112*6c119a46SAndroid Build Coastguard Worker
113*6c119a46SAndroid Build Coastguard Worker    <event name="format">
114*6c119a46SAndroid Build Coastguard Worker      <description summary="supported buffer format">
115*6c119a46SAndroid Build Coastguard Worker        This event advertises one buffer format that the server supports.
116*6c119a46SAndroid Build Coastguard Worker        All the supported formats are advertised once when the client
117*6c119a46SAndroid Build Coastguard Worker        binds to this interface. A roundtrip after binding guarantees
118*6c119a46SAndroid Build Coastguard Worker        that the client has received all supported formats.
119*6c119a46SAndroid Build Coastguard Worker
120*6c119a46SAndroid Build Coastguard Worker        For the definition of the format codes, see the
121*6c119a46SAndroid Build Coastguard Worker        zwp_linux_buffer_params_v1::create request.
122*6c119a46SAndroid Build Coastguard Worker
123*6c119a46SAndroid Build Coastguard Worker        Warning: the 'format' event is likely to be deprecated and replaced
124*6c119a46SAndroid Build Coastguard Worker        with the 'modifier' event introduced in zwp_linux_dmabuf_v1
125*6c119a46SAndroid Build Coastguard Worker        version 3, described below. Please refrain from using the information
126*6c119a46SAndroid Build Coastguard Worker        received from this event.
127*6c119a46SAndroid Build Coastguard Worker      </description>
128*6c119a46SAndroid Build Coastguard Worker      <arg name="format" type="uint" summary="DRM_FORMAT code"/>
129*6c119a46SAndroid Build Coastguard Worker    </event>
130*6c119a46SAndroid Build Coastguard Worker
131*6c119a46SAndroid Build Coastguard Worker    <event name="modifier" since="3">
132*6c119a46SAndroid Build Coastguard Worker      <description summary="supported buffer format modifier">
133*6c119a46SAndroid Build Coastguard Worker        This event advertises the formats that the server supports, along with
134*6c119a46SAndroid Build Coastguard Worker        the modifiers supported for each format. All the supported modifiers
135*6c119a46SAndroid Build Coastguard Worker        for all the supported formats are advertised once when the client
136*6c119a46SAndroid Build Coastguard Worker        binds to this interface. A roundtrip after binding guarantees that
137*6c119a46SAndroid Build Coastguard Worker        the client has received all supported format-modifier pairs.
138*6c119a46SAndroid Build Coastguard Worker
139*6c119a46SAndroid Build Coastguard Worker        For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==
140*6c119a46SAndroid Build Coastguard Worker        0x00ffffff and modifier_lo == 0xffffffff) is allowed in this event.
141*6c119a46SAndroid Build Coastguard Worker        It indicates that the server can support the format with an implicit
142*6c119a46SAndroid Build Coastguard Worker        modifier. When a plane has DRM_FORMAT_MOD_INVALID as its modifier, it
143*6c119a46SAndroid Build Coastguard Worker        is as if no explicit modifier is specified. The effective modifier
144*6c119a46SAndroid Build Coastguard Worker        will be derived from the dmabuf.
145*6c119a46SAndroid Build Coastguard Worker
146*6c119a46SAndroid Build Coastguard Worker        A compositor that sends valid modifiers and DRM_FORMAT_MOD_INVALID for
147*6c119a46SAndroid Build Coastguard Worker        a given format supports both explicit modifiers and implicit modifiers.
148*6c119a46SAndroid Build Coastguard Worker
149*6c119a46SAndroid Build Coastguard Worker        For the definition of the format and modifier codes, see the
150*6c119a46SAndroid Build Coastguard Worker        zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add
151*6c119a46SAndroid Build Coastguard Worker        requests.
152*6c119a46SAndroid Build Coastguard Worker      </description>
153*6c119a46SAndroid Build Coastguard Worker      <arg name="format" type="uint" summary="DRM_FORMAT code"/>
154*6c119a46SAndroid Build Coastguard Worker      <arg name="modifier_hi" type="uint"
155*6c119a46SAndroid Build Coastguard Worker           summary="high 32 bits of layout modifier"/>
156*6c119a46SAndroid Build Coastguard Worker      <arg name="modifier_lo" type="uint"
157*6c119a46SAndroid Build Coastguard Worker           summary="low 32 bits of layout modifier"/>
158*6c119a46SAndroid Build Coastguard Worker    </event>
159*6c119a46SAndroid Build Coastguard Worker  </interface>
160*6c119a46SAndroid Build Coastguard Worker
161*6c119a46SAndroid Build Coastguard Worker  <interface name="zwp_linux_buffer_params_v1" version="3">
162*6c119a46SAndroid Build Coastguard Worker    <description summary="parameters for creating a dmabuf-based wl_buffer">
163*6c119a46SAndroid Build Coastguard Worker      This temporary object is a collection of dmabufs and other
164*6c119a46SAndroid Build Coastguard Worker      parameters that together form a single logical buffer. The temporary
165*6c119a46SAndroid Build Coastguard Worker      object may eventually create one wl_buffer unless cancelled by
166*6c119a46SAndroid Build Coastguard Worker      destroying it before requesting 'create'.
167*6c119a46SAndroid Build Coastguard Worker
168*6c119a46SAndroid Build Coastguard Worker      Single-planar formats only require one dmabuf, however
169*6c119a46SAndroid Build Coastguard Worker      multi-planar formats may require more than one dmabuf. For all
170*6c119a46SAndroid Build Coastguard Worker      formats, an 'add' request must be called once per plane (even if the
171*6c119a46SAndroid Build Coastguard Worker      underlying dmabuf fd is identical).
172*6c119a46SAndroid Build Coastguard Worker
173*6c119a46SAndroid Build Coastguard Worker      You must use consecutive plane indices ('plane_idx' argument for 'add')
174*6c119a46SAndroid Build Coastguard Worker      from zero to the number of planes used by the drm_fourcc format code.
175*6c119a46SAndroid Build Coastguard Worker      All planes required by the format must be given exactly once, but can
176*6c119a46SAndroid Build Coastguard Worker      be given in any order. Each plane index can be set only once.
177*6c119a46SAndroid Build Coastguard Worker    </description>
178*6c119a46SAndroid Build Coastguard Worker
179*6c119a46SAndroid Build Coastguard Worker    <enum name="error">
180*6c119a46SAndroid Build Coastguard Worker      <entry name="already_used" value="0"
181*6c119a46SAndroid Build Coastguard Worker             summary="the dmabuf_batch object has already been used to create a wl_buffer"/>
182*6c119a46SAndroid Build Coastguard Worker      <entry name="plane_idx" value="1"
183*6c119a46SAndroid Build Coastguard Worker             summary="plane index out of bounds"/>
184*6c119a46SAndroid Build Coastguard Worker      <entry name="plane_set" value="2"
185*6c119a46SAndroid Build Coastguard Worker             summary="the plane index was already set"/>
186*6c119a46SAndroid Build Coastguard Worker      <entry name="incomplete" value="3"
187*6c119a46SAndroid Build Coastguard Worker             summary="missing or too many planes to create a buffer"/>
188*6c119a46SAndroid Build Coastguard Worker      <entry name="invalid_format" value="4"
189*6c119a46SAndroid Build Coastguard Worker             summary="format not supported"/>
190*6c119a46SAndroid Build Coastguard Worker      <entry name="invalid_dimensions" value="5"
191*6c119a46SAndroid Build Coastguard Worker             summary="invalid width or height"/>
192*6c119a46SAndroid Build Coastguard Worker      <entry name="out_of_bounds" value="6"
193*6c119a46SAndroid Build Coastguard Worker             summary="offset + stride * height goes out of dmabuf bounds"/>
194*6c119a46SAndroid Build Coastguard Worker      <entry name="invalid_wl_buffer" value="7"
195*6c119a46SAndroid Build Coastguard Worker             summary="invalid wl_buffer resulted from importing dmabufs via
196*6c119a46SAndroid Build Coastguard Worker               the create_immed request on given buffer_params"/>
197*6c119a46SAndroid Build Coastguard Worker    </enum>
198*6c119a46SAndroid Build Coastguard Worker
199*6c119a46SAndroid Build Coastguard Worker    <request name="destroy" type="destructor">
200*6c119a46SAndroid Build Coastguard Worker      <description summary="delete this object, used or not">
201*6c119a46SAndroid Build Coastguard Worker        Cleans up the temporary data sent to the server for dmabuf-based
202*6c119a46SAndroid Build Coastguard Worker        wl_buffer creation.
203*6c119a46SAndroid Build Coastguard Worker      </description>
204*6c119a46SAndroid Build Coastguard Worker    </request>
205*6c119a46SAndroid Build Coastguard Worker
206*6c119a46SAndroid Build Coastguard Worker    <request name="add">
207*6c119a46SAndroid Build Coastguard Worker      <description summary="add a dmabuf to the temporary set">
208*6c119a46SAndroid Build Coastguard Worker        This request adds one dmabuf to the set in this
209*6c119a46SAndroid Build Coastguard Worker        zwp_linux_buffer_params_v1.
210*6c119a46SAndroid Build Coastguard Worker
211*6c119a46SAndroid Build Coastguard Worker        The 64-bit unsigned value combined from modifier_hi and modifier_lo
212*6c119a46SAndroid Build Coastguard Worker        is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the
213*6c119a46SAndroid Build Coastguard Worker        fb modifier, which is defined in drm_mode.h of Linux UAPI.
214*6c119a46SAndroid Build Coastguard Worker        This is an opaque token. Drivers use this token to express tiling,
215*6c119a46SAndroid Build Coastguard Worker        compression, etc. driver-specific modifications to the base format
216*6c119a46SAndroid Build Coastguard Worker        defined by the DRM fourcc code.
217*6c119a46SAndroid Build Coastguard Worker
218*6c119a46SAndroid Build Coastguard Worker        Warning: It should be an error if the format/modifier pair was not
219*6c119a46SAndroid Build Coastguard Worker        advertised with the modifier event. This is not enforced yet because
220*6c119a46SAndroid Build Coastguard Worker        some implementations always accept DRM_FORMAT_MOD_INVALID. Also
221*6c119a46SAndroid Build Coastguard Worker        version 2 of this protocol does not have the modifier event.
222*6c119a46SAndroid Build Coastguard Worker
223*6c119a46SAndroid Build Coastguard Worker        This request raises the PLANE_IDX error if plane_idx is too large.
224*6c119a46SAndroid Build Coastguard Worker        The error PLANE_SET is raised if attempting to set a plane that
225*6c119a46SAndroid Build Coastguard Worker        was already set.
226*6c119a46SAndroid Build Coastguard Worker      </description>
227*6c119a46SAndroid Build Coastguard Worker      <arg name="fd" type="fd" summary="dmabuf fd"/>
228*6c119a46SAndroid Build Coastguard Worker      <arg name="plane_idx" type="uint" summary="plane index"/>
229*6c119a46SAndroid Build Coastguard Worker      <arg name="offset" type="uint" summary="offset in bytes"/>
230*6c119a46SAndroid Build Coastguard Worker      <arg name="stride" type="uint" summary="stride in bytes"/>
231*6c119a46SAndroid Build Coastguard Worker      <arg name="modifier_hi" type="uint"
232*6c119a46SAndroid Build Coastguard Worker           summary="high 32 bits of layout modifier"/>
233*6c119a46SAndroid Build Coastguard Worker      <arg name="modifier_lo" type="uint"
234*6c119a46SAndroid Build Coastguard Worker           summary="low 32 bits of layout modifier"/>
235*6c119a46SAndroid Build Coastguard Worker    </request>
236*6c119a46SAndroid Build Coastguard Worker
237*6c119a46SAndroid Build Coastguard Worker    <enum name="flags" bitfield="true">
238*6c119a46SAndroid Build Coastguard Worker      <entry name="y_invert" value="1" summary="contents are y-inverted"/>
239*6c119a46SAndroid Build Coastguard Worker      <entry name="interlaced" value="2" summary="content is interlaced"/>
240*6c119a46SAndroid Build Coastguard Worker      <entry name="bottom_first" value="4" summary="bottom field first"/>
241*6c119a46SAndroid Build Coastguard Worker    </enum>
242*6c119a46SAndroid Build Coastguard Worker
243*6c119a46SAndroid Build Coastguard Worker    <request name="create">
244*6c119a46SAndroid Build Coastguard Worker      <description summary="create a wl_buffer from the given dmabufs">
245*6c119a46SAndroid Build Coastguard Worker        This asks for creation of a wl_buffer from the added dmabuf
246*6c119a46SAndroid Build Coastguard Worker        buffers. The wl_buffer is not created immediately but returned via
247*6c119a46SAndroid Build Coastguard Worker        the 'created' event if the dmabuf sharing succeeds. The sharing
248*6c119a46SAndroid Build Coastguard Worker        may fail at runtime for reasons a client cannot predict, in
249*6c119a46SAndroid Build Coastguard Worker        which case the 'failed' event is triggered.
250*6c119a46SAndroid Build Coastguard Worker
251*6c119a46SAndroid Build Coastguard Worker        The 'format' argument is a DRM_FORMAT code, as defined by the
252*6c119a46SAndroid Build Coastguard Worker        libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the
253*6c119a46SAndroid Build Coastguard Worker        authoritative source on how the format codes should work.
254*6c119a46SAndroid Build Coastguard Worker
255*6c119a46SAndroid Build Coastguard Worker        The 'flags' is a bitfield of the flags defined in enum "flags".
256*6c119a46SAndroid Build Coastguard Worker        'y_invert' means the that the image needs to be y-flipped.
257*6c119a46SAndroid Build Coastguard Worker
258*6c119a46SAndroid Build Coastguard Worker        Flag 'interlaced' means that the frame in the buffer is not
259*6c119a46SAndroid Build Coastguard Worker        progressive as usual, but interlaced. An interlaced buffer as
260*6c119a46SAndroid Build Coastguard Worker        supported here must always contain both top and bottom fields.
261*6c119a46SAndroid Build Coastguard Worker        The top field always begins on the first pixel row. The temporal
262*6c119a46SAndroid Build Coastguard Worker        ordering between the two fields is top field first, unless
263*6c119a46SAndroid Build Coastguard Worker        'bottom_first' is specified. It is undefined whether 'bottom_first'
264*6c119a46SAndroid Build Coastguard Worker        is ignored if 'interlaced' is not set.
265*6c119a46SAndroid Build Coastguard Worker
266*6c119a46SAndroid Build Coastguard Worker        This protocol does not convey any information about field rate,
267*6c119a46SAndroid Build Coastguard Worker        duration, or timing, other than the relative ordering between the
268*6c119a46SAndroid Build Coastguard Worker        two fields in one buffer. A compositor may have to estimate the
269*6c119a46SAndroid Build Coastguard Worker        intended field rate from the incoming buffer rate. It is undefined
270*6c119a46SAndroid Build Coastguard Worker        whether the time of receiving wl_surface.commit with a new buffer
271*6c119a46SAndroid Build Coastguard Worker        attached, applying the wl_surface state, wl_surface.frame callback
272*6c119a46SAndroid Build Coastguard Worker        trigger, presentation, or any other point in the compositor cycle
273*6c119a46SAndroid Build Coastguard Worker        is used to measure the frame or field times. There is no support
274*6c119a46SAndroid Build Coastguard Worker        for detecting missed or late frames/fields/buffers either, and
275*6c119a46SAndroid Build Coastguard Worker        there is no support whatsoever for cooperating with interlaced
276*6c119a46SAndroid Build Coastguard Worker        compositor output.
277*6c119a46SAndroid Build Coastguard Worker
278*6c119a46SAndroid Build Coastguard Worker        The composited image quality resulting from the use of interlaced
279*6c119a46SAndroid Build Coastguard Worker        buffers is explicitly undefined. A compositor may use elaborate
280*6c119a46SAndroid Build Coastguard Worker        hardware features or software to deinterlace and create progressive
281*6c119a46SAndroid Build Coastguard Worker        output frames from a sequence of interlaced input buffers, or it
282*6c119a46SAndroid Build Coastguard Worker        may produce substandard image quality. However, compositors that
283*6c119a46SAndroid Build Coastguard Worker        cannot guarantee reasonable image quality in all cases are recommended
284*6c119a46SAndroid Build Coastguard Worker        to just reject all interlaced buffers.
285*6c119a46SAndroid Build Coastguard Worker
286*6c119a46SAndroid Build Coastguard Worker        Any argument errors, including non-positive width or height,
287*6c119a46SAndroid Build Coastguard Worker        mismatch between the number of planes and the format, bad
288*6c119a46SAndroid Build Coastguard Worker        format, bad offset or stride, may be indicated by fatal protocol
289*6c119a46SAndroid Build Coastguard Worker        errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS,
290*6c119a46SAndroid Build Coastguard Worker        OUT_OF_BOUNDS.
291*6c119a46SAndroid Build Coastguard Worker
292*6c119a46SAndroid Build Coastguard Worker        Dmabuf import errors in the server that are not obvious client
293*6c119a46SAndroid Build Coastguard Worker        bugs are returned via the 'failed' event as non-fatal. This
294*6c119a46SAndroid Build Coastguard Worker        allows attempting dmabuf sharing and falling back in the client
295*6c119a46SAndroid Build Coastguard Worker        if it fails.
296*6c119a46SAndroid Build Coastguard Worker
297*6c119a46SAndroid Build Coastguard Worker        This request can be sent only once in the object's lifetime, after
298*6c119a46SAndroid Build Coastguard Worker        which the only legal request is destroy. This object should be
299*6c119a46SAndroid Build Coastguard Worker        destroyed after issuing a 'create' request. Attempting to use this
300*6c119a46SAndroid Build Coastguard Worker        object after issuing 'create' raises ALREADY_USED protocol error.
301*6c119a46SAndroid Build Coastguard Worker
302*6c119a46SAndroid Build Coastguard Worker        It is not mandatory to issue 'create'. If a client wants to
303*6c119a46SAndroid Build Coastguard Worker        cancel the buffer creation, it can just destroy this object.
304*6c119a46SAndroid Build Coastguard Worker      </description>
305*6c119a46SAndroid Build Coastguard Worker      <arg name="width" type="int" summary="base plane width in pixels"/>
306*6c119a46SAndroid Build Coastguard Worker      <arg name="height" type="int" summary="base plane height in pixels"/>
307*6c119a46SAndroid Build Coastguard Worker      <arg name="format" type="uint" summary="DRM_FORMAT code"/>
308*6c119a46SAndroid Build Coastguard Worker      <arg name="flags" type="uint" enum="flags" summary="see enum flags"/>
309*6c119a46SAndroid Build Coastguard Worker    </request>
310*6c119a46SAndroid Build Coastguard Worker
311*6c119a46SAndroid Build Coastguard Worker    <event name="created">
312*6c119a46SAndroid Build Coastguard Worker      <description summary="buffer creation succeeded">
313*6c119a46SAndroid Build Coastguard Worker        This event indicates that the attempted buffer creation was
314*6c119a46SAndroid Build Coastguard Worker        successful. It provides the new wl_buffer referencing the dmabuf(s).
315*6c119a46SAndroid Build Coastguard Worker
316*6c119a46SAndroid Build Coastguard Worker        Upon receiving this event, the client should destroy the
317*6c119a46SAndroid Build Coastguard Worker        zlinux_dmabuf_params object.
318*6c119a46SAndroid Build Coastguard Worker      </description>
319*6c119a46SAndroid Build Coastguard Worker      <arg name="buffer" type="new_id" interface="wl_buffer"
320*6c119a46SAndroid Build Coastguard Worker           summary="the newly created wl_buffer"/>
321*6c119a46SAndroid Build Coastguard Worker    </event>
322*6c119a46SAndroid Build Coastguard Worker
323*6c119a46SAndroid Build Coastguard Worker    <event name="failed">
324*6c119a46SAndroid Build Coastguard Worker      <description summary="buffer creation failed">
325*6c119a46SAndroid Build Coastguard Worker        This event indicates that the attempted buffer creation has
326*6c119a46SAndroid Build Coastguard Worker        failed. It usually means that one of the dmabuf constraints
327*6c119a46SAndroid Build Coastguard Worker        has not been fulfilled.
328*6c119a46SAndroid Build Coastguard Worker
329*6c119a46SAndroid Build Coastguard Worker        Upon receiving this event, the client should destroy the
330*6c119a46SAndroid Build Coastguard Worker        zlinux_buffer_params object.
331*6c119a46SAndroid Build Coastguard Worker      </description>
332*6c119a46SAndroid Build Coastguard Worker    </event>
333*6c119a46SAndroid Build Coastguard Worker
334*6c119a46SAndroid Build Coastguard Worker    <request name="create_immed" since="2">
335*6c119a46SAndroid Build Coastguard Worker      <description summary="immediately create a wl_buffer from the given
336*6c119a46SAndroid Build Coastguard Worker                     dmabufs">
337*6c119a46SAndroid Build Coastguard Worker        This asks for immediate creation of a wl_buffer by importing the
338*6c119a46SAndroid Build Coastguard Worker        added dmabufs.
339*6c119a46SAndroid Build Coastguard Worker
340*6c119a46SAndroid Build Coastguard Worker        In case of import success, no event is sent from the server, and the
341*6c119a46SAndroid Build Coastguard Worker        wl_buffer is ready to be used by the client.
342*6c119a46SAndroid Build Coastguard Worker
343*6c119a46SAndroid Build Coastguard Worker        Upon import failure, either of the following may happen, as seen fit
344*6c119a46SAndroid Build Coastguard Worker        by the implementation:
345*6c119a46SAndroid Build Coastguard Worker        - the client is terminated with one of the following fatal protocol
346*6c119a46SAndroid Build Coastguard Worker          errors:
347*6c119a46SAndroid Build Coastguard Worker          - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS,
348*6c119a46SAndroid Build Coastguard Worker            in case of argument errors such as mismatch between the number
349*6c119a46SAndroid Build Coastguard Worker            of planes and the format, bad format, non-positive width or
350*6c119a46SAndroid Build Coastguard Worker            height, or bad offset or stride.
351*6c119a46SAndroid Build Coastguard Worker          - INVALID_WL_BUFFER, in case the cause for failure is unknown or
352*6c119a46SAndroid Build Coastguard Worker            plaform specific.
353*6c119a46SAndroid Build Coastguard Worker        - the server creates an invalid wl_buffer, marks it as failed and
354*6c119a46SAndroid Build Coastguard Worker          sends a 'failed' event to the client. The result of using this
355*6c119a46SAndroid Build Coastguard Worker          invalid wl_buffer as an argument in any request by the client is
356*6c119a46SAndroid Build Coastguard Worker          defined by the compositor implementation.
357*6c119a46SAndroid Build Coastguard Worker
358*6c119a46SAndroid Build Coastguard Worker        This takes the same arguments as a 'create' request, and obeys the
359*6c119a46SAndroid Build Coastguard Worker        same restrictions.
360*6c119a46SAndroid Build Coastguard Worker      </description>
361*6c119a46SAndroid Build Coastguard Worker      <arg name="buffer_id" type="new_id" interface="wl_buffer"
362*6c119a46SAndroid Build Coastguard Worker           summary="id for the newly created wl_buffer"/>
363*6c119a46SAndroid Build Coastguard Worker      <arg name="width" type="int" summary="base plane width in pixels"/>
364*6c119a46SAndroid Build Coastguard Worker      <arg name="height" type="int" summary="base plane height in pixels"/>
365*6c119a46SAndroid Build Coastguard Worker      <arg name="format" type="uint" summary="DRM_FORMAT code"/>
366*6c119a46SAndroid Build Coastguard Worker      <arg name="flags" type="uint" enum="flags" summary="see enum flags"/>
367*6c119a46SAndroid Build Coastguard Worker    </request>
368*6c119a46SAndroid Build Coastguard Worker
369*6c119a46SAndroid Build Coastguard Worker  </interface>
370*6c119a46SAndroid Build Coastguard Worker
371*6c119a46SAndroid Build Coastguard Worker</protocol>
372