ref: 60d89ef1d9304427a1289174d9a311ab06e39b44 kmscube/drm-lease-protocol.h -rw-r--r-- 21.3 KiB View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
/* Generated by wayland-scanner 1.17.0 */

#ifndef DRM_LEASE_UNSTABLE_V1_CLIENT_PROTOCOL_H
#define DRM_LEASE_UNSTABLE_V1_CLIENT_PROTOCOL_H

#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"

#ifdef  __cplusplus
extern "C" {
#endif

/**
 * @page page_drm_lease_unstable_v1 The drm_lease_unstable_v1 protocol
 * @section page_ifaces_drm_lease_unstable_v1 Interfaces
 * - @subpage page_iface_zwp_drm_lease_manager_v1 - lease manager
 * - @subpage page_iface_zwp_drm_lease_connector_v1 - a leasable DRM connector
 * - @subpage page_iface_zwp_drm_lease_request_v1 - DRM lease request
 * - @subpage page_iface_zwp_drm_lease_v1 - a DRM lease
 * @section page_copyright_drm_lease_unstable_v1 Copyright
 * <pre>
 *
 * Copyright © 2018 NXP
 * Copyright © 2019 Status Research & Development GmbH.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 * </pre>
 */
struct zwp_drm_lease_connector_v1;
struct zwp_drm_lease_manager_v1;
struct zwp_drm_lease_request_v1;
struct zwp_drm_lease_v1;

/**
 * @page page_iface_zwp_drm_lease_manager_v1 zwp_drm_lease_manager_v1
 * @section page_iface_zwp_drm_lease_manager_v1_desc Description
 *
 * This protocol is used by Wayland compositors which act as Direct
 * Renderering Manager (DRM) masters to lease DRM resources to Wayland
 * clients. Once leased, the compositor will not use the leased resources
 * until the lease is revoked or the client closes the file descriptor.
 *
 * The lease manager is used to advertise connectors which are available for
 * leasing, and by the client to negotiate a lease request.
 *
 * Warning! The protocol described in this file is experimental and
 * backward incompatible changes may be made. Backward compatible changes
 * may be added together with the corresponding interface version bump.
 * Backward incompatible changes are done by bumping the version number in
 * the protocol and interface names and resetting the interface version.
 * Once the protocol is to be declared stable, the 'z' prefix and the
 * version number in the protocol and interface names are removed and the
 * interface version number is reset.
 * @section page_iface_zwp_drm_lease_manager_v1_api API
 * See @ref iface_zwp_drm_lease_manager_v1.
 */
/**
 * @defgroup iface_zwp_drm_lease_manager_v1 The zwp_drm_lease_manager_v1 interface
 *
 * This protocol is used by Wayland compositors which act as Direct
 * Renderering Manager (DRM) masters to lease DRM resources to Wayland
 * clients. Once leased, the compositor will not use the leased resources
 * until the lease is revoked or the client closes the file descriptor.
 *
 * The lease manager is used to advertise connectors which are available for
 * leasing, and by the client to negotiate a lease request.
 *
 * Warning! The protocol described in this file is experimental and
 * backward incompatible changes may be made. Backward compatible changes
 * may be added together with the corresponding interface version bump.
 * Backward incompatible changes are done by bumping the version number in
 * the protocol and interface names and resetting the interface version.
 * Once the protocol is to be declared stable, the 'z' prefix and the
 * version number in the protocol and interface names are removed and the
 * interface version number is reset.
 */
extern const struct wl_interface zwp_drm_lease_manager_v1_interface;
/**
 * @page page_iface_zwp_drm_lease_connector_v1 zwp_drm_lease_connector_v1
 * @section page_iface_zwp_drm_lease_connector_v1_desc Description
 *
 * Represents a DRM connector which is available for lease. These objects are
 * created via zwp_drm_lease_manager_v1.connector, and should be passed into
 * lease requests via zwp_drm_lease_request_v1.add_connector.
 * @section page_iface_zwp_drm_lease_connector_v1_api API
 * See @ref iface_zwp_drm_lease_connector_v1.
 */
/**
 * @defgroup iface_zwp_drm_lease_connector_v1 The zwp_drm_lease_connector_v1 interface
 *
 * Represents a DRM connector which is available for lease. These objects are
 * created via zwp_drm_lease_manager_v1.connector, and should be passed into
 * lease requests via zwp_drm_lease_request_v1.add_connector.
 */
extern const struct wl_interface zwp_drm_lease_connector_v1_interface;
/**
 * @page page_iface_zwp_drm_lease_request_v1 zwp_drm_lease_request_v1
 * @section page_iface_zwp_drm_lease_request_v1_desc Description
 *
 * A client that wishes to lease DRM resources will attach the list of
 * connectors advertised with zwp_drm_lease_manager_v1.connector that they
 * wish to lease, then use zwp_drm_lease_request_v1.submit to submit the
 * request.
 * @section page_iface_zwp_drm_lease_request_v1_api API
 * See @ref iface_zwp_drm_lease_request_v1.
 */
/**
 * @defgroup iface_zwp_drm_lease_request_v1 The zwp_drm_lease_request_v1 interface
 *
 * A client that wishes to lease DRM resources will attach the list of
 * connectors advertised with zwp_drm_lease_manager_v1.connector that they
 * wish to lease, then use zwp_drm_lease_request_v1.submit to submit the
 * request.
 */
extern const struct wl_interface zwp_drm_lease_request_v1_interface;
/**
 * @page page_iface_zwp_drm_lease_v1 zwp_drm_lease_v1
 * @section page_iface_zwp_drm_lease_v1_desc Description
 *
 * A DRM lease object is used to transfer the DRM file descriptor to the
 * client and manage the lifetime of the lease.
 * @section page_iface_zwp_drm_lease_v1_api API
 * See @ref iface_zwp_drm_lease_v1.
 */
/**
 * @defgroup iface_zwp_drm_lease_v1 The zwp_drm_lease_v1 interface
 *
 * A DRM lease object is used to transfer the DRM file descriptor to the
 * client and manage the lifetime of the lease.
 */
extern const struct wl_interface zwp_drm_lease_v1_interface;

/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 * @struct zwp_drm_lease_manager_v1_listener
 */
struct zwp_drm_lease_manager_v1_listener {
	/**
	 * advertise connectors available for leases
	 *
	 * The compositor may choose to advertise 0 or more connectors
	 * which may be leased to clients, and will use this event to do
	 * so. This object may be passed into a lease request to lease that
	 * connector. See zwp_drm_lease_request_v1.add_connector for
	 * details.
	 *
	 * When this global is bound, the compositor will send all
	 * connectors available for lease, but may send additional
	 * connectors at any time.
	 */
	void (*connector)(void *data,
			  struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1,
			  struct zwp_drm_lease_connector_v1 *id);
	/**
	 * the compositor has finished using the manager
	 *
	 * This event indicates that the compositor is done sending
	 * connector events. The compositor will destroy this object
	 * immediately after sending this event, and it will become
	 * invalid. The client should release any resources associated with
	 * this manager after receiving this event.
	 */
	void (*finished)(void *data,
			 struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1);
};

/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 */
static inline int
zwp_drm_lease_manager_v1_add_listener(struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1,
				      const struct zwp_drm_lease_manager_v1_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) zwp_drm_lease_manager_v1,
				     (void (**)(void)) listener, data);
}

