detached 1a6c6c9

linuxdmabuf_generated.go RawHistoryFolder

1// Code generated by wlbgen. DO NOT EDIT.
2// Protocol: linux_dmabuf_v1
3// Source: linux-dmabuf-v1.xml
4
5// Upstream protocol copyright and license:
6// Copyright © 2014, 2015 Collabora, Ltd.
7//
8// Permission is hereby granted, free of charge, to any person obtaining a
9// copy of this software and associated documentation files (the "Software"),
10// to deal in the Software without restriction, including without limitation
11// the rights to use, copy, modify, merge, publish, distribute, sublicense,
12// and/or sell copies of the Software, and to permit persons to whom the
13// Software is furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice (including the next
16// paragraph) shall be included in all copies or substantial portions of the
17// Software.
18//
19// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25// DEALINGS IN THE SOFTWARE.
26
27package linuxdmabuf
28
29import (
30	"sync"
31
32	cross_wl_buffer "github.com/bnema/go-wayland-bindings/client/wayland"
33	cross_wl_surface "github.com/bnema/go-wayland-bindings/client/wayland"
34	"github.com/bnema/wlturbo/wl"
35)
36
37// ERROR_ALREADY_USED is the error already_used value.
38const ERROR_ALREADY_USED = 0
39
40// ERROR_PLANE_IDX is the error plane_idx value.
41const ERROR_PLANE_IDX = 1
42
43// ERROR_PLANE_SET is the error plane_set value.
44const ERROR_PLANE_SET = 2
45
46// ERROR_INCOMPLETE is the error incomplete value.
47const ERROR_INCOMPLETE = 3
48
49// ERROR_INVALID_FORMAT is the error invalid_format value.
50const ERROR_INVALID_FORMAT = 4
51
52// ERROR_INVALID_DIMENSIONS is the error invalid_dimensions value.
53const ERROR_INVALID_DIMENSIONS = 5
54
55// ERROR_OUT_OF_BOUNDS is the error out_of_bounds value.
56const ERROR_OUT_OF_BOUNDS = 6
57
58// ERROR_INVALID_WL_BUFFER is the error invalid_wl_buffer value.
59const ERROR_INVALID_WL_BUFFER = 7
60
61// ERROR_INVALID_DEV_T_SIZE is the error invalid_dev_t_size value.
62const ERROR_INVALID_DEV_T_SIZE = 8
63
64// FLAGS_Y_INVERT is the flags y_invert value.
65const FLAGS_Y_INVERT = 1
66
67// FLAGS_INTERLACED is the flags interlaced value.
68const FLAGS_INTERLACED = 2
69
70// FLAGS_BOTTOM_FIRST is the flags bottom_first value.
71const FLAGS_BOTTOM_FIRST = 4
72
73// TRANCHE_FLAGS_SCANOUT is the tranche_flags scanout value.
74const TRANCHE_FLAGS_SCANOUT = 1
75
76// TRANCHE_FLAGS_SAMPLING is the tranche_flags sampling value.
77const TRANCHE_FLAGS_SAMPLING = 2
78
79// LinuxDmabufInterface is the protocol interface name.
80const LinuxDmabufInterface = "zwp_linux_dmabuf_v1"
81
82// LinuxDmabuf is the generated binding for zwp_linux_dmabuf_v1 version 6.
83type LinuxDmabuf struct {
84	wl.BaseProxy
85	// handlersMu guards the handler slices: a client may register or replace
86	// handlers while another goroutine dispatches events.
87	handlersMu sync.Mutex
88	onFormat   []func(format uint32)
89	onModifier []func(format uint32, modifierHi uint32, modifierLo uint32)
90}
91
92// NewLinuxDmabuf returns an unbound LinuxDmabuf.
93func NewLinuxDmabuf(ctx *wl.Context) *LinuxDmabuf {
94	obj := &LinuxDmabuf{}
95	obj.SetContext(ctx)
96	ctx.Register(obj)
97	return obj
98}
99
100// Objects created through this interface, especially wl_buffers, will remain valid.
101func (o *LinuxDmabuf) Destroy() error {
102	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_dmabuf_v1.destroy", Destructor: true}); err != nil {
103		return err
104	}
105	return nil
106}
107
108// This temporary object is used to collect multiple dmabuf handles into a single batch to create a wl_buffer. It can only be used once and should be destroyed after a 'created' or 'failed' event has been received.
109func (o *LinuxDmabuf) CreateParams() (*LinuxBufferParams, error) {
110	child := &LinuxBufferParams{}
111	child.SetContext(o.Context())
112	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_dmabuf_v1.create_params", Child: child}, wl.ArgObject(child)); err != nil {
113		return nil, err
114	}
115	return child, nil
116}
117
118// This request creates a new zwp_linux_dmabuf_feedback_v1 object not bound to a particular surface. This object will deliver feedback about dmabuf parameters to use if the client doesn't support per-surface feedback (see get_surface_feedback).
119func (o *LinuxDmabuf) GetDefaultFeedback() (*LinuxDmabufFeedback, error) {
120	child := &LinuxDmabufFeedback{}
121	child.SetContext(o.Context())
122	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_linux_dmabuf_v1.get_default_feedback", Since: 4, Child: child}, wl.ArgObject(child)); err != nil {
123		return nil, err
124	}
125	return child, nil
126}
127
128// This request creates a new zwp_linux_dmabuf_feedback_v1 object for the specified wl_surface. This object will deliver feedback about dmabuf parameters to use for buffers attached to this surface. If the surface is destroyed before the zwp_linux_dmabuf_feedback_v1 object, the feedback object becomes inert.
129func (o *LinuxDmabuf) GetSurfaceFeedback(surface *cross_wl_surface.Surface) (*LinuxDmabufFeedback, error) {
130	var arg1 wl.Object
131	if surface != nil {
132		arg1 = surface
133	}
134	child := &LinuxDmabufFeedback{}
135	child.SetContext(o.Context())
136	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_linux_dmabuf_v1.get_surface_feedback", Since: 4, Child: child}, wl.ArgObject(child), wl.ArgObject(arg1)); err != nil {
137		return nil, err
138	}
139	return child, nil
140}
141
142// OnFormat registers a handler for the format event.
143//
144// Handlers are appended, so a second call adds another handler rather than
145// replacing the first. Registration is safe while another goroutine dispatches.
146func (o *LinuxDmabuf) OnFormat(handler func(format uint32)) {
147	if handler == nil {
148		return
149	}
150	o.handlersMu.Lock()
151	defer o.handlersMu.Unlock()
152	o.onFormat = append(o.onFormat, handler)
153}
154
155// handlersForFormat returns the handlers registered for format, taken
156// under the lock so a handler may register another handler while events are
157// being dispatched.
158func (o *LinuxDmabuf) handlersForFormat() []func(format uint32) {
159	o.handlersMu.Lock()
160	defer o.handlersMu.Unlock()
161	return o.onFormat
162}
163
164// OnModifier registers a handler for the modifier event.
165//
166// Handlers are appended, so a second call adds another handler rather than
167// replacing the first. Registration is safe while another goroutine dispatches.
168func (o *LinuxDmabuf) OnModifier(handler func(format uint32, modifierHi uint32, modifierLo uint32)) {
169	if handler == nil {
170		return
171	}
172	o.handlersMu.Lock()
173	defer o.handlersMu.Unlock()
174	o.onModifier = append(o.onModifier, handler)
175}
176
177// handlersForModifier returns the handlers registered for modifier, taken
178// under the lock so a handler may register another handler while events are
179// being dispatched.
180func (o *LinuxDmabuf) handlersForModifier() []func(format uint32, modifierHi uint32, modifierLo uint32) {
181	o.handlersMu.Lock()
182	defer o.handlersMu.Unlock()
183	return o.onModifier
184}
185
186// EventSignature returns the declared event argument types in wire order.
187func (o *LinuxDmabuf) EventSignature(opcode uint16) (string, bool) {
188	switch opcode {
189	case 0:
190		return "uint,", true
191	case 1:
192		return "uint,uint,uint,", true
193	default:
194		return "", false
195	}
196}
197
198// Dispatch decodes one event on zwp_linux_dmabuf_v1 and calls the registered handlers.
199func (o *LinuxDmabuf) Dispatch(event *wl.Event) {
200	switch event.Opcode {
201	case 0: // format
202		format := event.Uint32()
203
204		for i, handler := range o.handlersForFormat() {
205			_ = i
206			handler(format)
207		}
208	case 1: // modifier
209		format := event.Uint32()
210		modifierHi := event.Uint32()
211		modifierLo := event.Uint32()
212
213		for i, handler := range o.handlersForModifier() {
214			_ = i
215			handler(format, modifierHi, modifierLo)
216		}
217	default:
218	}
219}
220
221// LinuxBufferParamsInterface is the protocol interface name.
222const LinuxBufferParamsInterface = "zwp_linux_buffer_params_v1"
223
224// LinuxBufferParams is the generated binding for zwp_linux_buffer_params_v1 version 6.
225type LinuxBufferParams struct {
226	wl.BaseProxy
227	// handlersMu guards the handler slices: a client may register or replace
228	// handlers while another goroutine dispatches events.
229	handlersMu sync.Mutex
230	onCreated  []func(bufferObject *cross_wl_buffer.Buffer)
231	onFailed   []func()
232}
233
234// NewLinuxBufferParams returns an unbound LinuxBufferParams.
235func NewLinuxBufferParams(ctx *wl.Context) *LinuxBufferParams {
236	obj := &LinuxBufferParams{}
237	obj.SetContext(ctx)
238	ctx.Register(obj)
239	return obj
240}
241
242// Cleans up the temporary data sent to the server for dmabuf-based wl_buffer creation.
243func (o *LinuxBufferParams) Destroy() error {
244	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_buffer_params_v1.destroy", Destructor: true}); err != nil {
245		return err
246	}
247	return nil
248}
249
250// This request adds one dmabuf to the set in this zwp_linux_buffer_params_v1. The 64-bit unsigned value combined from modifier_hi and modifier_lo is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the fb modifier, which is defined in drm_mode.h of Linux UAPI. This is an opaque token. Drivers use this token to express tiling, compression, etc. driver-specific modifications to the base format defined by the DRM fourcc code. Starting from version 4, the invalid_format protocol error is sent if the format + modifier pair was not advertised as supported. Starting from version 5, the invalid_format protocol error is sent if all planes don't use the same modifier. This request raises the PLANE_IDX error if plane_idx is too large. The error PLANE_SET is raised if attempting to set a plane that was already set.
251func (o *LinuxBufferParams) Add(fd int, planeIdx uint32, offset uint32, stride uint32, modifierHi uint32, modifierLo uint32) error {
252	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 1, Name: "zwp_linux_buffer_params_v1.add", FDs: []int{fd}}, wl.ArgFD(), wl.ArgUint(planeIdx), wl.ArgUint(offset), wl.ArgUint(stride), wl.ArgUint(modifierHi), wl.ArgUint(modifierLo)); err != nil {
253		return err
254	}
255	return nil
256}
257
258// This asks for creation of a wl_buffer from the added dmabuf buffers. The wl_buffer is not created immediately but returned via the 'created' event if the dmabuf sharing succeeds. The sharing may fail at runtime for reasons a client cannot predict, in which case the 'failed' event is triggered. The 'format' argument is a DRM_FORMAT code, as defined by the libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the authoritative source on how the format codes should work. The 'flags' is a bitfield of the flags defined in enum "flags". 'y_invert' means that the image needs to be y-flipped. Flag 'interlaced' means that the frame in the buffer is not progressive as usual, but interlaced. An interlaced buffer as supported here must always contain both top and bottom fields. The top field always begins on the first pixel row. The temporal ordering between the two fields is top field first, unless 'bottom_first' is specified. It is undefined whether 'bottom_first' is ignored if 'interlaced' is not set. This protocol does not convey any information about field rate, duration, or timing, other than the relative ordering between the two fields in one buffer. A compositor may have to estimate the intended field rate from the incoming buffer rate. It is undefined whether the time of receiving wl_surface.commit with a new buffer attached, applying the wl_surface state, wl_surface.frame callback trigger, presentation, or any other point in the compositor cycle is used to measure the frame or field times. There is no support for detecting missed or late frames/fields/buffers either, and there is no support whatsoever for cooperating with interlaced compositor output. The composited image quality resulting from the use of interlaced buffers is explicitly undefined. A compositor may use elaborate hardware features or software to deinterlace and create progressive output frames from a sequence of interlaced input buffers, or it may produce substandard image quality. However, compositors that cannot guarantee reasonable image quality in all cases are recommended to just reject all interlaced buffers. Any argument errors, including non-positive width or height, mismatch between the number of planes and the format, bad format, bad offset or stride, may be indicated by fatal protocol errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS. Dmabuf import errors in the server that are not obvious client bugs are returned via the 'failed' event as non-fatal. This allows attempting dmabuf sharing and falling back in the client if it fails. This request can be sent only once in the object's lifetime, after which the only legal request is destroy. This object should be destroyed after issuing a 'create' request. Attempting to use this object after issuing 'create' raises the ALREADY_USED protocol error. It is not mandatory to issue 'create'. If a client wants to cancel the buffer creation, it can just destroy this object.
259func (o *LinuxBufferParams) Create(width int32, height int32, format uint32, flags uint32) error {
260	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 2, Name: "zwp_linux_buffer_params_v1.create"}, wl.ArgInt(width), wl.ArgInt(height), wl.ArgUint(format), wl.ArgUint(flags)); err != nil {
261		return err
262	}
263	return nil
264}
265
266// This asks for immediate creation of a wl_buffer by importing the added dmabufs. In case of import success, no event is sent from the server, and the wl_buffer is ready to be used by the client. Upon import failure, either of the following may happen, as seen fit by the implementation: - the client is terminated with one of the following fatal protocol errors: - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS, in case of argument errors such as mismatch between the number of planes and the format, bad format, non-positive width or height, or bad offset or stride. - INVALID_WL_BUFFER, in case the cause for failure is unknown or platform specific. - the server creates an invalid wl_buffer, marks it as failed and sends a 'failed' event to the client. The result of using this invalid wl_buffer as an argument in any request by the client is defined by the compositor implementation. This takes the same arguments as a 'create' request, and obeys the same restrictions.
267func (o *LinuxBufferParams) CreateImmed(width int32, height int32, format uint32, flags uint32) (*cross_wl_buffer.Buffer, error) {
268	child := cross_wl_buffer.NewBuffer(o.Context())
269	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 3, Name: "zwp_linux_buffer_params_v1.create_immed", Since: 2, Child: child}, wl.ArgObject(child), wl.ArgInt(width), wl.ArgInt(height), wl.ArgUint(format), wl.ArgUint(flags)); err != nil {
270		return nil, err
271	}
272	return child, nil
273}
274
275// Set the device the compositor should import the dmabufs to for sampling in the next create or create_immed request. To avoid race conditions when the compositor removes a device from the tranches, it is not a protocol error if the device hasn't been advertised by the compositor in a tranche with the sampling flag, but the import is likely to fail in that case. If the client doesn't know a suitable target device, it shouldn't set one, and the compositor should attempt import on all devices it supports. If the array is too small to contain a dev_t or larger than required, the invalid_dev_t_size error will be emitted.
276func (o *LinuxBufferParams) SetSamplingDevice(device []byte) error {
277	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 4, Name: "zwp_linux_buffer_params_v1.set_sampling_device", Since: 6}, wl.ArgArray(device)); err != nil {
278		return err
279	}
280	return nil
281}
282
283// OnCreated registers a handler for the created event.
284//
285// Handlers are appended, so a second call adds another handler rather than
286// replacing the first. Registration is safe while another goroutine dispatches.
287func (o *LinuxBufferParams) OnCreated(handler func(bufferObject *cross_wl_buffer.Buffer)) {
288	if handler == nil {
289		return
290	}
291	o.handlersMu.Lock()
292	defer o.handlersMu.Unlock()
293	o.onCreated = append(o.onCreated, handler)
294}
295
296// handlersForCreated returns the handlers registered for created, taken
297// under the lock so a handler may register another handler while events are
298// being dispatched.
299func (o *LinuxBufferParams) handlersForCreated() []func(bufferObject *cross_wl_buffer.Buffer) {
300	o.handlersMu.Lock()
301	defer o.handlersMu.Unlock()
302	return o.onCreated
303}
304
305// OnFailed registers a handler for the failed event.
306//
307// Handlers are appended, so a second call adds another handler rather than
308// replacing the first. Registration is safe while another goroutine dispatches.
309func (o *LinuxBufferParams) OnFailed(handler func()) {
310	if handler == nil {
311		return
312	}
313	o.handlersMu.Lock()
314	defer o.handlersMu.Unlock()
315	o.onFailed = append(o.onFailed, handler)
316}
317
318// handlersForFailed returns the handlers registered for failed, taken
319// under the lock so a handler may register another handler while events are
320// being dispatched.
321func (o *LinuxBufferParams) handlersForFailed() []func() {
322	o.handlersMu.Lock()
323	defer o.handlersMu.Unlock()
324	return o.onFailed
325}
326
327// EventSignature returns the declared event argument types in wire order.
328func (o *LinuxBufferParams) EventSignature(opcode uint16) (string, bool) {
329	switch opcode {
330	case 0:
331		return "new_id,", true
332	case 1:
333		return "", true
334	default:
335		return "", false
336	}
337}
338
339// Dispatch decodes one event on zwp_linux_buffer_params_v1 and calls the registered handlers.
340func (o *LinuxBufferParams) Dispatch(event *wl.Event) {
341	switch event.Opcode {
342	case 0: // created
343		bufferID := event.Uint32()
344		bufferObject := cross_wl_buffer.NewBuffer(o.Context())
345		bufferObject.SetID(bufferID)
346		bufferObject.SetVersion(o.Version())
347		o.Context().Register(bufferObject)
348
349		for i, handler := range o.handlersForCreated() {
350			_ = i
351			handler(bufferObject)
352		}
353	case 1: // failed
354
355		for i, handler := range o.handlersForFailed() {
356			_ = i
357			handler()
358		}
359	default:
360	}
361}
362
363// LinuxDmabufFeedbackInterface is the protocol interface name.
364const LinuxDmabufFeedbackInterface = "zwp_linux_dmabuf_feedback_v1"
365
366// LinuxDmabufFeedback is the generated binding for zwp_linux_dmabuf_feedback_v1 version 6.
367type LinuxDmabufFeedback struct {
368	wl.BaseProxy
369	// handlersMu guards the handler slices: a client may register or replace
370	// handlers while another goroutine dispatches events.
371	handlersMu            sync.Mutex
372	onDone                []func()
373	onFormatTable         []func(fd *wl.OwnedFD, size uint32)
374	onMainDevice          []func(device []byte)
375	onTrancheDone         []func()
376	onTrancheTargetDevice []func(device []byte)
377	onTrancheFormats      []func(indices []byte)
378	onTrancheFlags        []func(flags uint32)
379}
380
381// NewLinuxDmabufFeedback returns an unbound LinuxDmabufFeedback.
382func NewLinuxDmabufFeedback(ctx *wl.Context) *LinuxDmabufFeedback {
383	obj := &LinuxDmabufFeedback{}
384	obj.SetContext(ctx)
385	ctx.Register(obj)
386	return obj
387}
388
389// Using this request a client can tell the server that it is not going to use the zwp_linux_dmabuf_feedback_v1 object anymore.
390func (o *LinuxDmabufFeedback) Destroy() error {
391	if err := o.Context().RequestArgs(wl.Request{Proxy: o, Opcode: 0, Name: "zwp_linux_dmabuf_feedback_v1.destroy", Destructor: true}); err != nil {
392		return err
393	}
394	return nil
395}
396
397// OnDone registers a handler for the done event.
398//
399// Handlers are appended, so a second call adds another handler rather than
400// replacing the first. Registration is safe while another goroutine dispatches.
401func (o *LinuxDmabufFeedback) OnDone(handler func()) {
402	if handler == nil {
403		return
404	}
405	o.handlersMu.Lock()
406	defer o.handlersMu.Unlock()
407	o.onDone = append(o.onDone, handler)
408}
409
410// handlersForDone returns the handlers registered for done, taken
411// under the lock so a handler may register another handler while events are
412// being dispatched.
413func (o *LinuxDmabufFeedback) handlersForDone() []func() {
414	o.handlersMu.Lock()
415	defer o.handlersMu.Unlock()
416	return o.onDone
417}
418
419// OnFormatTable registers a handler for the format_table event.
420//
421// Handlers are appended, so a second call adds another handler rather than
422// replacing the first. Registration is safe while another goroutine dispatches.
423func (o *LinuxDmabufFeedback) OnFormatTable(handler func(fd *wl.OwnedFD, size uint32)) {
424	if handler == nil {
425		return
426	}
427	o.handlersMu.Lock()
428	defer o.handlersMu.Unlock()
429	o.onFormatTable = append(o.onFormatTable, handler)
430}
431
432// handlersForFormatTable returns the handlers registered for format_table, taken
433// under the lock so a handler may register another handler while events are
434// being dispatched.
435func (o *LinuxDmabufFeedback) handlersForFormatTable() []func(fd *wl.OwnedFD, size uint32) {
436	o.handlersMu.Lock()
437	defer o.handlersMu.Unlock()
438	return o.onFormatTable
439}
440
441// OnMainDevice registers a handler for the main_device event.
442//
443// Handlers are appended, so a second call adds another handler rather than
444// replacing the first. Registration is safe while another goroutine dispatches.
445func (o *LinuxDmabufFeedback) OnMainDevice(handler func(device []byte)) {
446	if handler == nil {
447		return
448	}
449	o.handlersMu.Lock()
450	defer o.handlersMu.Unlock()
451	o.onMainDevice = append(o.onMainDevice, handler)
452}
453
454// handlersForMainDevice returns the handlers registered for main_device, taken
455// under the lock so a handler may register another handler while events are
456// being dispatched.
457func (o *LinuxDmabufFeedback) handlersForMainDevice() []func(device []byte) {
458	o.handlersMu.Lock()
459	defer o.handlersMu.Unlock()
460	return o.onMainDevice
461}
462
463// OnTrancheDone registers a handler for the tranche_done event.
464//
465// Handlers are appended, so a second call adds another handler rather than
466// replacing the first. Registration is safe while another goroutine dispatches.
467func (o *LinuxDmabufFeedback) OnTrancheDone(handler func()) {
468	if handler == nil {
469		return
470	}
471	o.handlersMu.Lock()
472	defer o.handlersMu.Unlock()
473	o.onTrancheDone = append(o.onTrancheDone, handler)
474}
475
476// handlersForTrancheDone returns the handlers registered for tranche_done, taken
477// under the lock so a handler may register another handler while events are
478// being dispatched.
479func (o *LinuxDmabufFeedback) handlersForTrancheDone() []func() {
480	o.handlersMu.Lock()
481	defer o.handlersMu.Unlock()
482	return o.onTrancheDone
483}
484
485// OnTrancheTargetDevice registers a handler for the tranche_target_device event.
486//
487// Handlers are appended, so a second call adds another handler rather than
488// replacing the first. Registration is safe while another goroutine dispatches.
489func (o *LinuxDmabufFeedback) OnTrancheTargetDevice(handler func(device []byte)) {
490	if handler == nil {
491		return
492	}
493	o.handlersMu.Lock()
494	defer o.handlersMu.Unlock()
495	o.onTrancheTargetDevice = append(o.onTrancheTargetDevice, handler)
496}
497
498// handlersForTrancheTargetDevice returns the handlers registered for tranche_target_device, taken
499// under the lock so a handler may register another handler while events are
500// being dispatched.
501func (o *LinuxDmabufFeedback) handlersForTrancheTargetDevice() []func(device []byte) {
502	o.handlersMu.Lock()
503	defer o.handlersMu.Unlock()
504	return o.onTrancheTargetDevice
505}
506
507// OnTrancheFormats registers a handler for the tranche_formats event.
508//
509// Handlers are appended, so a second call adds another handler rather than
510// replacing the first. Registration is safe while another goroutine dispatches.
511func (o *LinuxDmabufFeedback) OnTrancheFormats(handler func(indices []byte)) {
512	if handler == nil {
513		return
514	}
515	o.handlersMu.Lock()
516	defer o.handlersMu.Unlock()
517	o.onTrancheFormats = append(o.onTrancheFormats, handler)
518}
519
520// handlersForTrancheFormats returns the handlers registered for tranche_formats, taken
521// under the lock so a handler may register another handler while events are
522// being dispatched.
523func (o *LinuxDmabufFeedback) handlersForTrancheFormats() []func(indices []byte) {
524	o.handlersMu.Lock()
525	defer o.handlersMu.Unlock()
526	return o.onTrancheFormats
527}
528
529// OnTrancheFlags registers a handler for the tranche_flags event.
530//
531// Handlers are appended, so a second call adds another handler rather than
532// replacing the first. Registration is safe while another goroutine dispatches.
533func (o *LinuxDmabufFeedback) OnTrancheFlags(handler func(flags uint32)) {
534	if handler == nil {
535		return
536	}
537	o.handlersMu.Lock()
538	defer o.handlersMu.Unlock()
539	o.onTrancheFlags = append(o.onTrancheFlags, handler)
540}
541
542// handlersForTrancheFlags returns the handlers registered for tranche_flags, taken
543// under the lock so a handler may register another handler while events are
544// being dispatched.
545func (o *LinuxDmabufFeedback) handlersForTrancheFlags() []func(flags uint32) {
546	o.handlersMu.Lock()
547	defer o.handlersMu.Unlock()
548	return o.onTrancheFlags
549}
550
551// EventSignature returns the declared event argument types in wire order.
552func (o *LinuxDmabufFeedback) EventSignature(opcode uint16) (string, bool) {
553	switch opcode {
554	case 0:
555		return "", true
556	case 1:
557		return "fd,uint,", true
558	case 2:
559		return "array,", true
560	case 3:
561		return "", true
562	case 4:
563		return "array,", true
564	case 5:
565		return "array,", true
566	case 6:
567		return "uint,", true
568	default:
569		return "", false
570	}
571}
572
573// Dispatch decodes one event on zwp_linux_dmabuf_feedback_v1 and calls the registered handlers.
574func (o *LinuxDmabufFeedback) Dispatch(event *wl.Event) {
575	switch event.Opcode {
576	case 0: // done
577
578		for i, handler := range o.handlersForDone() {
579			_ = i
580			handler()
581		}
582	case 1: // format_table
583		fd := event.FD()
584		size := event.Uint32()
585		ownedfd := fd
586		defer ownedfd.Close()
587
588		for i, handler := range o.handlersForFormatTable() {
589			if i > 0 {
590				fd = nil
591			}
592			handler(fd, size)
593		}
594	case 2: // main_device
595		device := event.Array()
596
597		for i, handler := range o.handlersForMainDevice() {
598			_ = i
599			handler(device)
600		}
601	case 3: // tranche_done
602
603		for i, handler := range o.handlersForTrancheDone() {
604			_ = i
605			handler()
606		}
607	case 4: // tranche_target_device
608		device := event.Array()
609
610		for i, handler := range o.handlersForTrancheTargetDevice() {
611			_ = i
612			handler(device)
613		}
614	case 5: // tranche_formats
615		indices := event.Array()
616
617		for i, handler := range o.handlersForTrancheFormats() {
618			_ = i
619			handler(indices)
620		}
621	case 6: // tranche_flags
622		flags := event.Uint32()
623
624		for i, handler := range o.handlersForTrancheFlags() {
625			_ = i
626			handler(flags)
627		}
628	default:
629	}
630}

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