detached 5004296

linuxexplicitsynchronization_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: zwp_linux_explicit_synchronization_unstable_v1
3// Source: linux-explicit-synchronization-unstable-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright 2016 The Chromium Authors.
7// Copyright 2017 Intel Corporation
8// Copyright 2018 Collabora, Ltd
9//
10// Permission is hereby granted, free of charge, to any person obtaining a
11// copy of this software and associated documentation files (the "Software"),
12// to deal in the Software without restriction, including without limitation
13// the rights to use, copy, modify, merge, publish, distribute, sublicense,
14// and/or sell copies of the Software, and to permit persons to whom the
15// Software is furnished to do so, subject to the following conditions:
16//
17// The above copyright notice and this permission notice (including the next
18// paragraph) shall be included in all copies or substantial portions of the
19// Software.
20//
21// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27// DEALINGS IN THE SOFTWARE.
28
29package linuxexplicitsynchronization
30
31import (
32	"sync"
33
34	cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
35	"github.com/bnema/wlturbo/wl"
36)
37
38// ERROR_SYNCHRONIZATION_EXISTS is the error synchronization_exists value.
39const ERROR_SYNCHRONIZATION_EXISTS = 0
40
41// ERROR_INVALID_FENCE is the error invalid_fence value.
42const ERROR_INVALID_FENCE = 0
43
44// ERROR_DUPLICATE_FENCE is the error duplicate_fence value.
45const ERROR_DUPLICATE_FENCE = 1
46
47// ERROR_DUPLICATE_RELEASE is the error duplicate_release value.
48const ERROR_DUPLICATE_RELEASE = 2
49
50// ERROR_NO_SURFACE is the error no_surface value.
51const ERROR_NO_SURFACE = 3
52
53// ERROR_UNSUPPORTED_BUFFER is the error unsupported_buffer value.
54const ERROR_UNSUPPORTED_BUFFER = 4
55
56// ERROR_NO_BUFFER is the error no_buffer value.
57const ERROR_NO_BUFFER = 5
58
59// LinuxExplicitSynchronizationInterface is the protocol interface name.
60const LinuxExplicitSynchronizationInterface = "zwp_linux_explicit_synchronization_v1"
61
62// LinuxExplicitSynchronization is the generated binding for zwp_linux_explicit_synchronization_v1 version 2.
63type LinuxExplicitSynchronization struct {
64	wl.BaseProxy
65}
66
67// NewLinuxExplicitSynchronization returns an unbound LinuxExplicitSynchronization.
68func NewLinuxExplicitSynchronization(ctx *wl.Context) *LinuxExplicitSynchronization {
69	obj := &LinuxExplicitSynchronization{}
70	obj.SetContext(ctx)
71	ctx.Register(obj)
72	return obj
73}
74
75// Destroy this explicit synchronization factory object. Other objects, including zwp_linux_surface_synchronization_v1 objects created by this factory, shall not be affected by this request.
76func (o *LinuxExplicitSynchronization) Destroy() error {
77	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_explicit_synchronization_v1.destroy", Destructor: true}); err != nil {
78		return err
79	}
80	return nil
81}
82
83// Instantiate an interface extension for the given wl_surface to provide explicit synchronization. If the given wl_surface already has an explicit synchronization object associated, the synchronization_exists protocol error is raised. Graphics APIs, like EGL or Vulkan, that manage the buffer queue and commits of a wl_surface themselves, are likely to be using this extension internally. If a client is using such an API for a wl_surface, it should not directly use this extension on that surface, to avoid raising a synchronization_exists protocol error.
84func (o *LinuxExplicitSynchronization) GetSynchronization(surface *cross_wl_surface.Surface) (*LinuxSurfaceSynchronization, error) {
85	var arg1 wl.Object
86	if surface != nil {
87		arg1 = surface
88	}
89	child := &LinuxSurfaceSynchronization{}
90	child.SetContext(o.Context())
91	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_explicit_synchronization_v1.get_synchronization", Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
92		return nil, err
93	}
94	return child, nil
95}
96
97// EventSignature returns the declared event argument types in wire order.
98func (o *LinuxExplicitSynchronization) EventSignature(opcode uint16) (string, bool) {
99	switch opcode {
100	default:
101		return "", false
102	}
103}
104
105// Dispatch decodes one event on zwp_linux_explicit_synchronization_v1 and calls the registered handlers.
106func (o *LinuxExplicitSynchronization) Dispatch(event *wl.Event) {
107	switch event.Opcode {
108	default:
109	}
110}
111
112// LinuxSurfaceSynchronizationInterface is the protocol interface name.
113const LinuxSurfaceSynchronizationInterface = "zwp_linux_surface_synchronization_v1"
114
115// LinuxSurfaceSynchronization is the generated binding for zwp_linux_surface_synchronization_v1 version 2.
116type LinuxSurfaceSynchronization struct {
117	wl.BaseProxy
118}
119
120// NewLinuxSurfaceSynchronization returns an unbound LinuxSurfaceSynchronization.
121func NewLinuxSurfaceSynchronization(ctx *wl.Context) *LinuxSurfaceSynchronization {
122	obj := &LinuxSurfaceSynchronization{}
123	obj.SetContext(ctx)
124	ctx.Register(obj)
125	return obj
126}
127
128// Destroy this explicit synchronization object. Any fence set by this object with set_acquire_fence since the last commit will be discarded by the server. Any fences set by this object before the last commit are not affected. zwp_linux_buffer_release_v1 objects created by this object are not affected by this request.
129func (o *LinuxSurfaceSynchronization) Destroy() error {
130	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_surface_synchronization_v1.destroy", Destructor: true}); err != nil {
131		return err
132	}
133	return nil
134}
135
136// Set the acquire fence that must be signaled before the compositor may sample from the buffer attached with wl_surface.attach. The fence is a dma_fence kernel object. The acquire fence is double-buffered state, and will be applied on the next wl_surface.commit request for the associated surface. Thus, it applies only to the buffer that is attached to the surface at commit time. If the provided fd is not a valid dma_fence fd, then an INVALID_FENCE error is raised. If a fence has already been attached during the same commit cycle, a DUPLICATE_FENCE error is raised. If the associated wl_surface was destroyed, a NO_SURFACE error is raised. If at surface commit time the attached buffer does not support explicit synchronization, an UNSUPPORTED_BUFFER error is raised. If at surface commit time there is no buffer attached, a NO_BUFFER error is raised.
137func (o *LinuxSurfaceSynchronization) SetAcquireFence(fd int) error {
138	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_surface_synchronization_v1.set_acquire_fence", FDs: []int{fd}}, wl.ArgFD()); err != nil {
139		return err
140	}
141	return nil
142}
143
144// Create a listener for the release of the buffer attached by the client with wl_surface.attach. See zwp_linux_buffer_release_v1 documentation for more information. The release object is double-buffered state, and will be associated with the buffer that is attached to the surface at wl_surface.commit time. If a zwp_linux_buffer_release_v1 object has already been requested for the surface in the same commit cycle, a DUPLICATE_RELEASE error is raised. If the associated wl_surface was destroyed, a NO_SURFACE error is raised. If at surface commit time there is no buffer attached, a NO_BUFFER error is raised.
145func (o *LinuxSurfaceSynchronization) GetRelease() (*LinuxBufferRelease, error) {
146	child := &LinuxBufferRelease{}
147	child.SetContext(o.Context())
148	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_linux_surface_synchronization_v1.get_release", Child: child}, wl.ArgObject(child)); err != nil {
149		return nil, err
150	}
151	return child, nil
152}
153
154// EventSignature returns the declared event argument types in wire order.
155func (o *LinuxSurfaceSynchronization) EventSignature(opcode uint16) (string, bool) {
156	switch opcode {
157	default:
158		return "", false
159	}
160}
161
162// Dispatch decodes one event on zwp_linux_surface_synchronization_v1 and calls the registered handlers.
163func (o *LinuxSurfaceSynchronization) Dispatch(event *wl.Event) {
164	switch event.Opcode {
165	default:
166	}
167}
168
169// LinuxBufferReleaseInterface is the protocol interface name.
170const LinuxBufferReleaseInterface = "zwp_linux_buffer_release_v1"
171
172// LinuxBufferRelease is the generated binding for zwp_linux_buffer_release_v1 version 1.
173type LinuxBufferRelease struct {
174	wl.BaseProxy
175	// handlersMu guards the handler slices: a client may register or replace
176	// handlers while another goroutine dispatches events.
177	handlersMu         sync.Mutex
178	onFencedRelease    []func(fence *wl.OwnedFD)
179	onImmediateRelease []func()
180}
181
182// NewLinuxBufferRelease returns an unbound LinuxBufferRelease.
183func NewLinuxBufferRelease(ctx *wl.Context) *LinuxBufferRelease {
184	obj := &LinuxBufferRelease{}
185	obj.SetContext(ctx)
186	ctx.Register(obj)
187	return obj
188}
189
190// OnFencedRelease registers a handler for the fenced_release event.
191//
192// Handlers are appended, so a second call adds another handler rather than
193// replacing the first. Registration is safe while another goroutine dispatches.
194func (o *LinuxBufferRelease) OnFencedRelease(handler func(fence *wl.OwnedFD)) {
195	if handler == nil {
196		return
197	}
198	o.handlersMu.Lock()
199	defer o.handlersMu.Unlock()
200	o.onFencedRelease = append(o.onFencedRelease, handler)
201}
202
203// handlersForFencedRelease returns the handlers registered for fenced_release, taken
204// under the lock so a handler may register another handler while events are
205// being dispatched.
206func (o *LinuxBufferRelease) handlersForFencedRelease() []func(fence *wl.OwnedFD) {
207	o.handlersMu.Lock()
208	defer o.handlersMu.Unlock()
209	return o.onFencedRelease
210}
211
212// OnImmediateRelease registers a handler for the immediate_release event.
213//
214// Handlers are appended, so a second call adds another handler rather than
215// replacing the first. Registration is safe while another goroutine dispatches.
216func (o *LinuxBufferRelease) OnImmediateRelease(handler func()) {
217	if handler == nil {
218		return
219	}
220	o.handlersMu.Lock()
221	defer o.handlersMu.Unlock()
222	o.onImmediateRelease = append(o.onImmediateRelease, handler)
223}
224
225// handlersForImmediateRelease returns the handlers registered for immediate_release, taken
226// under the lock so a handler may register another handler while events are
227// being dispatched.
228func (o *LinuxBufferRelease) handlersForImmediateRelease() []func() {
229	o.handlersMu.Lock()
230	defer o.handlersMu.Unlock()
231	return o.onImmediateRelease
232}
233
234// EventSignature returns the declared event argument types in wire order.
235func (o *LinuxBufferRelease) EventSignature(opcode uint16) (string, bool) {
236	switch opcode {
237	case 0:
238		return "fd,", true
239	case 1:
240		return "", true
241	default:
242		return "", false
243	}
244}
245
246// Dispatch decodes one event on zwp_linux_buffer_release_v1 and calls the registered handlers.
247func (o *LinuxBufferRelease) Dispatch(event *wl.Event) {
248	switch event.Opcode {
249	case 0: // fenced_release
250		fence := event.FD()
251		ownedfence := fence
252		defer ownedfence.Close()
253
254		for i, handler := range o.handlersForFencedRelease() {
255			if i > 0 {
256				fence = nil
257			}
258			handler(fence)
259		}
260		o.Context().Unregister(o)
261	case 1: // immediate_release
262
263		for i, handler := range o.handlersForImmediateRelease() {
264			_ = i
265			handler()
266		}
267		o.Context().Unregister(o)
268	default:
269	}
270}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 1

↑↓ moveenter openesc close