#define ZWP_DRM_LEASE_MANAGER_V1_CREATE_LEASE_REQUEST 0
#define ZWP_DRM_LEASE_MANAGER_V1_STOP 1

/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 */
#define ZWP_DRM_LEASE_MANAGER_V1_CONNECTOR_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 */
#define ZWP_DRM_LEASE_MANAGER_V1_FINISHED_SINCE_VERSION 1

/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 */
#define ZWP_DRM_LEASE_MANAGER_V1_CREATE_LEASE_REQUEST_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 */
#define ZWP_DRM_LEASE_MANAGER_V1_STOP_SINCE_VERSION 1

/** @ingroup iface_zwp_drm_lease_manager_v1 */
static inline void
zwp_drm_lease_manager_v1_set_user_data(struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_drm_lease_manager_v1, user_data);
}

/** @ingroup iface_zwp_drm_lease_manager_v1 */
static inline void *
zwp_drm_lease_manager_v1_get_user_data(struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_drm_lease_manager_v1);
}

static inline uint32_t
zwp_drm_lease_manager_v1_get_version(struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_drm_lease_manager_v1);
}

/** @ingroup iface_zwp_drm_lease_manager_v1 */
static inline void
zwp_drm_lease_manager_v1_destroy(struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1)
{
	wl_proxy_destroy((struct wl_proxy *) zwp_drm_lease_manager_v1);
}

