1*6c119a46SAndroid Build Coastguard Worker<?xml version="1.0" encoding="UTF-8"?>
2*6c119a46SAndroid Build Coastguard Worker<protocol name="zwp_linux_explicit_synchronization_unstable_v1">
3*6c119a46SAndroid Build Coastguard Worker
4*6c119a46SAndroid Build Coastguard Worker  <copyright>
5*6c119a46SAndroid Build Coastguard Worker    Copyright 2016 The Chromium Authors.
6*6c119a46SAndroid Build Coastguard Worker    Copyright 2017 Intel Corporation
7*6c119a46SAndroid Build Coastguard Worker    Copyright 2018 Collabora, Ltd
8*6c119a46SAndroid Build Coastguard Worker
9*6c119a46SAndroid Build Coastguard Worker    Permission is hereby granted, free of charge, to any person obtaining a
10*6c119a46SAndroid Build Coastguard Worker    copy of this software and associated documentation files (the "Software"),
11*6c119a46SAndroid Build Coastguard Worker    to deal in the Software without restriction, including without limitation
12*6c119a46SAndroid Build Coastguard Worker    the rights to use, copy, modify, merge, publish, distribute, sublicense,
13*6c119a46SAndroid Build Coastguard Worker    and/or sell copies of the Software, and to permit persons to whom the
14*6c119a46SAndroid Build Coastguard Worker    Software is furnished to do so, subject to the following conditions:
15*6c119a46SAndroid Build Coastguard Worker
16*6c119a46SAndroid Build Coastguard Worker    The above copyright notice and this permission notice (including the next
17*6c119a46SAndroid Build Coastguard Worker    paragraph) shall be included in all copies or substantial portions of the
18*6c119a46SAndroid Build Coastguard Worker    Software.
19*6c119a46SAndroid Build Coastguard Worker
20*6c119a46SAndroid Build Coastguard Worker    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21*6c119a46SAndroid Build Coastguard Worker    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22*6c119a46SAndroid Build Coastguard Worker    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23*6c119a46SAndroid Build Coastguard Worker    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24*6c119a46SAndroid Build Coastguard Worker    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25*6c119a46SAndroid Build Coastguard Worker    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26*6c119a46SAndroid Build Coastguard Worker    DEALINGS IN THE SOFTWARE.
27*6c119a46SAndroid Build Coastguard Worker  </copyright>
28*6c119a46SAndroid Build Coastguard Worker
29*6c119a46SAndroid Build Coastguard Worker  <interface name="zwp_linux_explicit_synchronization_v1" version="2">
30*6c119a46SAndroid Build Coastguard Worker    <description summary="protocol for providing explicit synchronization">
31*6c119a46SAndroid Build Coastguard Worker      This global is a factory interface, allowing clients to request
32*6c119a46SAndroid Build Coastguard Worker      explicit synchronization for buffers on a per-surface basis.
33*6c119a46SAndroid Build Coastguard Worker
34*6c119a46SAndroid Build Coastguard Worker      See zwp_linux_surface_synchronization_v1 for more information.
35*6c119a46SAndroid Build Coastguard Worker
36*6c119a46SAndroid Build Coastguard Worker      This interface is derived from Chromium's
37*6c119a46SAndroid Build Coastguard Worker      zcr_linux_explicit_synchronization_v1.
38*6c119a46SAndroid Build Coastguard Worker
39*6c119a46SAndroid Build Coastguard Worker      Warning! The protocol described in this file is experimental and
40*6c119a46SAndroid Build Coastguard Worker      backward incompatible changes may be made. Backward compatible changes
41*6c119a46SAndroid Build Coastguard Worker      may be added together with the corresponding interface version bump.
42*6c119a46SAndroid Build Coastguard Worker      Backward incompatible changes are done by bumping the version number in
43*6c119a46SAndroid Build Coastguard Worker      the protocol and interface names and resetting the interface version.
44*6c119a46SAndroid Build Coastguard Worker      Once the protocol is to be declared stable, the 'z' prefix and the
45*6c119a46SAndroid Build Coastguard Worker      version number in the protocol and interface names are removed and the
46*6c119a46SAndroid Build Coastguard Worker      interface version number is reset.
47*6c119a46SAndroid Build Coastguard Worker    </description>
48*6c119a46SAndroid Build Coastguard Worker
49*6c119a46SAndroid Build Coastguard Worker    <request name="destroy" type="destructor">
50*6c119a46SAndroid Build Coastguard Worker      <description summary="destroy explicit synchronization factory object">
51*6c119a46SAndroid Build Coastguard Worker        Destroy this explicit synchronization factory object. Other objects,
52*6c119a46SAndroid Build Coastguard Worker        including zwp_linux_surface_synchronization_v1 objects created by this
53*6c119a46SAndroid Build Coastguard Worker        factory, shall not be affected by this request.
54*6c119a46SAndroid Build Coastguard Worker      </description>
55*6c119a46SAndroid Build Coastguard Worker    </request>
56*6c119a46SAndroid Build Coastguard Worker
57*6c119a46SAndroid Build Coastguard Worker    <enum name="error">
58*6c119a46SAndroid Build Coastguard Worker      <entry name="synchronization_exists" value="0"
59*6c119a46SAndroid Build Coastguard Worker             summary="the surface already has a synchronization object associated"/>
60*6c119a46SAndroid Build Coastguard Worker    </enum>
61*6c119a46SAndroid Build Coastguard Worker
62*6c119a46SAndroid Build Coastguard Worker    <request name="get_synchronization">
63*6c119a46SAndroid Build Coastguard Worker      <description summary="extend surface interface for explicit synchronization">
64*6c119a46SAndroid Build Coastguard Worker        Instantiate an interface extension for the given wl_surface to provide
65*6c119a46SAndroid Build Coastguard Worker        explicit synchronization.
66*6c119a46SAndroid Build Coastguard Worker
67*6c119a46SAndroid Build Coastguard Worker        If the given wl_surface already has an explicit synchronization object
68*6c119a46SAndroid Build Coastguard Worker        associated, the synchronization_exists protocol error is raised.
69*6c119a46SAndroid Build Coastguard Worker
70*6c119a46SAndroid Build Coastguard Worker        Graphics APIs, like EGL or Vulkan, that manage the buffer queue and
71*6c119a46SAndroid Build Coastguard Worker        commits of a wl_surface themselves, are likely to be using this
72*6c119a46SAndroid Build Coastguard Worker        extension internally. If a client is using such an API for a
73*6c119a46SAndroid Build Coastguard Worker        wl_surface, it should not directly use this extension on that surface,
74*6c119a46SAndroid Build Coastguard Worker        to avoid raising a synchronization_exists protocol error.
75*6c119a46SAndroid Build Coastguard Worker      </description>
76*6c119a46SAndroid Build Coastguard Worker
77*6c119a46SAndroid Build Coastguard Worker      <arg name="id" type="new_id"
78*6c119a46SAndroid Build Coastguard Worker           interface="zwp_linux_surface_synchronization_v1"
79*6c119a46SAndroid Build Coastguard Worker           summary="the new synchronization interface id"/>
80*6c119a46SAndroid Build Coastguard Worker      <arg name="surface" type="object" interface="wl_surface"
81*6c119a46SAndroid Build Coastguard Worker           summary="the surface"/>
82*6c119a46SAndroid Build Coastguard Worker    </request>
83*6c119a46SAndroid Build Coastguard Worker  </interface>
84*6c119a46SAndroid Build Coastguard Worker
85*6c119a46SAndroid Build Coastguard Worker  <interface name="zwp_linux_surface_synchronization_v1" version="2">
86*6c119a46SAndroid Build Coastguard Worker    <description summary="per-surface explicit synchronization support">
87*6c119a46SAndroid Build Coastguard Worker      This object implements per-surface explicit synchronization.
88*6c119a46SAndroid Build Coastguard Worker
89*6c119a46SAndroid Build Coastguard Worker      Synchronization refers to co-ordination of pipelined operations performed
90*6c119a46SAndroid Build Coastguard Worker      on buffers. Most GPU clients will schedule an asynchronous operation to
91*6c119a46SAndroid Build Coastguard Worker      render to the buffer, then immediately send the buffer to the compositor
92*6c119a46SAndroid Build Coastguard Worker      to be attached to a surface.
93*6c119a46SAndroid Build Coastguard Worker
94*6c119a46SAndroid Build Coastguard Worker      In implicit synchronization, ensuring that the rendering operation is
95*6c119a46SAndroid Build Coastguard Worker      complete before the compositor displays the buffer is an implementation
96*6c119a46SAndroid Build Coastguard Worker      detail handled by either the kernel or userspace graphics driver.
97*6c119a46SAndroid Build Coastguard Worker
98*6c119a46SAndroid Build Coastguard Worker      By contrast, in explicit synchronization, dma_fence objects mark when the
99*6c119a46SAndroid Build Coastguard Worker      asynchronous operations are complete. When submitting a buffer, the
100*6c119a46SAndroid Build Coastguard Worker      client provides an acquire fence which will be waited on before the
101*6c119a46SAndroid Build Coastguard Worker      compositor accesses the buffer. The Wayland server, through a
102*6c119a46SAndroid Build Coastguard Worker      zwp_linux_buffer_release_v1 object, will inform the client with an event
103*6c119a46SAndroid Build Coastguard Worker      which may be accompanied by a release fence, when the compositor will no
104*6c119a46SAndroid Build Coastguard Worker      longer access the buffer contents due to the specific commit that
105*6c119a46SAndroid Build Coastguard Worker      requested the release event.
106*6c119a46SAndroid Build Coastguard Worker
107*6c119a46SAndroid Build Coastguard Worker      Each surface can be associated with only one object of this interface at
108*6c119a46SAndroid Build Coastguard Worker      any time.
109*6c119a46SAndroid Build Coastguard Worker
110*6c119a46SAndroid Build Coastguard Worker      In version 1 of this interface, explicit synchronization is only
111*6c119a46SAndroid Build Coastguard Worker      guaranteed to be supported for buffers created with any version of the
112*6c119a46SAndroid Build Coastguard Worker      wp_linux_dmabuf buffer factory. Version 2 additionally guarantees
113*6c119a46SAndroid Build Coastguard Worker      explicit synchronization support for opaque EGL buffers, which is a type
114*6c119a46SAndroid Build Coastguard Worker      of platform specific buffers described in the EGL_WL_bind_wayland_display
115*6c119a46SAndroid Build Coastguard Worker      extension. Compositors are free to support explicit synchronization for
116*6c119a46SAndroid Build Coastguard Worker      additional buffer types.
117*6c119a46SAndroid Build Coastguard Worker    </description>
118*6c119a46SAndroid Build Coastguard Worker
119*6c119a46SAndroid Build Coastguard Worker    <request name="destroy" type="destructor">
120*6c119a46SAndroid Build Coastguard Worker      <description summary="destroy synchronization object">
121*6c119a46SAndroid Build Coastguard Worker        Destroy this explicit synchronization object.
122*6c119a46SAndroid Build Coastguard Worker
123*6c119a46SAndroid Build Coastguard Worker        Any fence set by this object with set_acquire_fence since the last
124*6c119a46SAndroid Build Coastguard Worker        commit will be discarded by the server. Any fences set by this object
125*6c119a46SAndroid Build Coastguard Worker        before the last commit are not affected.
126*6c119a46SAndroid Build Coastguard Worker
127*6c119a46SAndroid Build Coastguard Worker        zwp_linux_buffer_release_v1 objects created by this object are not
128*6c119a46SAndroid Build Coastguard Worker        affected by this request.
129*6c119a46SAndroid Build Coastguard Worker      </description>
130*6c119a46SAndroid Build Coastguard Worker    </request>
131*6c119a46SAndroid Build Coastguard Worker
132*6c119a46SAndroid Build Coastguard Worker    <enum name="error">
133*6c119a46SAndroid Build Coastguard Worker      <entry name="invalid_fence" value="0"
134*6c119a46SAndroid Build Coastguard Worker             summary="the fence specified by the client could not be imported"/>
135*6c119a46SAndroid Build Coastguard Worker      <entry name="duplicate_fence" value="1"
136*6c119a46SAndroid Build Coastguard Worker             summary="multiple fences added for a single surface commit"/>
137*6c119a46SAndroid Build Coastguard Worker      <entry name="duplicate_release" value="2"
138*6c119a46SAndroid Build Coastguard Worker             summary="multiple releases added for a single surface commit"/>
139*6c119a46SAndroid Build Coastguard Worker      <entry name="no_surface" value="3"
140*6c119a46SAndroid Build Coastguard Worker             summary="the associated wl_surface was destroyed"/>
141*6c119a46SAndroid Build Coastguard Worker      <entry name="unsupported_buffer" value="4"
142*6c119a46SAndroid Build Coastguard Worker             summary="the buffer does not support explicit synchronization"/>
143*6c119a46SAndroid Build Coastguard Worker      <entry name="no_buffer" value="5"
144*6c119a46SAndroid Build Coastguard Worker             summary="no buffer was attached"/>
145*6c119a46SAndroid Build Coastguard Worker    </enum>
146*6c119a46SAndroid Build Coastguard Worker
147*6c119a46SAndroid Build Coastguard Worker    <request name="set_acquire_fence">
148*6c119a46SAndroid Build Coastguard Worker      <description summary="set the acquire fence">
149*6c119a46SAndroid Build Coastguard Worker        Set the acquire fence that must be signaled before the compositor
150*6c119a46SAndroid Build Coastguard Worker        may sample from the buffer attached with wl_surface.attach. The fence
151*6c119a46SAndroid Build Coastguard Worker        is a dma_fence kernel object.
152*6c119a46SAndroid Build Coastguard Worker
153*6c119a46SAndroid Build Coastguard Worker        The acquire fence is double-buffered state, and will be applied on the
154*6c119a46SAndroid Build Coastguard Worker        next wl_surface.commit request for the associated surface. Thus, it
155*6c119a46SAndroid Build Coastguard Worker        applies only to the buffer that is attached to the surface at commit
156*6c119a46SAndroid Build Coastguard Worker        time.
157*6c119a46SAndroid Build Coastguard Worker
158*6c119a46SAndroid Build Coastguard Worker        If the provided fd is not a valid dma_fence fd, then an INVALID_FENCE
159*6c119a46SAndroid Build Coastguard Worker        error is raised.
160*6c119a46SAndroid Build Coastguard Worker
161*6c119a46SAndroid Build Coastguard Worker        If a fence has already been attached during the same commit cycle, a
162*6c119a46SAndroid Build Coastguard Worker        DUPLICATE_FENCE error is raised.
163*6c119a46SAndroid Build Coastguard Worker
164*6c119a46SAndroid Build Coastguard Worker        If the associated wl_surface was destroyed, a NO_SURFACE error is
165*6c119a46SAndroid Build Coastguard Worker        raised.
166*6c119a46SAndroid Build Coastguard Worker
167*6c119a46SAndroid Build Coastguard Worker        If at surface commit time the attached buffer does not support explicit
168*6c119a46SAndroid Build Coastguard Worker        synchronization, an UNSUPPORTED_BUFFER error is raised.
169*6c119a46SAndroid Build Coastguard Worker
170*6c119a46SAndroid Build Coastguard Worker        If at surface commit time there is no buffer attached, a NO_BUFFER
171*6c119a46SAndroid Build Coastguard Worker        error is raised.
172*6c119a46SAndroid Build Coastguard Worker      </description>
173*6c119a46SAndroid Build Coastguard Worker      <arg name="fd" type="fd" summary="acquire fence fd"/>
174*6c119a46SAndroid Build Coastguard Worker    </request>
175*6c119a46SAndroid Build Coastguard Worker
176*6c119a46SAndroid Build Coastguard Worker    <request name="get_release">
177*6c119a46SAndroid Build Coastguard Worker      <description summary="release fence for last-attached buffer">
178*6c119a46SAndroid Build Coastguard Worker        Create a listener for the release of the buffer attached by the
179*6c119a46SAndroid Build Coastguard Worker        client with wl_surface.attach. See zwp_linux_buffer_release_v1
180*6c119a46SAndroid Build Coastguard Worker        documentation for more information.
181*6c119a46SAndroid Build Coastguard Worker
182*6c119a46SAndroid Build Coastguard Worker        The release object is double-buffered state, and will be associated
183*6c119a46SAndroid Build Coastguard Worker        with the buffer that is attached to the surface at wl_surface.commit
184*6c119a46SAndroid Build Coastguard Worker        time.
185*6c119a46SAndroid Build Coastguard Worker
186*6c119a46SAndroid Build Coastguard Worker        If a zwp_linux_buffer_release_v1 object has already been requested for
187*6c119a46SAndroid Build Coastguard Worker        the surface in the same commit cycle, a DUPLICATE_RELEASE error is
188*6c119a46SAndroid Build Coastguard Worker        raised.
189*6c119a46SAndroid Build Coastguard Worker
190*6c119a46SAndroid Build Coastguard Worker        If the associated wl_surface was destroyed, a NO_SURFACE error
191*6c119a46SAndroid Build Coastguard Worker        is raised.
192*6c119a46SAndroid Build Coastguard Worker
193*6c119a46SAndroid Build Coastguard Worker        If at surface commit time there is no buffer attached, a NO_BUFFER
194*6c119a46SAndroid Build Coastguard Worker        error is raised.
195*6c119a46SAndroid Build Coastguard Worker      </description>
196*6c119a46SAndroid Build Coastguard Worker      <arg name="release" type="new_id" interface="zwp_linux_buffer_release_v1"
197*6c119a46SAndroid Build Coastguard Worker           summary="new zwp_linux_buffer_release_v1 object"/>
198*6c119a46SAndroid Build Coastguard Worker    </request>
199*6c119a46SAndroid Build Coastguard Worker  </interface>
200*6c119a46SAndroid Build Coastguard Worker
201*6c119a46SAndroid Build Coastguard Worker  <interface name="zwp_linux_buffer_release_v1" version="1">
202*6c119a46SAndroid Build Coastguard Worker    <description summary="buffer release explicit synchronization">
203*6c119a46SAndroid Build Coastguard Worker      This object is instantiated in response to a
204*6c119a46SAndroid Build Coastguard Worker      zwp_linux_surface_synchronization_v1.get_release request.
205*6c119a46SAndroid Build Coastguard Worker
206*6c119a46SAndroid Build Coastguard Worker      It provides an alternative to wl_buffer.release events, providing a
207*6c119a46SAndroid Build Coastguard Worker      unique release from a single wl_surface.commit request. The release event
208*6c119a46SAndroid Build Coastguard Worker      also supports explicit synchronization, providing a fence FD for the
209*6c119a46SAndroid Build Coastguard Worker      client to synchronize against.
210*6c119a46SAndroid Build Coastguard Worker
211*6c119a46SAndroid Build Coastguard Worker      Exactly one event, either a fenced_release or an immediate_release, will
212*6c119a46SAndroid Build Coastguard Worker      be emitted for the wl_surface.commit request. The compositor can choose
213*6c119a46SAndroid Build Coastguard Worker      release by release which event it uses.
214*6c119a46SAndroid Build Coastguard Worker
215*6c119a46SAndroid Build Coastguard Worker      This event does not replace wl_buffer.release events; servers are still
216*6c119a46SAndroid Build Coastguard Worker      required to send those events.
217*6c119a46SAndroid Build Coastguard Worker
218*6c119a46SAndroid Build Coastguard Worker      Once a buffer release object has delivered a 'fenced_release' or an
219*6c119a46SAndroid Build Coastguard Worker      'immediate_release' event it is automatically destroyed.
220*6c119a46SAndroid Build Coastguard Worker    </description>
221*6c119a46SAndroid Build Coastguard Worker
222*6c119a46SAndroid Build Coastguard Worker    <event name="fenced_release">
223*6c119a46SAndroid Build Coastguard Worker      <description summary="release buffer with fence">
224*6c119a46SAndroid Build Coastguard Worker        Sent when the compositor has finalised its usage of the associated
225*6c119a46SAndroid Build Coastguard Worker        buffer for the relevant commit, providing a dma_fence which will be
226*6c119a46SAndroid Build Coastguard Worker        signaled when all operations by the compositor on that buffer for that
227*6c119a46SAndroid Build Coastguard Worker        commit have finished.
228*6c119a46SAndroid Build Coastguard Worker
229*6c119a46SAndroid Build Coastguard Worker        Once the fence has signaled, and assuming the associated buffer is not
230*6c119a46SAndroid Build Coastguard Worker        pending release from other wl_surface.commit requests, no additional
231*6c119a46SAndroid Build Coastguard Worker        explicit or implicit synchronization is required to safely reuse or
232*6c119a46SAndroid Build Coastguard Worker        destroy the buffer.
233*6c119a46SAndroid Build Coastguard Worker
234*6c119a46SAndroid Build Coastguard Worker        This event destroys the zwp_linux_buffer_release_v1 object.
235*6c119a46SAndroid Build Coastguard Worker      </description>
236*6c119a46SAndroid Build Coastguard Worker      <arg name="fence" type="fd" summary="fence for last operation on buffer"/>
237*6c119a46SAndroid Build Coastguard Worker    </event>
238*6c119a46SAndroid Build Coastguard Worker
239*6c119a46SAndroid Build Coastguard Worker    <event name="immediate_release">
240*6c119a46SAndroid Build Coastguard Worker      <description summary="release buffer immediately">
241*6c119a46SAndroid Build Coastguard Worker        Sent when the compositor has finalised its usage of the associated
242*6c119a46SAndroid Build Coastguard Worker        buffer for the relevant commit, and either performed no operations
243*6c119a46SAndroid Build Coastguard Worker        using it, or has a guarantee that all its operations on that buffer for
244*6c119a46SAndroid Build Coastguard Worker        that commit have finished.
245*6c119a46SAndroid Build Coastguard Worker
246*6c119a46SAndroid Build Coastguard Worker        Once this event is received, and assuming the associated buffer is not
247*6c119a46SAndroid Build Coastguard Worker        pending release from other wl_surface.commit requests, no additional
248*6c119a46SAndroid Build Coastguard Worker        explicit or implicit synchronization is required to safely reuse or
249*6c119a46SAndroid Build Coastguard Worker        destroy the buffer.
250*6c119a46SAndroid Build Coastguard Worker
251*6c119a46SAndroid Build Coastguard Worker        This event destroys the zwp_linux_buffer_release_v1 object.
252*6c119a46SAndroid Build Coastguard Worker      </description>
253*6c119a46SAndroid Build Coastguard Worker    </event>
254*6c119a46SAndroid Build Coastguard Worker  </interface>
255*6c119a46SAndroid Build Coastguard Worker
256*6c119a46SAndroid Build Coastguard Worker</protocol>
257