AtlatestRepositorysigil-ui
1
<?xml version="1.0" encoding="UTF-8"?>2
<protocol name="linux_dmabuf_v1">4
<copyright>5
Copyright © 2014, 2015 Collabora, Ltd.7
Permission is hereby granted, free of charge, to any person obtaining a8
copy of this software and associated documentation files (the "Software"),9
to deal in the Software without restriction, including without limitation10
the rights to use, copy, modify, merge, publish, distribute, sublicense,11
and/or sell copies of the Software, and to permit persons to whom the12
Software is furnished to do so, subject to the following conditions:14
The above copyright notice and this permission notice (including the next15
paragraph) shall be included in all copies or substantial portions of the16
Software.18
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR19
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,20
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL21
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER22
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER24
DEALINGS IN THE SOFTWARE.25
</copyright>27
<interface name="zwp_linux_dmabuf_v1" version="5">28
<description summary="factory for creating dmabuf-based wl_buffers">29
This interface offers ways to create generic dmabuf-based wl_buffers.31
For more information about dmabuf, see:32
https://www.kernel.org/doc/html/next/userspace-api/dma-buf-alloc-exchange.html34
Clients can use the get_surface_feedback request to get dmabuf feedback35
for a particular surface. If the client wants to retrieve feedback not36
tied to a surface, they can use the get_default_feedback request.38
The following are required from clients:40
- Clients must ensure that either all data in the dma-buf is41
coherent for all subsequent read access or that coherency is42
correctly handled by the underlying kernel-side dma-buf43
implementation.45
- Don't make any more attachments after sending the buffer to the46
compositor. Making more attachments later increases the risk of47
the compositor not being able to use (re-import) an existing48
dmabuf-based wl_buffer.50
The underlying graphics stack must ensure the following:52
- The dmabuf file descriptors relayed to the server will stay valid53
for the whole lifetime of the wl_buffer. This means the server may54
at any time use those fds to import the dmabuf into any kernel55
sub-system that might accept it.57
However, when the underlying graphics stack fails to deliver the58
promise, because of e.g. a device hot-unplug which raises internal59
errors, after the wl_buffer has been successfully created the60
compositor must not raise protocol errors to the client when dmabuf61
import later fails.63
To create a wl_buffer from one or more dmabufs, a client creates a64
zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params65
request. All planes required by the intended format are added with66
the 'add' request. Finally, a 'create' or 'create_immed' request is67
issued, which has the following outcome depending on the import success.69
The 'create' request,70
- on success, triggers a 'created' event which provides the final71
wl_buffer to the client.72
- on failure, triggers a 'failed' event to convey that the server73
cannot use the dmabufs received from the client.75
For the 'create_immed' request,76
- on success, the server immediately imports the added dmabufs to77
create a wl_buffer. No event is sent from the server in this case.78
- on failure, the server can choose to either:79
- terminate the client by raising a fatal error.80
- mark the wl_buffer as failed, and send a 'failed' event to the81
client. If the client uses a failed wl_buffer as an argument to any82
request, the behaviour is compositor implementation-defined.84
For all DRM formats and unless specified in another protocol extension,85
pre-multiplied alpha is used for pixel values.87
Unless specified otherwise in another protocol extension, implicit88
synchronization is used. In other words, compositors and clients must89
wait and signal fences implicitly passed via the DMA-BUF's reservation90
mechanism.91
</description>93
<request name="destroy" type="destructor">94
<description summary="unbind the factory">95
Objects created through this interface, especially wl_buffers, will96
remain valid.97
</description>98
</request>100
<request name="create_params">101
<description summary="create a temporary object for buffer parameters">102
This temporary object is used to collect multiple dmabuf handles into103
a single batch to create a wl_buffer. It can only be used once and104
should be destroyed after a 'created' or 'failed' event has been105
received.106
</description>107
<arg name="params_id" type="new_id" interface="zwp_linux_buffer_params_v1"108
summary="the new temporary"/>109
</request>111
<event name="format" deprecated-since="4">112
<description summary="supported buffer format">113
This event advertises one buffer format that the server supports.114
All the supported formats are advertised once when the client115
binds to this interface. A roundtrip after binding guarantees116
that the client has received all supported formats.118
For the definition of the format codes, see the119
zwp_linux_buffer_params_v1::create request.121
Starting version 4, the format event is deprecated and must not be122
sent by compositors. Instead, use get_default_feedback or123
get_surface_feedback.124
</description>125
<arg name="format" type="uint" summary="DRM_FORMAT code"/>126
</event>128
<event name="modifier" since="3" deprecated-since="4">129
<description summary="supported buffer format modifier">130
This event advertises the formats that the server supports, along with131
the modifiers supported for each format. All the supported modifiers132
for all the supported formats are advertised once when the client133
binds to this interface. A roundtrip after binding guarantees that134
the client has received all supported format-modifier pairs.136
For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi ==137
0x00ffffff and modifier_lo == 0xffffffff) is allowed in this event.138
It indicates that the server can support the format with an implicit139
modifier. When a plane has DRM_FORMAT_MOD_INVALID as its modifier, it140
is as if no explicit modifier is specified. The effective modifier141
will be derived from the dmabuf.143
A compositor that sends valid modifiers and DRM_FORMAT_MOD_INVALID for144
a given format supports both explicit modifiers and implicit modifiers.146
For the definition of the format and modifier codes, see the147
zwp_linux_buffer_params_v1::create and zwp_linux_buffer_params_v1::add148
requests.150
Starting version 4, the modifier event is deprecated and must not be151
sent by compositors. Instead, use get_default_feedback or152
get_surface_feedback.153
</description>154
<arg name="format" type="uint" summary="DRM_FORMAT code"/>155
<arg name="modifier_hi" type="uint"156
summary="high 32 bits of layout modifier"/>157
<arg name="modifier_lo" type="uint"158
summary="low 32 bits of layout modifier"/>159
</event>161
<!-- Version 4 additions -->163
<request name="get_default_feedback" since="4">164
<description summary="get default feedback">165
This request creates a new wp_linux_dmabuf_feedback object not bound166
to a particular surface. This object will deliver feedback about dmabuf167
parameters to use if the client doesn't support per-surface feedback168
(see get_surface_feedback).169
</description>170
<arg name="id" type="new_id" interface="zwp_linux_dmabuf_feedback_v1"/>171
</request>173
<request name="get_surface_feedback" since="4">174
<description summary="get feedback for a surface">175
This request creates a new wp_linux_dmabuf_feedback object for the176
specified wl_surface. This object will deliver feedback about dmabuf177
parameters to use for buffers attached to this surface.179
If the surface is destroyed before the wp_linux_dmabuf_feedback object,180
the feedback object becomes inert.181
</description>182
<arg name="id" type="new_id" interface="zwp_linux_dmabuf_feedback_v1"/>183
<arg name="surface" type="object" interface="wl_surface"/>184
</request>185
</interface>187
<interface name="zwp_linux_buffer_params_v1" version="5">188
<description summary="parameters for creating a dmabuf-based wl_buffer">189
This temporary object is a collection of dmabufs and other190
parameters that together form a single logical buffer. The temporary191
object may eventually create one wl_buffer unless cancelled by192
destroying it before requesting 'create'.194
Single-planar formats only require one dmabuf, however195
multi-planar formats may require more than one dmabuf. For all196
formats, an 'add' request must be called once per plane (even if the197
underlying dmabuf fd is identical).199
You must use consecutive plane indices ('plane_idx' argument for 'add')200
from zero to the number of planes used by the drm_fourcc format code.201
All planes required by the format must be given exactly once, but can202
be given in any order. Each plane index can only be set once; subsequent203
calls with a plane index which has already been set will result in a204
plane_set error being generated.205
</description>207
<enum name="error">208
<entry name="already_used" value="0"209
summary="the dmabuf_batch object has already been used to create a wl_buffer"/>210
<entry name="plane_idx" value="1"211
summary="plane index out of bounds"/>212
<entry name="plane_set" value="2"213
summary="the plane index was already set"/>214
<entry name="incomplete" value="3"215
summary="missing or too many planes to create a buffer"/>216
<entry name="invalid_format" value="4"217
summary="format not supported"/>218
<entry name="invalid_dimensions" value="5"219
summary="invalid width or height"/>220
<entry name="out_of_bounds" value="6"221
summary="offset + stride * height goes out of dmabuf bounds"/>222
<entry name="invalid_wl_buffer" value="7"223
summary="invalid wl_buffer resulted from importing dmabufs via224
the create_immed request on given buffer_params"/>225
</enum>227
<request name="destroy" type="destructor">228
<description summary="delete this object, used or not">229
Cleans up the temporary data sent to the server for dmabuf-based230
wl_buffer creation.231
</description>232
</request>234
<request name="add">235
<description summary="add a dmabuf to the temporary set">236
This request adds one dmabuf to the set in this237
zwp_linux_buffer_params_v1.239
The 64-bit unsigned value combined from modifier_hi and modifier_lo240
is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the241
fb modifier, which is defined in drm_mode.h of Linux UAPI.242
This is an opaque token. Drivers use this token to express tiling,243
compression, etc. driver-specific modifications to the base format244
defined by the DRM fourcc code.246
Starting from version 4, the invalid_format protocol error is sent if247
the format + modifier pair was not advertised as supported.249
Starting from version 5, the invalid_format protocol error is sent if250
all planes don't use the same modifier.252
This request raises the PLANE_IDX error if plane_idx is too large.253
The error PLANE_SET is raised if attempting to set a plane that254
was already set.255
</description>256
<arg name="fd" type="fd" summary="dmabuf fd"/>257
<arg name="plane_idx" type="uint" summary="plane index"/>258
<arg name="offset" type="uint" summary="offset in bytes"/>259
<arg name="stride" type="uint" summary="stride in bytes"/>260
<arg name="modifier_hi" type="uint"261
summary="high 32 bits of layout modifier"/>262
<arg name="modifier_lo" type="uint"263
summary="low 32 bits of layout modifier"/>264
</request>266
<enum name="flags" bitfield="true">267
<entry name="y_invert" value="1" summary="contents are y-inverted"/>268
<entry name="interlaced" value="2" summary="content is interlaced"/>269
<entry name="bottom_first" value="4" summary="bottom field first"/>270
</enum>272
<request name="create">273
<description summary="create a wl_buffer from the given dmabufs">274
This asks for creation of a wl_buffer from the added dmabuf275
buffers. The wl_buffer is not created immediately but returned via276
the 'created' event if the dmabuf sharing succeeds. The sharing277
may fail at runtime for reasons a client cannot predict, in278
which case the 'failed' event is triggered.280
The 'format' argument is a DRM_FORMAT code, as defined by the281
libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the282
authoritative source on how the format codes should work.284
The 'flags' is a bitfield of the flags defined in enum "flags".285
'y_invert' means the that the image needs to be y-flipped.287
Flag 'interlaced' means that the frame in the buffer is not288
progressive as usual, but interlaced. An interlaced buffer as289
supported here must always contain both top and bottom fields.290
The top field always begins on the first pixel row. The temporal291
ordering between the two fields is top field first, unless292
'bottom_first' is specified. It is undefined whether 'bottom_first'293
is ignored if 'interlaced' is not set.295
This protocol does not convey any information about field rate,296
duration, or timing, other than the relative ordering between the297
two fields in one buffer. A compositor may have to estimate the298
intended field rate from the incoming buffer rate. It is undefined299
whether the time of receiving wl_surface.commit with a new buffer300
attached, applying the wl_surface state, wl_surface.frame callback301
trigger, presentation, or any other point in the compositor cycle302
is used to measure the frame or field times. There is no support303
for detecting missed or late frames/fields/buffers either, and304
there is no support whatsoever for cooperating with interlaced305
compositor output.307
The composited image quality resulting from the use of interlaced308
buffers is explicitly undefined. A compositor may use elaborate309
hardware features or software to deinterlace and create progressive310
output frames from a sequence of interlaced input buffers, or it311
may produce substandard image quality. However, compositors that312
cannot guarantee reasonable image quality in all cases are recommended313
to just reject all interlaced buffers.315
Any argument errors, including non-positive width or height,316
mismatch between the number of planes and the format, bad317
format, bad offset or stride, may be indicated by fatal protocol318
errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS,319
OUT_OF_BOUNDS.321
Dmabuf import errors in the server that are not obvious client322
bugs are returned via the 'failed' event as non-fatal. This323
allows attempting dmabuf sharing and falling back in the client324
if it fails.326
This request can be sent only once in the object's lifetime, after327
which the only legal request is destroy. This object should be328
destroyed after issuing a 'create' request. Attempting to use this329
object after issuing 'create' raises ALREADY_USED protocol error.331
It is not mandatory to issue 'create'. If a client wants to332
cancel the buffer creation, it can just destroy this object.333
</description>334
<arg name="width" type="int" summary="base plane width in pixels"/>335
<arg name="height" type="int" summary="base plane height in pixels"/>336
<arg name="format" type="uint" summary="DRM_FORMAT code"/>337
<arg name="flags" type="uint" enum="flags" summary="see enum flags"/>338
</request>340
<event name="created">341
<description summary="buffer creation succeeded">342
This event indicates that the attempted buffer creation was343
successful. It provides the new wl_buffer referencing the dmabuf(s).345
Upon receiving this event, the client should destroy the346
zwp_linux_buffer_params_v1 object.347
</description>348
<arg name="buffer" type="new_id" interface="wl_buffer"349
summary="the newly created wl_buffer"/>350
</event>352
<event name="failed">353
<description summary="buffer creation failed">354
This event indicates that the attempted buffer creation has355
failed. It usually means that one of the dmabuf constraints356
has not been fulfilled.358
Upon receiving this event, the client should destroy the359
zwp_linux_buffer_params_v1 object.360
</description>361
</event>363
<request name="create_immed" since="2">364
<description summary="immediately create a wl_buffer from the given365
dmabufs">366
This asks for immediate creation of a wl_buffer by importing the367
added dmabufs.369
In case of import success, no event is sent from the server, and the370
wl_buffer is ready to be used by the client.372
Upon import failure, either of the following may happen, as seen fit373
by the implementation:374
- the client is terminated with one of the following fatal protocol375
errors:376
- INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS,377
in case of argument errors such as mismatch between the number378
of planes and the format, bad format, non-positive width or379
height, or bad offset or stride.380
- INVALID_WL_BUFFER, in case the cause for failure is unknown or381
platform specific.382
- the server creates an invalid wl_buffer, marks it as failed and383
sends a 'failed' event to the client. The result of using this384
invalid wl_buffer as an argument in any request by the client is385
defined by the compositor implementation.387
This takes the same arguments as a 'create' request, and obeys the388
same restrictions.389
</description>390
<arg name="buffer_id" type="new_id" interface="wl_buffer"391
summary="id for the newly created wl_buffer"/>392
<arg name="width" type="int" summary="base plane width in pixels"/>393
<arg name="height" type="int" summary="base plane height in pixels"/>394
<arg name="format" type="uint" summary="DRM_FORMAT code"/>395
<arg name="flags" type="uint" enum="flags" summary="see enum flags"/>396
</request>397
</interface>399
<interface name="zwp_linux_dmabuf_feedback_v1" version="5">400
<description summary="dmabuf feedback">401
This object advertises dmabuf parameters feedback. This includes the402
preferred devices and the supported formats/modifiers.404
The parameters are sent once when this object is created and whenever they405
change. The done event is always sent once after all parameters have been406
sent. When a single parameter changes, all parameters are re-sent by the407
compositor.409
Compositors can re-send the parameters when the current client buffer410
allocations are sub-optimal. Compositors should not re-send the411
parameters if re-allocating the buffers would not result in a more optimal412
configuration. In particular, compositors should avoid sending the exact413
same parameters multiple times in a row.415
The tranche_target_device and tranche_formats events are grouped by416
tranches of preference. For each tranche, a tranche_target_device, one417
tranche_flags and one or more tranche_formats events are sent, followed418
by a tranche_done event finishing the list. The tranches are sent in419
descending order of preference. All formats and modifiers in the same420
tranche have the same preference.422
To send parameters, the compositor sends one main_device event, tranches423
(each consisting of one tranche_target_device event, one tranche_flags424
event, tranche_formats events and then a tranche_done event), then one425
done event.426
</description>428
<request name="destroy" type="destructor">429
<description summary="destroy the feedback object">430
Using this request a client can tell the server that it is not going to431
use the wp_linux_dmabuf_feedback object anymore.432
</description>433
</request>435
<event name="done">436
<description summary="all feedback has been sent">437
This event is sent after all parameters of a wp_linux_dmabuf_feedback438
object have been sent.440
This allows changes to the wp_linux_dmabuf_feedback parameters to be441
seen as atomic, even if they happen via multiple events.442
</description>443
</event>445
<event name="format_table">446
<description summary="format and modifier table">447
This event provides a file descriptor which can be memory-mapped to448
access the format and modifier table.450
The table contains a tightly packed array of consecutive format +451
modifier pairs. Each pair is 16 bytes wide. It contains a format as a452
32-bit unsigned integer, followed by 4 bytes of unused padding, and a453
modifier as a 64-bit unsigned integer. The native endianness is used.455
The client must map the file descriptor in read-only private mode.457
Compositors are not allowed to mutate the table file contents once this458
event has been sent. Instead, compositors must create a new, separate459
table file and re-send feedback parameters. Compositors are allowed to460
store duplicate format + modifier pairs in the table.461
</description>462
<arg name="fd" type="fd" summary="table file descriptor"/>463
<arg name="size" type="uint" summary="table size, in bytes"/>464
</event>466
<event name="main_device">467
<description summary="preferred main device">468
This event advertises the main device that the server prefers to use469
when direct scan-out to the target device isn't possible. The470
advertised main device may be different for each471
wp_linux_dmabuf_feedback object, and may change over time.473
There is exactly one main device. The compositor must send at least474
one preference tranche with tranche_target_device equal to main_device.476
Clients need to create buffers that the main device can import and477
read from, otherwise creating the dmabuf wl_buffer will fail (see the478
wp_linux_buffer_params.create and create_immed requests for details).479
The main device will also likely be kept active by the compositor,480
so clients can use it instead of waking up another device for power481
savings.483
In general the device is a DRM node. The DRM node type (primary vs.484
render) is unspecified. Clients must not rely on the compositor sending485
a particular node type. Clients cannot check two devices for equality486
by comparing the dev_t value.488
If explicit modifiers are not supported and the client performs buffer489
allocations on a different device than the main device, then the client490
must force the buffer to have a linear layout.491
</description>492
<arg name="device" type="array" summary="device dev_t value"/>493
</event>495
<event name="tranche_done">496
<description summary="a preference tranche has been sent">497
This event splits tranche_target_device and tranche_formats events in498
preference tranches. It is sent after a set of tranche_target_device499
and tranche_formats events; it represents the end of a tranche. The500
next tranche will have a lower preference.501
</description>502
</event>504
<event name="tranche_target_device">505
<description summary="target device">506
This event advertises the target device that the server prefers to use507
for a buffer created given this tranche. The advertised target device508
may be different for each preference tranche, and may change over time.510
There is exactly one target device per tranche.512
The target device may be a scan-out device, for example if the513
compositor prefers to directly scan-out a buffer created given this514
tranche. The target device may be a rendering device, for example if515
the compositor prefers to texture from said buffer.517
The client can use this hint to allocate the buffer in a way that makes518
it accessible from the target device, ideally directly. The buffer must519
still be accessible from the main device, either through direct import520
or through a potentially more expensive fallback path. If the buffer521
can't be directly imported from the main device then clients must be522
prepared for the compositor changing the tranche priority or making523
wl_buffer creation fail (see the wp_linux_buffer_params.create and524
create_immed requests for details).526
If the device is a DRM node, the DRM node type (primary vs. render) is527
unspecified. Clients must not rely on the compositor sending a528
particular node type. Clients cannot check two devices for equality by529
comparing the dev_t value.531
This event is tied to a preference tranche, see the tranche_done event.532
</description>533
<arg name="device" type="array" summary="device dev_t value"/>534
</event>536
<event name="tranche_formats">537
<description summary="supported buffer format modifier">538
This event advertises the format + modifier combinations that the539
compositor supports.541
It carries an array of indices, each referring to a format + modifier542
pair in the last received format table (see the format_table event).543
Each index is a 16-bit unsigned integer in native endianness.545
For legacy support, DRM_FORMAT_MOD_INVALID is an allowed modifier.546
It indicates that the server can support the format with an implicit547
modifier. When a buffer has DRM_FORMAT_MOD_INVALID as its modifier, it548
is as if no explicit modifier is specified. The effective modifier549
will be derived from the dmabuf.551
A compositor that sends valid modifiers and DRM_FORMAT_MOD_INVALID for552
a given format supports both explicit modifiers and implicit modifiers.554
Compositors must not send duplicate format + modifier pairs within the555
same tranche or across two different tranches with the same target556
device and flags.558
This event is tied to a preference tranche, see the tranche_done event.560
For the definition of the format and modifier codes, see the561
wp_linux_buffer_params.create request.562
</description>563
<arg name="indices" type="array" summary="array of 16-bit indexes"/>564
</event>566
<enum name="tranche_flags" bitfield="true">567
<entry name="scanout" value="1" summary="direct scan-out tranche"/>568
</enum>570
<event name="tranche_flags">571
<description summary="tranche flags">572
This event sets tranche-specific flags.574
The scanout flag is a hint that direct scan-out may be attempted by the575
compositor on the target device if the client appropriately allocates a576
buffer. How to allocate a buffer that can be scanned out on the target577
device is implementation-defined.579
This event is tied to a preference tranche, see the tranche_done event.580
</description>581
<arg name="flags" type="uint" enum="tranche_flags" summary="tranche flags"/>582
</event>583
</interface>585
</protocol>