/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 *
 * Creates a lease request object.
 *
 * See the documentation for zwp_drm_lease_request_v1 for details.
 */
static inline struct zwp_drm_lease_request_v1 *
zwp_drm_lease_manager_v1_create_lease_request(struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1)
{
	struct wl_proxy *id;

	id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_drm_lease_manager_v1,
			 ZWP_DRM_LEASE_MANAGER_V1_CREATE_LEASE_REQUEST, &zwp_drm_lease_request_v1_interface, NULL);

	return (struct zwp_drm_lease_request_v1 *) id;
}

/**
 * @ingroup iface_zwp_drm_lease_manager_v1
 *
 * Indicates the client no longer wishes to receive connector events. The
 * compositor may still send connector events until it sends the finish
 * event, however.
 *
 * The client must not send any requests after this one.
 */
static inline void
zwp_drm_lease_manager_v1_stop(struct zwp_drm_lease_manager_v1 *zwp_drm_lease_manager_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_drm_lease_manager_v1,
			 ZWP_DRM_LEASE_MANAGER_V1_STOP);
}

/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 * @struct zwp_drm_lease_connector_v1_listener
 */
struct zwp_drm_lease_connector_v1_listener {
	/**
	 * name
	 *
	 * The compositor sends this event once the connector is created
	 * to indicate the name of this connector. This will not change for
	 * the duration of the Wayland session, but is not guaranteed to be
	 * consistent between sessions.
	 *
	 * If the compositor also supports zxdg_output_manager_v1 and this
	 * connector corresponds to a zxdg_output_v1, this name will match
	 * the name of this zxdg_output_v1 object.
	 * @param name connector name
	 */
	void (*name)(void *data,
		     struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1,
		     const char *name);
	/**
	 * description
	 *
	 * The compositor sends this event once the connector is created
	 * to provide a human-readable description for this connector,
	 * which may be presented to the user. This will not change for the
	 * duration of the Wayland session, but is not guaranteed to be
	 * consistent between sessions.
	 *
	 * If the compositor also supports zxdg_output_manager_v1 and this
	 * connector corresponds to a zxdg_output_v1, this description will
	 * match the description of this zxdg_output_v1 object.
	 * @param name connector name
	 */
	void (*description)(void *data,
			    struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1,
			    const char *name);
	/**
	 * edid
	 *
	 * The compositor sends this event once the connector is created
	 * to inform the client of this connector's EDID, to assist in
	 * selecting the correct connectors for lease. The EDID is supplied
	 * as an array of unsigned 8-bit integers.
	 * @param edid EDID for this connector
	 */
	void (*edid)(void *data,
		     struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1,
		     struct wl_array *edid);
	/**
	 * lease offer withdrawn
	 *
	 * Sent to indicate that the compositor will no longer honor
	 * requests for DRM leases which include this connector. The client
	 * may still issue a lease request including this connector, but
	 * the compositor will send zwp_drm_lease_v1.finished without
	 * issuing a lease fd.
	 */
	void (*withdrawn)(void *data,
			  struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1);
};

/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 */
static inline int
zwp_drm_lease_connector_v1_add_listener(struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1,
					const struct zwp_drm_lease_connector_v1_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) zwp_drm_lease_connector_v1,
				     (void (**)(void)) listener, data);
}

#define ZWP_DRM_LEASE_CONNECTOR_V1_DESTROY 0

/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 */
#define ZWP_DRM_LEASE_CONNECTOR_V1_NAME_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 */
#define ZWP_DRM_LEASE_CONNECTOR_V1_DESCRIPTION_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 */
#define ZWP_DRM_LEASE_CONNECTOR_V1_EDID_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 */
#define ZWP_DRM_LEASE_CONNECTOR_V1_WITHDRAWN_SINCE_VERSION 1

/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 */
#define ZWP_DRM_LEASE_CONNECTOR_V1_DESTROY_SINCE_VERSION 1

/** @ingroup iface_zwp_drm_lease_connector_v1 */
static inline void
zwp_drm_lease_connector_v1_set_user_data(struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_drm_lease_connector_v1, user_data);
}

