AtlatestRepositorysigil-ui
1
/* Generated by wayland-scanner 1.24.0 */3
#ifndef LINUX_DMABUF_V1_CLIENT_PROTOCOL_H4
#define LINUX_DMABUF_V1_CLIENT_PROTOCOL_H6
#include <stdint.h>7
#include <stddef.h>8
#include "wayland-client.h"10
#ifdef __cplusplus11
extern "C" {12
#endif14
/**15
* @page page_linux_dmabuf_v1 The linux_dmabuf_v1 protocol16
* @section page_ifaces_linux_dmabuf_v1 Interfaces17
* - @subpage page_iface_zwp_linux_dmabuf_v1 - factory for creating dmabuf-based wl_buffers18
* - @subpage page_iface_zwp_linux_buffer_params_v1 - parameters for creating a dmabuf-based wl_buffer19
* - @subpage page_iface_zwp_linux_dmabuf_feedback_v1 - dmabuf feedback20
* @section page_copyright_linux_dmabuf_v1 Copyright21
* <pre>22
*23
* Copyright © 2014, 2015 Collabora, Ltd.24
*25
* Permission is hereby granted, free of charge, to any person obtaining a26
* copy of this software and associated documentation files (the "Software"),27
* to deal in the Software without restriction, including without limitation28
* the rights to use, copy, modify, merge, publish, distribute, sublicense,29
* and/or sell copies of the Software, and to permit persons to whom the30
* Software is furnished to do so, subject to the following conditions:31
*32
* The above copyright notice and this permission notice (including the next33
* paragraph) shall be included in all copies or substantial portions of the34
* Software.35
*36
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR37
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,38
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL39
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER40
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING41
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER42
* DEALINGS IN THE SOFTWARE.43
* </pre>44
*/45
struct wl_buffer;46
struct wl_surface;47
struct zwp_linux_buffer_params_v1;48
struct zwp_linux_dmabuf_feedback_v1;49
struct zwp_linux_dmabuf_v1;51
#ifndef ZWP_LINUX_DMABUF_V1_INTERFACE52
#define ZWP_LINUX_DMABUF_V1_INTERFACE53
/**54
* @page page_iface_zwp_linux_dmabuf_v1 zwp_linux_dmabuf_v155
* @section page_iface_zwp_linux_dmabuf_v1_desc Description56
*57
* This interface offers ways to create generic dmabuf-based wl_buffers.58
*59
* For more information about dmabuf, see:60
* https://www.kernel.org/doc/html/next/userspace-api/dma-buf-alloc-exchange.html61
*62
* Clients can use the get_surface_feedback request to get dmabuf feedback63
* for a particular surface. If the client wants to retrieve feedback not64
* tied to a surface, they can use the get_default_feedback request.65
*66
* The following are required from clients:67
*68
* - Clients must ensure that either all data in the dma-buf is69
* coherent for all subsequent read access or that coherency is70
* correctly handled by the underlying kernel-side dma-buf71
* implementation.72
*73
* - Don't make any more attachments after sending the buffer to the74
* compositor. Making more attachments later increases the risk of75
* the compositor not being able to use (re-import) an existing76
* dmabuf-based wl_buffer.77
*78
* The underlying graphics stack must ensure the following:79
*80
* - The dmabuf file descriptors relayed to the server will stay valid81
* for the whole lifetime of the wl_buffer. This means the server may82
* at any time use those fds to import the dmabuf into any kernel83
* sub-system that might accept it.84
*85
* However, when the underlying graphics stack fails to deliver the86
* promise, because of e.g. a device hot-unplug which raises internal87
* errors, after the wl_buffer has been successfully created the88
* compositor must not raise protocol errors to the client when dmabuf89
* import later fails.90
*91
* To create a wl_buffer from one or more dmabufs, a client creates a92
* zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params93
* request. All planes required by the intended format are added with94
* the 'add' request. Finally, a 'create' or 'create_immed' request is95
* issued, which has the following outcome depending on the import success.96
*97
* The 'create' request,98
* - on success, triggers a 'created' event which provides the final99
* wl_buffer to the client.100
* - on failure, triggers a 'failed' event to convey that the server101
* cannot use the dmabufs received from the client.102
*103
* For the 'create_immed' request,104
* - on success, the server immediately imports the added dmabufs to105
* create a wl_buffer. No event is sent from the server in this case.106
* - on failure, the server can choose to either:107
* - terminate the client by raising a fatal error.108
* - mark the wl_buffer as failed, and send a 'failed' event to the109
* client. If the client uses a failed wl_buffer as an argument to any110
* request, the behaviour is compositor implementation-defined.111
*112
* For all DRM formats and unless specified in another protocol extension,113
* pre-multiplied alpha is used for pixel values.114
*115
* Unless specified otherwise in another protocol extension, implicit116
* synchronization is used. In other words, compositors and clients must117
* wait and signal fences implicitly passed via the DMA-BUF's reservation118
* mechanism.119
* @section page_iface_zwp_linux_dmabuf_v1_api API120
* See @ref iface_zwp_linux_dmabuf_v1.121
*/122
/**123
* @defgroup iface_zwp_linux_dmabuf_v1 The zwp_linux_dmabuf_v1 interface124
*125
* This interface offers ways to create generic dmabuf-based wl_buffers.126
*127
* For more information about dmabuf, see:128
* https://www.kernel.org/doc/html/next/userspace-api/dma-buf-alloc-exchange.html129
*130
* Clients can use the get_surface_feedback request to get dmabuf feedback131
* for a particular surface. If the client wants to retrieve feedback not132
* tied to a surface, they can use the get_default_feedback request.133
*134
* The following are required from clients:135
*136
* - Clients must ensure that either all data in the dma-buf is137
* coherent for all subsequent read access or that coherency is138
* correctly handled by the underlying kernel-side dma-buf139
* implementation.140
*141
* - Don't make any more attachments after sending the buffer to the142
* compositor. Making more attachments later increases the risk of143
* the compositor not being able to use (re-import) an existing144
* dmabuf-based wl_buffer.145
*146
* The underlying graphics stack must ensure the following:147
*148
* - The dmabuf file descriptors relayed to the server will stay valid149
* for the whole lifetime of the wl_buffer. This means the server may150
* at any time use those fds to import the dmabuf into any kernel151
* sub-system that might accept it.152
*153
* However, when the underlying graphics stack fails to deliver the154
* promise, because of e.g. a device hot-unplug which raises internal155
* errors, after the wl_buffer has been successfully created the156
* compositor must not raise protocol errors to the client when dmabuf157
* import later fails.158
*159
* To create a wl_buffer from one or more dmabufs, a client creates a160
* zwp_linux_dmabuf_params_v1 object with a zwp_linux_dmabuf_v1.create_params161
* request. All planes required by the intended format are added with162
* the 'add' request. Finally, a 'create' or 'create_immed' request is163
* issued, which has the following outcome depending on the import success.164
*165
* The 'create' request,166
* - on success, triggers a 'created' event which provides the final167
* wl_buffer to the client.168
* - on failure, triggers a 'failed' event to convey that the server169
* cannot use the dmabufs received from the client.170
*171
* For the 'create_immed' request,172
* - on success, the server immediately imports the added dmabufs to173
* create a wl_buffer. No event is sent from the server in this case.174
* - on failure, the server can choose to either:175
* - terminate the client by raising a fatal error.176
* - mark the wl_buffer as failed, and send a 'failed' event to the177
* client. If the client uses a failed wl_buffer as an argument to any178
* request, the behaviour is compositor implementation-defined.179
*180
* For all DRM formats and unless specified in another protocol extension,181
* pre-multiplied alpha is used for pixel values.182
*183
* Unless specified otherwise in another protocol extension, implicit184
* synchronization is used. In other words, compositors and clients must185
* wait and signal fences implicitly passed via the DMA-BUF's reservation186
* mechanism.187
*/188
extern const struct wl_interface zwp_linux_dmabuf_v1_interface;189
#endif190
#ifndef ZWP_LINUX_BUFFER_PARAMS_V1_INTERFACE191
#define ZWP_LINUX_BUFFER_PARAMS_V1_INTERFACE192
/**193
* @page page_iface_zwp_linux_buffer_params_v1 zwp_linux_buffer_params_v1194
* @section page_iface_zwp_linux_buffer_params_v1_desc Description195
*196
* This temporary object is a collection of dmabufs and other197
* parameters that together form a single logical buffer. The temporary198
* object may eventually create one wl_buffer unless cancelled by199
* destroying it before requesting 'create'.200
*201
* Single-planar formats only require one dmabuf, however202
* multi-planar formats may require more than one dmabuf. For all203
* formats, an 'add' request must be called once per plane (even if the204
* underlying dmabuf fd is identical).205
*206
* You must use consecutive plane indices ('plane_idx' argument for 'add')207
* from zero to the number of planes used by the drm_fourcc format code.208
* All planes required by the format must be given exactly once, but can209
* be given in any order. Each plane index can only be set once; subsequent210
* calls with a plane index which has already been set will result in a211
* plane_set error being generated.212
* @section page_iface_zwp_linux_buffer_params_v1_api API213
* See @ref iface_zwp_linux_buffer_params_v1.214
*/215
/**216
* @defgroup iface_zwp_linux_buffer_params_v1 The zwp_linux_buffer_params_v1 interface217
*218
* This temporary object is a collection of dmabufs and other219
* parameters that together form a single logical buffer. The temporary220
* object may eventually create one wl_buffer unless cancelled by221
* destroying it before requesting 'create'.222
*223
* Single-planar formats only require one dmabuf, however224
* multi-planar formats may require more than one dmabuf. For all225
* formats, an 'add' request must be called once per plane (even if the226
* underlying dmabuf fd is identical).227
*228
* You must use consecutive plane indices ('plane_idx' argument for 'add')229
* from zero to the number of planes used by the drm_fourcc format code.230
* All planes required by the format must be given exactly once, but can231
* be given in any order. Each plane index can only be set once; subsequent232
* calls with a plane index which has already been set will result in a233
* plane_set error being generated.234
*/235
extern const struct wl_interface zwp_linux_buffer_params_v1_interface;236
#endif237
#ifndef ZWP_LINUX_DMABUF_FEEDBACK_V1_INTERFACE238
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_INTERFACE239
/**240
* @page page_iface_zwp_linux_dmabuf_feedback_v1 zwp_linux_dmabuf_feedback_v1241
* @section page_iface_zwp_linux_dmabuf_feedback_v1_desc Description242
*243
* This object advertises dmabuf parameters feedback. This includes the244
* preferred devices and the supported formats/modifiers.245
*246
* The parameters are sent once when this object is created and whenever they247
* change. The done event is always sent once after all parameters have been248
* sent. When a single parameter changes, all parameters are re-sent by the249
* compositor.250
*251
* Compositors can re-send the parameters when the current client buffer252
* allocations are sub-optimal. Compositors should not re-send the253
* parameters if re-allocating the buffers would not result in a more optimal254
* configuration. In particular, compositors should avoid sending the exact255
* same parameters multiple times in a row.256
*257
* The tranche_target_device and tranche_formats events are grouped by258
* tranches of preference. For each tranche, a tranche_target_device, one259
* tranche_flags and one or more tranche_formats events are sent, followed260
* by a tranche_done event finishing the list. The tranches are sent in261
* descending order of preference. All formats and modifiers in the same262
* tranche have the same preference.263
*264
* To send parameters, the compositor sends one main_device event, tranches265
* (each consisting of one tranche_target_device event, one tranche_flags266
* event, tranche_formats events and then a tranche_done event), then one267
* done event.268
* @section page_iface_zwp_linux_dmabuf_feedback_v1_api API269
* See @ref iface_zwp_linux_dmabuf_feedback_v1.270
*/271
/**272
* @defgroup iface_zwp_linux_dmabuf_feedback_v1 The zwp_linux_dmabuf_feedback_v1 interface273
*274
* This object advertises dmabuf parameters feedback. This includes the275
* preferred devices and the supported formats/modifiers.276
*277
* The parameters are sent once when this object is created and whenever they278
* change. The done event is always sent once after all parameters have been279
* sent. When a single parameter changes, all parameters are re-sent by the280
* compositor.281
*282
* Compositors can re-send the parameters when the current client buffer283
* allocations are sub-optimal. Compositors should not re-send the284
* parameters if re-allocating the buffers would not result in a more optimal285
* configuration. In particular, compositors should avoid sending the exact286
* same parameters multiple times in a row.287
*288
* The tranche_target_device and tranche_formats events are grouped by289
* tranches of preference. For each tranche, a tranche_target_device, one290
* tranche_flags and one or more tranche_formats events are sent, followed291
* by a tranche_done event finishing the list. The tranches are sent in292
* descending order of preference. All formats and modifiers in the same293
* tranche have the same preference.294
*295
* To send parameters, the compositor sends one main_device event, tranches296
* (each consisting of one tranche_target_device event, one tranche_flags297
* event, tranche_formats events and then a tranche_done event), then one298
* done event.299
*/300
extern const struct wl_interface zwp_linux_dmabuf_feedback_v1_interface;301
#endif303
/**304
* @ingroup iface_zwp_linux_dmabuf_v1305
* @struct zwp_linux_dmabuf_v1_listener306
*/307
struct zwp_linux_dmabuf_v1_listener {308
/**309
* supported buffer format310
*311
* This event advertises one buffer format that the server312
* supports. All the supported formats are advertised once when the313
* client binds to this interface. A roundtrip after binding314
* guarantees that the client has received all supported formats.315
*316
* For the definition of the format codes, see the317
* zwp_linux_buffer_params_v1::create request.318
*319
* Starting version 4, the format event is deprecated and must not320
* be sent by compositors. Instead, use get_default_feedback or321
* get_surface_feedback.322
* @param format DRM_FORMAT code323
* @deprecated Deprecated since version 4324
*/325
void (*format)(void *data,326
struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1,327
uint32_t format);328
/**329
* supported buffer format modifier330
*331
* This event advertises the formats that the server supports,332
* along with the modifiers supported for each format. All the333
* supported modifiers for all the supported formats are advertised334
* once when the client binds to this interface. A roundtrip after335
* binding guarantees that the client has received all supported336
* format-modifier pairs.337
*338
* For legacy support, DRM_FORMAT_MOD_INVALID (that is, modifier_hi339
* == 0x00ffffff and modifier_lo == 0xffffffff) is allowed in this340
* event. It indicates that the server can support the format with341
* an implicit modifier. When a plane has DRM_FORMAT_MOD_INVALID as342
* its modifier, it is as if no explicit modifier is specified. The343
* effective modifier will be derived from the dmabuf.344
*345
* A compositor that sends valid modifiers and346
* DRM_FORMAT_MOD_INVALID for a given format supports both explicit347
* modifiers and implicit modifiers.348
*349
* For the definition of the format and modifier codes, see the350
* zwp_linux_buffer_params_v1::create and351
* zwp_linux_buffer_params_v1::add requests.352
*353
* Starting version 4, the modifier event is deprecated and must354
* not be sent by compositors. Instead, use get_default_feedback or355
* get_surface_feedback.356
* @param format DRM_FORMAT code357
* @param modifier_hi high 32 bits of layout modifier358
* @param modifier_lo low 32 bits of layout modifier359
* @since 3360
* @deprecated Deprecated since version 4361
*/362
void (*modifier)(void *data,363
struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1,364
uint32_t format,365
uint32_t modifier_hi,366
uint32_t modifier_lo);367
};369
/**370
* @ingroup iface_zwp_linux_dmabuf_v1371
*/372
static inline int373
zwp_linux_dmabuf_v1_add_listener(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1,374
const struct zwp_linux_dmabuf_v1_listener *listener, void *data)375
{376
return wl_proxy_add_listener((struct wl_proxy *) zwp_linux_dmabuf_v1,377
(void (**)(void)) listener, data);378
}380
#define ZWP_LINUX_DMABUF_V1_DESTROY 0381
#define ZWP_LINUX_DMABUF_V1_CREATE_PARAMS 1382
#define ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK 2383
#define ZWP_LINUX_DMABUF_V1_GET_SURFACE_FEEDBACK 3385
/**386
* @ingroup iface_zwp_linux_dmabuf_v1387
*/388
#define ZWP_LINUX_DMABUF_V1_FORMAT_SINCE_VERSION 1389
/**390
* @ingroup iface_zwp_linux_dmabuf_v1391
*/392
#define ZWP_LINUX_DMABUF_V1_MODIFIER_SINCE_VERSION 3394
/**395
* @ingroup iface_zwp_linux_dmabuf_v1396
*/397
#define ZWP_LINUX_DMABUF_V1_DESTROY_SINCE_VERSION 1398
/**399
* @ingroup iface_zwp_linux_dmabuf_v1400
*/401
#define ZWP_LINUX_DMABUF_V1_CREATE_PARAMS_SINCE_VERSION 1402
/**403
* @ingroup iface_zwp_linux_dmabuf_v1404
*/405
#define ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK_SINCE_VERSION 4406
/**407
* @ingroup iface_zwp_linux_dmabuf_v1408
*/409
#define ZWP_LINUX_DMABUF_V1_GET_SURFACE_FEEDBACK_SINCE_VERSION 4411
/** @ingroup iface_zwp_linux_dmabuf_v1 */412
static inline void413
zwp_linux_dmabuf_v1_set_user_data(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1, void *user_data)414
{415
wl_proxy_set_user_data((struct wl_proxy *) zwp_linux_dmabuf_v1, user_data);416
}418
/** @ingroup iface_zwp_linux_dmabuf_v1 */419
static inline void *420
zwp_linux_dmabuf_v1_get_user_data(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1)421
{422
return wl_proxy_get_user_data((struct wl_proxy *) zwp_linux_dmabuf_v1);423
}425
static inline uint32_t426
zwp_linux_dmabuf_v1_get_version(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1)427
{428
return wl_proxy_get_version((struct wl_proxy *) zwp_linux_dmabuf_v1);429
}431
/**432
* @ingroup iface_zwp_linux_dmabuf_v1433
*434
* Objects created through this interface, especially wl_buffers, will435
* remain valid.436
*/437
static inline void438
zwp_linux_dmabuf_v1_destroy(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1)439
{440
wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_dmabuf_v1,441
ZWP_LINUX_DMABUF_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_linux_dmabuf_v1), WL_MARSHAL_FLAG_DESTROY);442
}444
/**445
* @ingroup iface_zwp_linux_dmabuf_v1446
*447
* This temporary object is used to collect multiple dmabuf handles into448
* a single batch to create a wl_buffer. It can only be used once and449
* should be destroyed after a 'created' or 'failed' event has been450
* received.451
*/452
static inline struct zwp_linux_buffer_params_v1 *453
zwp_linux_dmabuf_v1_create_params(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1)454
{455
struct wl_proxy *params_id;457
params_id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_dmabuf_v1,458
ZWP_LINUX_DMABUF_V1_CREATE_PARAMS, &zwp_linux_buffer_params_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_linux_dmabuf_v1), 0, NULL);460
return (struct zwp_linux_buffer_params_v1 *) params_id;461
}463
/**464
* @ingroup iface_zwp_linux_dmabuf_v1465
*466
* This request creates a new wp_linux_dmabuf_feedback object not bound467
* to a particular surface. This object will deliver feedback about dmabuf468
* parameters to use if the client doesn't support per-surface feedback469
* (see get_surface_feedback).470
*/471
static inline struct zwp_linux_dmabuf_feedback_v1 *472
zwp_linux_dmabuf_v1_get_default_feedback(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1)473
{474
struct wl_proxy *id;476
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_dmabuf_v1,477
ZWP_LINUX_DMABUF_V1_GET_DEFAULT_FEEDBACK, &zwp_linux_dmabuf_feedback_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_linux_dmabuf_v1), 0, NULL);479
return (struct zwp_linux_dmabuf_feedback_v1 *) id;480
}482
/**483
* @ingroup iface_zwp_linux_dmabuf_v1484
*485
* This request creates a new wp_linux_dmabuf_feedback object for the486
* specified wl_surface. This object will deliver feedback about dmabuf487
* parameters to use for buffers attached to this surface.488
*489
* If the surface is destroyed before the wp_linux_dmabuf_feedback object,490
* the feedback object becomes inert.491
*/492
static inline struct zwp_linux_dmabuf_feedback_v1 *493
zwp_linux_dmabuf_v1_get_surface_feedback(struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf_v1, struct wl_surface *surface)494
{495
struct wl_proxy *id;497
id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_dmabuf_v1,498
ZWP_LINUX_DMABUF_V1_GET_SURFACE_FEEDBACK, &zwp_linux_dmabuf_feedback_v1_interface, wl_proxy_get_version((struct wl_proxy *) zwp_linux_dmabuf_v1), 0, NULL, surface);500
return (struct zwp_linux_dmabuf_feedback_v1 *) id;501
}503
#ifndef ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM504
#define ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM505
enum zwp_linux_buffer_params_v1_error {506
/**507
* the dmabuf_batch object has already been used to create a wl_buffer508
*/509
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ALREADY_USED = 0,510
/**511
* plane index out of bounds512
*/513
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_IDX = 1,514
/**515
* the plane index was already set516
*/517
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_PLANE_SET = 2,518
/**519
* missing or too many planes to create a buffer520
*/521
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INCOMPLETE = 3,522
/**523
* format not supported524
*/525
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT = 4,526
/**527
* invalid width or height528
*/529
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_DIMENSIONS = 5,530
/**531
* offset + stride * height goes out of dmabuf bounds532
*/533
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_OUT_OF_BOUNDS = 6,534
/**535
* invalid wl_buffer resulted from importing dmabufs via the create_immed request on given buffer_params536
*/537
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_WL_BUFFER = 7,538
};539
#endif /* ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_ENUM */541
#ifndef ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM542
#define ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM543
enum zwp_linux_buffer_params_v1_flags {544
/**545
* contents are y-inverted546
*/547
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT = 1,548
/**549
* content is interlaced550
*/551
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED = 2,552
/**553
* bottom field first554
*/555
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST = 4,556
};557
#endif /* ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_ENUM */559
/**560
* @ingroup iface_zwp_linux_buffer_params_v1561
* @struct zwp_linux_buffer_params_v1_listener562
*/563
struct zwp_linux_buffer_params_v1_listener {564
/**565
* buffer creation succeeded566
*567
* This event indicates that the attempted buffer creation was568
* successful. It provides the new wl_buffer referencing the569
* dmabuf(s).570
*571
* Upon receiving this event, the client should destroy the572
* zwp_linux_buffer_params_v1 object.573
* @param buffer the newly created wl_buffer574
*/575
void (*created)(void *data,576
struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1,577
struct wl_buffer *buffer);578
/**579
* buffer creation failed580
*581
* This event indicates that the attempted buffer creation has582
* failed. It usually means that one of the dmabuf constraints has583
* not been fulfilled.584
*585
* Upon receiving this event, the client should destroy the586
* zwp_linux_buffer_params_v1 object.587
*/588
void (*failed)(void *data,589
struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1);590
};592
/**593
* @ingroup iface_zwp_linux_buffer_params_v1594
*/595
static inline int596
zwp_linux_buffer_params_v1_add_listener(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1,597
const struct zwp_linux_buffer_params_v1_listener *listener, void *data)598
{599
return wl_proxy_add_listener((struct wl_proxy *) zwp_linux_buffer_params_v1,600
(void (**)(void)) listener, data);601
}603
#define ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY 0604
#define ZWP_LINUX_BUFFER_PARAMS_V1_ADD 1605
#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE 2606
#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED 3608
/**609
* @ingroup iface_zwp_linux_buffer_params_v1610
*/611
#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATED_SINCE_VERSION 1612
/**613
* @ingroup iface_zwp_linux_buffer_params_v1614
*/615
#define ZWP_LINUX_BUFFER_PARAMS_V1_FAILED_SINCE_VERSION 1617
/**618
* @ingroup iface_zwp_linux_buffer_params_v1619
*/620
#define ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY_SINCE_VERSION 1621
/**622
* @ingroup iface_zwp_linux_buffer_params_v1623
*/624
#define ZWP_LINUX_BUFFER_PARAMS_V1_ADD_SINCE_VERSION 1625
/**626
* @ingroup iface_zwp_linux_buffer_params_v1627
*/628
#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_SINCE_VERSION 1629
/**630
* @ingroup iface_zwp_linux_buffer_params_v1631
*/632
#define ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED_SINCE_VERSION 2634
/** @ingroup iface_zwp_linux_buffer_params_v1 */635
static inline void636
zwp_linux_buffer_params_v1_set_user_data(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1, void *user_data)637
{638
wl_proxy_set_user_data((struct wl_proxy *) zwp_linux_buffer_params_v1, user_data);639
}641
/** @ingroup iface_zwp_linux_buffer_params_v1 */642
static inline void *643
zwp_linux_buffer_params_v1_get_user_data(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1)644
{645
return wl_proxy_get_user_data((struct wl_proxy *) zwp_linux_buffer_params_v1);646
}648
static inline uint32_t649
zwp_linux_buffer_params_v1_get_version(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1)650
{651
return wl_proxy_get_version((struct wl_proxy *) zwp_linux_buffer_params_v1);652
}654
/**655
* @ingroup iface_zwp_linux_buffer_params_v1656
*657
* Cleans up the temporary data sent to the server for dmabuf-based658
* wl_buffer creation.659
*/660
static inline void661
zwp_linux_buffer_params_v1_destroy(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1)662
{663
wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_buffer_params_v1,664
ZWP_LINUX_BUFFER_PARAMS_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_linux_buffer_params_v1), WL_MARSHAL_FLAG_DESTROY);665
}667
/**668
* @ingroup iface_zwp_linux_buffer_params_v1669
*670
* This request adds one dmabuf to the set in this671
* zwp_linux_buffer_params_v1.672
*673
* The 64-bit unsigned value combined from modifier_hi and modifier_lo674
* is the dmabuf layout modifier. DRM AddFB2 ioctl calls this the675
* fb modifier, which is defined in drm_mode.h of Linux UAPI.676
* This is an opaque token. Drivers use this token to express tiling,677
* compression, etc. driver-specific modifications to the base format678
* defined by the DRM fourcc code.679
*680
* Starting from version 4, the invalid_format protocol error is sent if681
* the format + modifier pair was not advertised as supported.682
*683
* Starting from version 5, the invalid_format protocol error is sent if684
* all planes don't use the same modifier.685
*686
* This request raises the PLANE_IDX error if plane_idx is too large.687
* The error PLANE_SET is raised if attempting to set a plane that688
* was already set.689
*/690
static inline void691
zwp_linux_buffer_params_v1_add(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1, int32_t fd, uint32_t plane_idx, uint32_t offset, uint32_t stride, uint32_t modifier_hi, uint32_t modifier_lo)692
{693
wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_buffer_params_v1,694
ZWP_LINUX_BUFFER_PARAMS_V1_ADD, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_linux_buffer_params_v1), 0, fd, plane_idx, offset, stride, modifier_hi, modifier_lo);695
}697
/**698
* @ingroup iface_zwp_linux_buffer_params_v1699
*700
* This asks for creation of a wl_buffer from the added dmabuf701
* buffers. The wl_buffer is not created immediately but returned via702
* the 'created' event if the dmabuf sharing succeeds. The sharing703
* may fail at runtime for reasons a client cannot predict, in704
* which case the 'failed' event is triggered.705
*706
* The 'format' argument is a DRM_FORMAT code, as defined by the707
* libdrm's drm_fourcc.h. The Linux kernel's DRM sub-system is the708
* authoritative source on how the format codes should work.709
*710
* The 'flags' is a bitfield of the flags defined in enum "flags".711
* 'y_invert' means the that the image needs to be y-flipped.712
*713
* Flag 'interlaced' means that the frame in the buffer is not714
* progressive as usual, but interlaced. An interlaced buffer as715
* supported here must always contain both top and bottom fields.716
* The top field always begins on the first pixel row. The temporal717
* ordering between the two fields is top field first, unless718
* 'bottom_first' is specified. It is undefined whether 'bottom_first'719
* is ignored if 'interlaced' is not set.720
*721
* This protocol does not convey any information about field rate,722
* duration, or timing, other than the relative ordering between the723
* two fields in one buffer. A compositor may have to estimate the724
* intended field rate from the incoming buffer rate. It is undefined725
* whether the time of receiving wl_surface.commit with a new buffer726
* attached, applying the wl_surface state, wl_surface.frame callback727
* trigger, presentation, or any other point in the compositor cycle728
* is used to measure the frame or field times. There is no support729
* for detecting missed or late frames/fields/buffers either, and730
* there is no support whatsoever for cooperating with interlaced731
* compositor output.732
*733
* The composited image quality resulting from the use of interlaced734
* buffers is explicitly undefined. A compositor may use elaborate735
* hardware features or software to deinterlace and create progressive736
* output frames from a sequence of interlaced input buffers, or it737
* may produce substandard image quality. However, compositors that738
* cannot guarantee reasonable image quality in all cases are recommended739
* to just reject all interlaced buffers.740
*741
* Any argument errors, including non-positive width or height,742
* mismatch between the number of planes and the format, bad743
* format, bad offset or stride, may be indicated by fatal protocol744
* errors: INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS,745
* OUT_OF_BOUNDS.746
*747
* Dmabuf import errors in the server that are not obvious client748
* bugs are returned via the 'failed' event as non-fatal. This749
* allows attempting dmabuf sharing and falling back in the client750
* if it fails.751
*752
* This request can be sent only once in the object's lifetime, after753
* which the only legal request is destroy. This object should be754
* destroyed after issuing a 'create' request. Attempting to use this755
* object after issuing 'create' raises ALREADY_USED protocol error.756
*757
* It is not mandatory to issue 'create'. If a client wants to758
* cancel the buffer creation, it can just destroy this object.759
*/760
static inline void761
zwp_linux_buffer_params_v1_create(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1, int32_t width, int32_t height, uint32_t format, uint32_t flags)762
{763
wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_buffer_params_v1,764
ZWP_LINUX_BUFFER_PARAMS_V1_CREATE, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_linux_buffer_params_v1), 0, width, height, format, flags);765
}767
/**768
* @ingroup iface_zwp_linux_buffer_params_v1769
*770
* This asks for immediate creation of a wl_buffer by importing the771
* added dmabufs.772
*773
* In case of import success, no event is sent from the server, and the774
* wl_buffer is ready to be used by the client.775
*776
* Upon import failure, either of the following may happen, as seen fit777
* by the implementation:778
* - the client is terminated with one of the following fatal protocol779
* errors:780
* - INCOMPLETE, INVALID_FORMAT, INVALID_DIMENSIONS, OUT_OF_BOUNDS,781
* in case of argument errors such as mismatch between the number782
* of planes and the format, bad format, non-positive width or783
* height, or bad offset or stride.784
* - INVALID_WL_BUFFER, in case the cause for failure is unknown or785
* platform specific.786
* - the server creates an invalid wl_buffer, marks it as failed and787
* sends a 'failed' event to the client. The result of using this788
* invalid wl_buffer as an argument in any request by the client is789
* defined by the compositor implementation.790
*791
* This takes the same arguments as a 'create' request, and obeys the792
* same restrictions.793
*/794
static inline struct wl_buffer *795
zwp_linux_buffer_params_v1_create_immed(struct zwp_linux_buffer_params_v1 *zwp_linux_buffer_params_v1, int32_t width, int32_t height, uint32_t format, uint32_t flags)796
{797
struct wl_proxy *buffer_id;799
buffer_id = wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_buffer_params_v1,800
ZWP_LINUX_BUFFER_PARAMS_V1_CREATE_IMMED, &wl_buffer_interface, wl_proxy_get_version((struct wl_proxy *) zwp_linux_buffer_params_v1), 0, NULL, width, height, format, flags);802
return (struct wl_buffer *) buffer_id;803
}805
#ifndef ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_ENUM806
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_ENUM807
enum zwp_linux_dmabuf_feedback_v1_tranche_flags {808
/**809
* direct scan-out tranche810
*/811
ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT = 1,812
};813
#endif /* ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_ENUM */815
/**816
* @ingroup iface_zwp_linux_dmabuf_feedback_v1817
* @struct zwp_linux_dmabuf_feedback_v1_listener818
*/819
struct zwp_linux_dmabuf_feedback_v1_listener {820
/**821
* all feedback has been sent822
*823
* This event is sent after all parameters of a824
* wp_linux_dmabuf_feedback object have been sent.825
*826
* This allows changes to the wp_linux_dmabuf_feedback parameters827
* to be seen as atomic, even if they happen via multiple events.828
*/829
void (*done)(void *data,830
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1);831
/**832
* format and modifier table833
*834
* This event provides a file descriptor which can be835
* memory-mapped to access the format and modifier table.836
*837
* The table contains a tightly packed array of consecutive format838
* + modifier pairs. Each pair is 16 bytes wide. It contains a839
* format as a 32-bit unsigned integer, followed by 4 bytes of840
* unused padding, and a modifier as a 64-bit unsigned integer. The841
* native endianness is used.842
*843
* The client must map the file descriptor in read-only private844
* mode.845
*846
* Compositors are not allowed to mutate the table file contents847
* once this event has been sent. Instead, compositors must create848
* a new, separate table file and re-send feedback parameters.849
* Compositors are allowed to store duplicate format + modifier850
* pairs in the table.851
* @param fd table file descriptor852
* @param size table size, in bytes853
*/854
void (*format_table)(void *data,855
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,856
int32_t fd,857
uint32_t size);858
/**859
* preferred main device860
*861
* This event advertises the main device that the server prefers862
* to use when direct scan-out to the target device isn't possible.863
* The advertised main device may be different for each864
* wp_linux_dmabuf_feedback object, and may change over time.865
*866
* There is exactly one main device. The compositor must send at867
* least one preference tranche with tranche_target_device equal to868
* main_device.869
*870
* Clients need to create buffers that the main device can import871
* and read from, otherwise creating the dmabuf wl_buffer will fail872
* (see the wp_linux_buffer_params.create and create_immed requests873
* for details). The main device will also likely be kept active by874
* the compositor, so clients can use it instead of waking up875
* another device for power savings.876
*877
* In general the device is a DRM node. The DRM node type (primary878
* vs. render) is unspecified. Clients must not rely on the879
* compositor sending a particular node type. Clients cannot check880
* two devices for equality by comparing the dev_t value.881
*882
* If explicit modifiers are not supported and the client performs883
* buffer allocations on a different device than the main device,884
* then the client must force the buffer to have a linear layout.885
* @param device device dev_t value886
*/887
void (*main_device)(void *data,888
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,889
struct wl_array *device);890
/**891
* a preference tranche has been sent892
*893
* This event splits tranche_target_device and tranche_formats894
* events in preference tranches. It is sent after a set of895
* tranche_target_device and tranche_formats events; it represents896
* the end of a tranche. The next tranche will have a lower897
* preference.898
*/899
void (*tranche_done)(void *data,900
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1);901
/**902
* target device903
*904
* This event advertises the target device that the server905
* prefers to use for a buffer created given this tranche. The906
* advertised target device may be different for each preference907
* tranche, and may change over time.908
*909
* There is exactly one target device per tranche.910
*911
* The target device may be a scan-out device, for example if the912
* compositor prefers to directly scan-out a buffer created given913
* this tranche. The target device may be a rendering device, for914
* example if the compositor prefers to texture from said buffer.915
*916
* The client can use this hint to allocate the buffer in a way917
* that makes it accessible from the target device, ideally918
* directly. The buffer must still be accessible from the main919
* device, either through direct import or through a potentially920
* more expensive fallback path. If the buffer can't be directly921
* imported from the main device then clients must be prepared for922
* the compositor changing the tranche priority or making wl_buffer923
* creation fail (see the wp_linux_buffer_params.create and924
* create_immed requests for details).925
*926
* If the device is a DRM node, the DRM node type (primary vs.927
* render) is unspecified. Clients must not rely on the compositor928
* sending a particular node type. Clients cannot check two devices929
* for equality by comparing the dev_t value.930
*931
* This event is tied to a preference tranche, see the tranche_done932
* event.933
* @param device device dev_t value934
*/935
void (*tranche_target_device)(void *data,936
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,937
struct wl_array *device);938
/**939
* supported buffer format modifier940
*941
* This event advertises the format + modifier combinations that942
* the compositor supports.943
*944
* It carries an array of indices, each referring to a format +945
* modifier pair in the last received format table (see the946
* format_table event). Each index is a 16-bit unsigned integer in947
* native endianness.948
*949
* For legacy support, DRM_FORMAT_MOD_INVALID is an allowed950
* modifier. It indicates that the server can support the format951
* with an implicit modifier. When a buffer has952
* DRM_FORMAT_MOD_INVALID as its modifier, it is as if no explicit953
* modifier is specified. The effective modifier will be derived954
* from the dmabuf.955
*956
* A compositor that sends valid modifiers and957
* DRM_FORMAT_MOD_INVALID for a given format supports both explicit958
* modifiers and implicit modifiers.959
*960
* Compositors must not send duplicate format + modifier pairs961
* within the same tranche or across two different tranches with962
* the same target device and flags.963
*964
* This event is tied to a preference tranche, see the tranche_done965
* event.966
*967
* For the definition of the format and modifier codes, see the968
* wp_linux_buffer_params.create request.969
* @param indices array of 16-bit indexes970
*/971
void (*tranche_formats)(void *data,972
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,973
struct wl_array *indices);974
/**975
* tranche flags976
*977
* This event sets tranche-specific flags.978
*979
* The scanout flag is a hint that direct scan-out may be attempted980
* by the compositor on the target device if the client981
* appropriately allocates a buffer. How to allocate a buffer that982
* can be scanned out on the target device is983
* implementation-defined.984
*985
* This event is tied to a preference tranche, see the tranche_done986
* event.987
* @param flags tranche flags988
*/989
void (*tranche_flags)(void *data,990
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,991
uint32_t flags);992
};994
/**995
* @ingroup iface_zwp_linux_dmabuf_feedback_v1996
*/997
static inline int998
zwp_linux_dmabuf_feedback_v1_add_listener(struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,999
const struct zwp_linux_dmabuf_feedback_v1_listener *listener, void *data)1000
{1001
return wl_proxy_add_listener((struct wl_proxy *) zwp_linux_dmabuf_feedback_v1,1002
(void (**)(void)) listener, data);1003
}1005
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_DESTROY 01007
/**1008
* @ingroup iface_zwp_linux_dmabuf_feedback_v11009
*/1010
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_DONE_SINCE_VERSION 11011
/**1012
* @ingroup iface_zwp_linux_dmabuf_feedback_v11013
*/1014
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_FORMAT_TABLE_SINCE_VERSION 11015
/**1016
* @ingroup iface_zwp_linux_dmabuf_feedback_v11017
*/1018
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_MAIN_DEVICE_SINCE_VERSION 11019
/**1020
* @ingroup iface_zwp_linux_dmabuf_feedback_v11021
*/1022
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_DONE_SINCE_VERSION 11023
/**1024
* @ingroup iface_zwp_linux_dmabuf_feedback_v11025
*/1026
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_TARGET_DEVICE_SINCE_VERSION 11027
/**1028
* @ingroup iface_zwp_linux_dmabuf_feedback_v11029
*/1030
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FORMATS_SINCE_VERSION 11031
/**1032
* @ingroup iface_zwp_linux_dmabuf_feedback_v11033
*/1034
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SINCE_VERSION 11036
/**1037
* @ingroup iface_zwp_linux_dmabuf_feedback_v11038
*/1039
#define ZWP_LINUX_DMABUF_FEEDBACK_V1_DESTROY_SINCE_VERSION 11041
/** @ingroup iface_zwp_linux_dmabuf_feedback_v1 */1042
static inline void1043
zwp_linux_dmabuf_feedback_v1_set_user_data(struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1, void *user_data)1044
{1045
wl_proxy_set_user_data((struct wl_proxy *) zwp_linux_dmabuf_feedback_v1, user_data);1046
}1048
/** @ingroup iface_zwp_linux_dmabuf_feedback_v1 */1049
static inline void *1050
zwp_linux_dmabuf_feedback_v1_get_user_data(struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)1051
{1052
return wl_proxy_get_user_data((struct wl_proxy *) zwp_linux_dmabuf_feedback_v1);1053
}1055
static inline uint32_t1056
zwp_linux_dmabuf_feedback_v1_get_version(struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)1057
{1058
return wl_proxy_get_version((struct wl_proxy *) zwp_linux_dmabuf_feedback_v1);1059
}1061
/**1062
* @ingroup iface_zwp_linux_dmabuf_feedback_v11063
*1064
* Using this request a client can tell the server that it is not going to1065
* use the wp_linux_dmabuf_feedback object anymore.1066
*/1067
static inline void1068
zwp_linux_dmabuf_feedback_v1_destroy(struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)1069
{1070
wl_proxy_marshal_flags((struct wl_proxy *) zwp_linux_dmabuf_feedback_v1,1071
ZWP_LINUX_DMABUF_FEEDBACK_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zwp_linux_dmabuf_feedback_v1), WL_MARSHAL_FLAG_DESTROY);1072
}1074
#ifdef __cplusplus1075
}1076
#endif1078
#endif