/** @ingroup iface_zwp_drm_lease_connector_v1 */
static inline void *
zwp_drm_lease_connector_v1_get_user_data(struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_drm_lease_connector_v1);
}

static inline uint32_t
zwp_drm_lease_connector_v1_get_version(struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_drm_lease_connector_v1);
}

/**
 * @ingroup iface_zwp_drm_lease_connector_v1
 *
 * The client may send this request to indicate that it will not issue a
 * lease request for this connector. Clients are encouraged to send this
 * after receiving the "withdrawn" request so that the server can release
 * the resources associated with this connector offer.
 */
static inline void
zwp_drm_lease_connector_v1_destroy(struct zwp_drm_lease_connector_v1 *zwp_drm_lease_connector_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_drm_lease_connector_v1,
			 ZWP_DRM_LEASE_CONNECTOR_V1_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) zwp_drm_lease_connector_v1);
}

#ifndef ZWP_DRM_LEASE_REQUEST_V1_ERROR_ENUM
#define ZWP_DRM_LEASE_REQUEST_V1_ERROR_ENUM
enum zwp_drm_lease_request_v1_error {
	/**
	 * request submitted with zero connectors
	 */
	ZWP_DRM_LEASE_REQUEST_V1_ERROR_NO_CONNECTORS = 0,
	/**
	 * attempted to reuse a submitted lease
	 */
	ZWP_DRM_LEASE_REQUEST_V1_ERROR_SUBMITTED_LEASE = 1,
};
#endif /* ZWP_DRM_LEASE_REQUEST_V1_ERROR_ENUM */

#define ZWP_DRM_LEASE_REQUEST_V1_DESTROY 0
#define ZWP_DRM_LEASE_REQUEST_V1_REQUEST_CONNECTOR 1
#define ZWP_DRM_LEASE_REQUEST_V1_SUBMIT 2


/**
 * @ingroup iface_zwp_drm_lease_request_v1
 */
#define ZWP_DRM_LEASE_REQUEST_V1_DESTROY_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_request_v1
 */
#define ZWP_DRM_LEASE_REQUEST_V1_REQUEST_CONNECTOR_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_request_v1
 */
#define ZWP_DRM_LEASE_REQUEST_V1_SUBMIT_SINCE_VERSION 1

/** @ingroup iface_zwp_drm_lease_request_v1 */
static inline void
zwp_drm_lease_request_v1_set_user_data(struct zwp_drm_lease_request_v1 *zwp_drm_lease_request_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_drm_lease_request_v1, user_data);
}

/** @ingroup iface_zwp_drm_lease_request_v1 */
static inline void *
zwp_drm_lease_request_v1_get_user_data(struct zwp_drm_lease_request_v1 *zwp_drm_lease_request_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_drm_lease_request_v1);
}

static inline uint32_t
zwp_drm_lease_request_v1_get_version(struct zwp_drm_lease_request_v1 *zwp_drm_lease_request_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_drm_lease_request_v1);
}

/**
 * @ingroup iface_zwp_drm_lease_request_v1
 *
 * Indicates that the client will no longer use this lease request.
 */
static inline void
zwp_drm_lease_request_v1_destroy(struct zwp_drm_lease_request_v1 *zwp_drm_lease_request_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_drm_lease_request_v1,
			 ZWP_DRM_LEASE_REQUEST_V1_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) zwp_drm_lease_request_v1);
}

/**
 * @ingroup iface_zwp_drm_lease_request_v1
 *
 * Indicates that the client would like to lease the given connector.
 * This is only used as a suggestion, the compositor may choose to
 * include any resources in the lease it issues, or change the set of
 * leased resources at any time.
 */
static inline void
zwp_drm_lease_request_v1_request_connector(struct zwp_drm_lease_request_v1 *zwp_drm_lease_request_v1, struct zwp_drm_lease_connector_v1 *connector)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_drm_lease_request_v1,
			 ZWP_DRM_LEASE_REQUEST_V1_REQUEST_CONNECTOR, connector);
}

/**
 * @ingroup iface_zwp_drm_lease_request_v1
 *
 * Submits the lease request and creates a new zwp_drm_lease_v1 object.
 * After calling submit, issuing any other request than destroy is a
 * protocol error. Submitting a lease request with no connectors is a
 * protocol error.
 */
static inline struct zwp_drm_lease_v1 *
zwp_drm_lease_request_v1_submit(struct zwp_drm_lease_request_v1 *zwp_drm_lease_request_v1)
{
	struct wl_proxy *id;

	id = wl_proxy_marshal_constructor((struct wl_proxy *) zwp_drm_lease_request_v1,
			 ZWP_DRM_LEASE_REQUEST_V1_SUBMIT, &zwp_drm_lease_v1_interface, NULL);

	return (struct zwp_drm_lease_v1 *) id;
}

/**
 * @ingroup iface_zwp_drm_lease_v1
 * @struct zwp_drm_lease_v1_listener
 */
struct zwp_drm_lease_v1_listener {
	/**
	 * shares the DRM file descriptor
	 *
	 * This event returns a file descriptor suitable for use with
	 * DRM-related ioctls. The client should use drmModeGetLease to
	 * enumerate the DRM objects which have been leased to them, which
	 * may not be the objects they requested. The lease may have zero
	 * DRM objects.
	 *
	 * The compositor may also issue and immediately revoke the lease
	 * if no connectors are leasable, in which case this event is not
	 * sent.
	 *
	 * It is a protocol error for the compositor to send this event
	 * more than once for a given lease.
	 * @param leased_fd leased DRM file descriptor
	 */
	void (*lease_fd)(void *data,
			 struct zwp_drm_lease_v1 *zwp_drm_lease_v1,
			 int32_t leased_fd);
	/**
	 * sent when the lease has been revoked
	 *
	 * When the compositor revokes the lease, it will issue this
	 * event to notify clients of the change. If the client requires a
	 * new lease, they should destroy this object and submit a new
	 * lease request. The compositor will send no further events for
	 * this object after sending the finish event.
	 */
	void (*finished)(void *data,
			 struct zwp_drm_lease_v1 *zwp_drm_lease_v1);
};

/**
 * @ingroup iface_zwp_drm_lease_v1
 */
static inline int
zwp_drm_lease_v1_add_listener(struct zwp_drm_lease_v1 *zwp_drm_lease_v1,
			      const struct zwp_drm_lease_v1_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) zwp_drm_lease_v1,
				     (void (**)(void)) listener, data);
}

#define ZWP_DRM_LEASE_V1_DESTROY 0

/**
 * @ingroup iface_zwp_drm_lease_v1
 */
#define ZWP_DRM_LEASE_V1_LEASE_FD_SINCE_VERSION 1
/**
 * @ingroup iface_zwp_drm_lease_v1
 */
#define ZWP_DRM_LEASE_V1_FINISHED_SINCE_VERSION 1

/**
 * @ingroup iface_zwp_drm_lease_v1
 */
#define ZWP_DRM_LEASE_V1_DESTROY_SINCE_VERSION 1

/** @ingroup iface_zwp_drm_lease_v1 */
static inline void
zwp_drm_lease_v1_set_user_data(struct zwp_drm_lease_v1 *zwp_drm_lease_v1, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) zwp_drm_lease_v1, user_data);
}

/** @ingroup iface_zwp_drm_lease_v1 */
static inline void *
zwp_drm_lease_v1_get_user_data(struct zwp_drm_lease_v1 *zwp_drm_lease_v1)
{
	return wl_proxy_get_user_data((struct wl_proxy *) zwp_drm_lease_v1);
}

static inline uint32_t
zwp_drm_lease_v1_get_version(struct zwp_drm_lease_v1 *zwp_drm_lease_v1)
{
	return wl_proxy_get_version((struct wl_proxy *) zwp_drm_lease_v1);
}

/**
 * @ingroup iface_zwp_drm_lease_v1
 *
 * The client should send this to indicate that it no longer wishes to use
 * this lease. The compositor should use drmModeRevokeLease on the
 * appropriate file descriptor, if necessary, then release this object.
 */
static inline void
zwp_drm_lease_v1_destroy(struct zwp_drm_lease_v1 *zwp_drm_lease_v1)
{
	wl_proxy_marshal((struct wl_proxy *) zwp_drm_lease_v1,
			 ZWP_DRM_LEASE_V1_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) zwp_drm_lease_v1);
}

#ifdef  __cplusplus
}
#endif

#endif