1 /* Generated by wayland-scanner 1.22.0 */
2 
3 #ifndef CHROME_COLOR_MANAGEMENT_CLIENT_PROTOCOL_H
4 #define CHROME_COLOR_MANAGEMENT_CLIENT_PROTOCOL_H
5 
6 #include <stdint.h>
7 #include <stddef.h>
8 #include "wayland-client.h"
9 
10 #ifdef  __cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * @page page_chrome_color_management The chrome_color_management protocol
16  * color management protocol
17  *
18  * @section page_desc_chrome_color_management Description
19  *
20  * This protocol specifies a way for a client to set the color space and
21  * HDR metadata of a surface and to get information about the color spaces
22  * and HDR capabilities of outputs.
23  *
24  * This protocol is based on a proposed upstream protocol, which we will migrate
25  * to once it is approved. It may diverge from the proposed upstream protocol
26  * over the course of our development.
27  *
28  * @section page_ifaces_chrome_color_management Interfaces
29  * - @subpage page_iface_zcr_color_manager_v1 - color manager singleton
30  * - @subpage page_iface_zcr_color_management_output_v1 - output color properties
31  * - @subpage page_iface_zcr_color_management_surface_v1 - color management extension to a surface
32  * - @subpage page_iface_zcr_color_space_creator_v1 - color space creator
33  * - @subpage page_iface_zcr_color_space_v1 - color space
34  * @section page_copyright_chrome_color_management Copyright
35  * <pre>
36  *
37  * Copyright 2019 Sebastian Wick
38  * Copyright 2019 Erwin Burema
39  * Copyright 2020 AMD
40  * Copyright 2020 Collabora, Ltd.
41  *
42  * Permission is hereby granted, free of charge, to any person obtaining a
43  * copy of this software and associated documentation files (the "Software"),
44  * to deal in the Software without restriction, including without limitation
45  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
46  * and/or sell copies of the Software, and to permit persons to whom the
47  * Software is furnished to do so, subject to the following conditions:
48  *
49  * The above copyright notice and this permission notice (including the next
50  * paragraph) shall be included in all copies or substantial portions of the
51  * Software.
52  *
53  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
56  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
58  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
59  * DEALINGS IN THE SOFTWARE.
60  * </pre>
61  */
62 struct wl_output;
63 struct wl_surface;
64 struct zcr_color_management_output_v1;
65 struct zcr_color_management_surface_v1;
66 struct zcr_color_manager_v1;
67 struct zcr_color_space_creator_v1;
68 struct zcr_color_space_v1;
69 
70 #ifndef ZCR_COLOR_MANAGER_V1_INTERFACE
71 #define ZCR_COLOR_MANAGER_V1_INTERFACE
72 /**
73  * @page page_iface_zcr_color_manager_v1 zcr_color_manager_v1
74  * @section page_iface_zcr_color_manager_v1_desc Description
75  *
76  * A global interface used for getting color management surface and color
77  * management output objects as well as creating color space objects from
78  * ICC profiles, parameters, or enumerated names.
79  * @section page_iface_zcr_color_manager_v1_api API
80  * See @ref iface_zcr_color_manager_v1.
81  */
82 /**
83  * @defgroup iface_zcr_color_manager_v1 The zcr_color_manager_v1 interface
84  *
85  * A global interface used for getting color management surface and color
86  * management output objects as well as creating color space objects from
87  * ICC profiles, parameters, or enumerated names.
88  */
89 extern const struct wl_interface zcr_color_manager_v1_interface;
90 #endif
91 #ifndef ZCR_COLOR_MANAGEMENT_OUTPUT_V1_INTERFACE
92 #define ZCR_COLOR_MANAGEMENT_OUTPUT_V1_INTERFACE
93 /**
94  * @page page_iface_zcr_color_management_output_v1 zcr_color_management_output_v1
95  * @section page_iface_zcr_color_management_output_v1_desc Description
96  *
97  * A zcr_color_management_output_v1 describes the color properties of an
98  * output.
99  *
100  * When zcr_color_management_output_v1 object is created, it will send
101  * its initial events followed by a wl_output.done event. When creating
102  * wl_output and its extension objects, use a final wl_display.sync to
103  * guarantee that all output events have been received across all
104  * extensions.
105  *
106  * If the wl_output associated with the zcr_color_management_output_v1 is
107  * destroyed, the zcr_color_management_output_v1 object becomes inert.
108  * @section page_iface_zcr_color_management_output_v1_api API
109  * See @ref iface_zcr_color_management_output_v1.
110  */
111 /**
112  * @defgroup iface_zcr_color_management_output_v1 The zcr_color_management_output_v1 interface
113  *
114  * A zcr_color_management_output_v1 describes the color properties of an
115  * output.
116  *
117  * When zcr_color_management_output_v1 object is created, it will send
118  * its initial events followed by a wl_output.done event. When creating
119  * wl_output and its extension objects, use a final wl_display.sync to
120  * guarantee that all output events have been received across all
121  * extensions.
122  *
123  * If the wl_output associated with the zcr_color_management_output_v1 is
124  * destroyed, the zcr_color_management_output_v1 object becomes inert.
125  */
126 extern const struct wl_interface zcr_color_management_output_v1_interface;
127 #endif
128 #ifndef ZCR_COLOR_MANAGEMENT_SURFACE_V1_INTERFACE
129 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_INTERFACE
130 /**
131  * @page page_iface_zcr_color_management_surface_v1 zcr_color_management_surface_v1
132  * @section page_iface_zcr_color_management_surface_v1_desc Description
133  *
134  * A zcr_color_management_surface_v1 allows the client to set the color
135  * space and HDR properties of a surface.
136  *
137  * If the wl_surface associated with the zcr_color_management_surface_v1 is
138  * destroyed, the zcr_color_management_surface_v1 object becomes inert.
139  * @section page_iface_zcr_color_management_surface_v1_api API
140  * See @ref iface_zcr_color_management_surface_v1.
141  */
142 /**
143  * @defgroup iface_zcr_color_management_surface_v1 The zcr_color_management_surface_v1 interface
144  *
145  * A zcr_color_management_surface_v1 allows the client to set the color
146  * space and HDR properties of a surface.
147  *
148  * If the wl_surface associated with the zcr_color_management_surface_v1 is
149  * destroyed, the zcr_color_management_surface_v1 object becomes inert.
150  */
151 extern const struct wl_interface zcr_color_management_surface_v1_interface;
152 #endif
153 #ifndef ZCR_COLOR_SPACE_CREATOR_V1_INTERFACE
154 #define ZCR_COLOR_SPACE_CREATOR_V1_INTERFACE
155 /**
156  * @page page_iface_zcr_color_space_creator_v1 zcr_color_space_creator_v1
157  * @section page_iface_zcr_color_space_creator_v1_desc Description
158  *
159  * A zcr_color_space_creator_v1 object returns a created color space
160  * or the error which occured during creation.
161  *
162  * Once a zcr_color_space_creator_v1 object has delivered a 'created'
163  * or 'error' event it is automatically destroyed.
164  * @section page_iface_zcr_color_space_creator_v1_api API
165  * See @ref iface_zcr_color_space_creator_v1.
166  */
167 /**
168  * @defgroup iface_zcr_color_space_creator_v1 The zcr_color_space_creator_v1 interface
169  *
170  * A zcr_color_space_creator_v1 object returns a created color space
171  * or the error which occured during creation.
172  *
173  * Once a zcr_color_space_creator_v1 object has delivered a 'created'
174  * or 'error' event it is automatically destroyed.
175  */
176 extern const struct wl_interface zcr_color_space_creator_v1_interface;
177 #endif
178 #ifndef ZCR_COLOR_SPACE_V1_INTERFACE
179 #define ZCR_COLOR_SPACE_V1_INTERFACE
180 /**
181  * @page page_iface_zcr_color_space_v1 zcr_color_space_v1
182  * @section page_iface_zcr_color_space_v1_desc Description
183  *
184  * Refers to a color space which can be attached to a surface
185  * (zcr_color_management_surface_v1.set_color_space). It may provide
186  * information like the ICC profile and the well-known names to allow
187  * clients to know the color space and do color transformations of their
188  * own.
189  *
190  * Once created and regardless of how it was created, a zcr_color_space_v1
191  * object always refers to one fixed color space.
192  *
193  * The client can create a zcr_color_space_v1 object with
194  * zcr_color_manager_v1 requests or from an output by calling
195  * zcr_color_management_output_v1.get_color_space.
196  *
197  * Other extensions may define more zcr_color_space_v1 factory interfaces.
198  * Those interfaces must explicitly specify the interface version for the
199  * object created, otherwise versioning zcr_color_space_v1 correctly
200  * becomes impossible. Using a 'new_id' argument without 'interface'
201  * attribute defined in XML forces code generators to add two explicit
202  * arguments: interface and version. Version is the explicit version
203  * number needed, and interface should be required to be
204  * "zcr_color_space_v1". The compositor supported zcr_color_space_v1
205  * versions are defined by the advertised zcr_color_manager_v1 in
206  * wl_registry.
207  * @section page_iface_zcr_color_space_v1_api API
208  * See @ref iface_zcr_color_space_v1.
209  */
210 /**
211  * @defgroup iface_zcr_color_space_v1 The zcr_color_space_v1 interface
212  *
213  * Refers to a color space which can be attached to a surface
214  * (zcr_color_management_surface_v1.set_color_space). It may provide
215  * information like the ICC profile and the well-known names to allow
216  * clients to know the color space and do color transformations of their
217  * own.
218  *
219  * Once created and regardless of how it was created, a zcr_color_space_v1
220  * object always refers to one fixed color space.
221  *
222  * The client can create a zcr_color_space_v1 object with
223  * zcr_color_manager_v1 requests or from an output by calling
224  * zcr_color_management_output_v1.get_color_space.
225  *
226  * Other extensions may define more zcr_color_space_v1 factory interfaces.
227  * Those interfaces must explicitly specify the interface version for the
228  * object created, otherwise versioning zcr_color_space_v1 correctly
229  * becomes impossible. Using a 'new_id' argument without 'interface'
230  * attribute defined in XML forces code generators to add two explicit
231  * arguments: interface and version. Version is the explicit version
232  * number needed, and interface should be required to be
233  * "zcr_color_space_v1". The compositor supported zcr_color_space_v1
234  * versions are defined by the advertised zcr_color_manager_v1 in
235  * wl_registry.
236  */
237 extern const struct wl_interface zcr_color_space_v1_interface;
238 #endif
239 
240 #ifndef ZCR_COLOR_MANAGER_V1_EOTF_NAMES_ENUM
241 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_ENUM
242 /**
243  * @ingroup iface_zcr_color_manager_v1
244  * well-known EOTF names
245  *
246  * Names that describe a well-known EOTF.
247  *
248  * A compositor must support all of these based on the protocol interface
249  * version.
250  */
251 enum zcr_color_manager_v1_eotf_names {
252 	/**
253 	 * unknown EOTF
254 	 */
255 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_UNKNOWN = 0,
256 	/**
257 	 * Linear transfer function
258 	 */
259 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LINEAR = 1,
260 	/**
261 	 * sRGB transfer function
262 	 */
263 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB = 2,
264 	/**
265 	 * BT.2087 transfer function
266 	 */
267 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2087 = 3,
268 	/**
269 	 * AdobeRGB transfer function
270 	 */
271 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_ADOBERGB = 4,
272 	/**
273 	 * Perceptual quantizer / SMPTEST2084
274 	 */
275 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_PQ = 5,
276 	/**
277 	 * hybrid log gamma
278 	 * @since 2
279 	 */
280 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG = 6,
281 	/**
282 	 * gamma for rec709 encoded videos
283 	 * @since 2
284 	 */
285 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709 = 7,
286 	/**
287 	 * sRGB transfer function with headroom for HDR
288 	 * @since 2
289 	 */
290 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_EXTENDEDSRGB10 = 8,
291 	/**
292 	 * SMPTE240M transfer function
293 	 * @since 5
294 	 */
295 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE170M = 9,
296 	/**
297 	 * SMPTE240M transfer function
298 	 * @since 5
299 	 */
300 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE240M = 10,
301 	/**
302 	 * SMPTEST428_1 transfer function
303 	 * @since 5
304 	 */
305 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTEST428_1 = 11,
306 	/**
307 	 * LOG transfer function
308 	 * @since 5
309 	 */
310 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG = 12,
311 	/**
312 	 * LOG Sqrt transfer function
313 	 * @since 5
314 	 */
315 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SQRT = 13,
316 	/**
317 	 * IEC61966_2_4 transfer function
318 	 * @since 5
319 	 */
320 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_IEC61966_2_4 = 14,
321 	/**
322 	 * BT1361_ECG transfer function
323 	 * @since 5
324 	 */
325 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT1361_ECG = 15,
326 	/**
327 	 * BT2020_10 transfer function
328 	 * @since 5
329 	 */
330 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_10 = 16,
331 	/**
332 	 * BT2020_12 transfer function
333 	 * @since 5
334 	 */
335 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_12 = 17,
336 	/**
337 	 * SCRGB Linear transfer function
338 	 * @since 5
339 	 */
340 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SCRGB_LINEAR_80_NITS = 18,
341 	/**
342 	 * GAMMA18 transfer function
343 	 * @since 5
344 	 */
345 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA18 = 19,
346 	/**
347 	 * GAMMA28 transfer function
348 	 * @since 5
349 	 */
350 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA28 = 20,
351 	/**
352 	 * sRGB transfer function
353 	 * @since 6
354 	 */
355 	ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR = 21,
356 };
357 /**
358  * @ingroup iface_zcr_color_manager_v1
359  */
360 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG_SINCE_VERSION 2
361 /**
362  * @ingroup iface_zcr_color_manager_v1
363  */
364 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709_SINCE_VERSION 2
365 /**
366  * @ingroup iface_zcr_color_manager_v1
367  */
368 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_EXTENDEDSRGB10_SINCE_VERSION 2
369 /**
370  * @ingroup iface_zcr_color_manager_v1
371  */
372 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE170M_SINCE_VERSION 5
373 /**
374  * @ingroup iface_zcr_color_manager_v1
375  */
376 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE240M_SINCE_VERSION 5
377 /**
378  * @ingroup iface_zcr_color_manager_v1
379  */
380 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTEST428_1_SINCE_VERSION 5
381 /**
382  * @ingroup iface_zcr_color_manager_v1
383  */
384 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SINCE_VERSION 5
385 /**
386  * @ingroup iface_zcr_color_manager_v1
387  */
388 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SQRT_SINCE_VERSION 5
389 /**
390  * @ingroup iface_zcr_color_manager_v1
391  */
392 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_IEC61966_2_4_SINCE_VERSION 5
393 /**
394  * @ingroup iface_zcr_color_manager_v1
395  */
396 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT1361_ECG_SINCE_VERSION 5
397 /**
398  * @ingroup iface_zcr_color_manager_v1
399  */
400 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_10_SINCE_VERSION 5
401 /**
402  * @ingroup iface_zcr_color_manager_v1
403  */
404 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_12_SINCE_VERSION 5
405 /**
406  * @ingroup iface_zcr_color_manager_v1
407  */
408 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SCRGB_LINEAR_80_NITS_SINCE_VERSION 5
409 /**
410  * @ingroup iface_zcr_color_manager_v1
411  */
412 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA18_SINCE_VERSION 5
413 /**
414  * @ingroup iface_zcr_color_manager_v1
415  */
416 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA28_SINCE_VERSION 5
417 /**
418  * @ingroup iface_zcr_color_manager_v1
419  */
420 #define ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR_SINCE_VERSION 6
421 #endif /* ZCR_COLOR_MANAGER_V1_EOTF_NAMES_ENUM */
422 
423 #ifndef ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_ENUM
424 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_ENUM
425 /**
426  * @ingroup iface_zcr_color_manager_v1
427  * well-known chromaticity names
428  *
429  * Names that describe well-known chromaticities.
430  *
431  * A compositor must support all of these based on the protocol interface
432  * version.
433  */
434 enum zcr_color_manager_v1_chromaticity_names {
435 	/**
436 	 * unknown chromaticity
437 	 */
438 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_UNKNOWN = 0,
439 	/**
440 	 * ITU-R BT.601 http://www.itu.int/rec/R-REC-BT.601/en
441 	 */
442 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT601_525_LINE = 1,
443 	/**
444 	 * ITU-R BT.601 http://www.itu.int/rec/R-REC-BT.601/en
445 	 */
446 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT601_625_LINE = 2,
447 	/**
448 	 * SMPTE 170M-1999 https://www.itu.int/rec/R-REC-BT.1700/en
449 	 */
450 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTE170M = 3,
451 	/**
452 	 * ITU-R BT.709 https://www.itu.int/rec/R-REC-BT.709/en
453 	 */
454 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT709 = 4,
455 	/**
456 	 * ITU-R BT.2020 http://www.itu.int/rec/R-REC-BT.2020/en
457 	 */
458 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT2020 = 5,
459 	/**
460 	 * IEC/4WD 61966-2-1: sRGB https://webstore.iec.ch/publication/6169
461 	 */
462 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SRGB = 6,
463 	/**
464 	 * Display P3 https://developer.apple.com/reference/coregraphics/cgcolorspace/1408916-displayp3
465 	 */
466 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_DISPLAYP3 = 7,
467 	/**
468 	 * Adobe RGB https://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf
469 	 */
470 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_ADOBERGB = 8,
471 	/**
472 	 *
473 	 * @since 5
474 	 */
475 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_WIDE_GAMUT_COLOR_SPIN = 9,
476 	/**
477 	 *
478 	 * @since 5
479 	 */
480 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT470M = 10,
481 	/**
482 	 *
483 	 * @since 5
484 	 */
485 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTE240M = 11,
486 	/**
487 	 *
488 	 * @since 5
489 	 */
490 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_XYZ_D50 = 12,
491 	/**
492 	 *
493 	 * @since 5
494 	 */
495 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST428_1 = 13,
496 	/**
497 	 *
498 	 * @since 5
499 	 */
500 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST431_2 = 14,
501 	/**
502 	 *
503 	 * @since 5
504 	 */
505 	ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_FILM = 15,
506 };
507 /**
508  * @ingroup iface_zcr_color_manager_v1
509  */
510 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_WIDE_GAMUT_COLOR_SPIN_SINCE_VERSION 5
511 /**
512  * @ingroup iface_zcr_color_manager_v1
513  */
514 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT470M_SINCE_VERSION 5
515 /**
516  * @ingroup iface_zcr_color_manager_v1
517  */
518 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTE240M_SINCE_VERSION 5
519 /**
520  * @ingroup iface_zcr_color_manager_v1
521  */
522 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_XYZ_D50_SINCE_VERSION 5
523 /**
524  * @ingroup iface_zcr_color_manager_v1
525  */
526 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST428_1_SINCE_VERSION 5
527 /**
528  * @ingroup iface_zcr_color_manager_v1
529  */
530 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST431_2_SINCE_VERSION 5
531 /**
532  * @ingroup iface_zcr_color_manager_v1
533  */
534 #define ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_FILM_SINCE_VERSION 5
535 #endif /* ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_ENUM */
536 
537 #ifndef ZCR_COLOR_MANAGER_V1_WHITEPOINT_NAMES_ENUM
538 #define ZCR_COLOR_MANAGER_V1_WHITEPOINT_NAMES_ENUM
539 /**
540  * @ingroup iface_zcr_color_manager_v1
541  * well-known whitepoint names
542  *
543  * Names that describe well-known whitepoints.
544  *
545  * A compositor must support all of these based on the protocol interface
546  * version.
547  */
548 enum zcr_color_manager_v1_whitepoint_names {
549 	/**
550 	 * unknown whitepoint
551 	 */
552 	ZCR_COLOR_MANAGER_V1_WHITEPOINT_NAMES_UNKNOWN = 0,
553 	/**
554 	 * DCI whitepoint
555 	 */
556 	ZCR_COLOR_MANAGER_V1_WHITEPOINT_NAMES_DCI = 1,
557 	/**
558 	 * D50 whitepoint
559 	 */
560 	ZCR_COLOR_MANAGER_V1_WHITEPOINT_NAMES_D50 = 2,
561 	/**
562 	 * D65 whitepoint
563 	 */
564 	ZCR_COLOR_MANAGER_V1_WHITEPOINT_NAMES_D65 = 3,
565 };
566 #endif /* ZCR_COLOR_MANAGER_V1_WHITEPOINT_NAMES_ENUM */
567 
568 #ifndef ZCR_COLOR_MANAGER_V1_ERROR_ENUM
569 #define ZCR_COLOR_MANAGER_V1_ERROR_ENUM
570 enum zcr_color_manager_v1_error {
571 	/**
572 	 * given ICC fd has bad properties
573 	 */
574 	ZCR_COLOR_MANAGER_V1_ERROR_ICC_FD = 0,
575 	/**
576 	 * bad value given as a well-known name
577 	 */
578 	ZCR_COLOR_MANAGER_V1_ERROR_BAD_ENUM = 1,
579 	/**
580 	 * bad parameter value
581 	 */
582 	ZCR_COLOR_MANAGER_V1_ERROR_BAD_PARAM = 2,
583 };
584 #endif /* ZCR_COLOR_MANAGER_V1_ERROR_ENUM */
585 
586 #ifndef ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_ENUM
587 #define ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_ENUM
588 /**
589  * @ingroup iface_zcr_color_manager_v1
590  * For specifying color matrices
591  *
592  * Names that describe typical ColorSpace Matrix IDs
593  *
594  */
595 enum zcr_color_manager_v1_matrix_names {
596 	/**
597 	 * Unknown range
598 	 */
599 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_UNKNOWN = 0,
600 	/**
601 	 * RGB matrix
602 	 */
603 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_RGB = 1,
604 	/**
605 	 * BT709 matrix
606 	 */
607 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT709 = 2,
608 	/**
609 	 * BT2020_NCL matrix
610 	 */
611 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT2020_NCL = 3,
612 	/**
613 	 * BT2020_CL matrix
614 	 */
615 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT2020_CL = 4,
616 	/**
617 	 * FCC matrix
618 	 */
619 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_FCC = 5,
620 	/**
621 	 * SMPTE170M matrix
622 	 */
623 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_SMPTE170M = 6,
624 	/**
625 	 * SMPTE240M matrix
626 	 */
627 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_SMPTE240M = 7,
628 	/**
629 	 * YDZDX matrix
630 	 * @since 5
631 	 */
632 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YDZDX = 8,
633 	/**
634 	 * BT470BG matrix
635 	 * @since 5
636 	 */
637 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT470BG = 9,
638 	/**
639 	 * GBR matrix
640 	 * @since 5
641 	 */
642 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_GBR = 10,
643 	/**
644 	 * YCOCG matrix
645 	 * @since 5
646 	 */
647 	ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YCOCG = 11,
648 };
649 /**
650  * @ingroup iface_zcr_color_manager_v1
651  */
652 #define ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YDZDX_SINCE_VERSION 5
653 /**
654  * @ingroup iface_zcr_color_manager_v1
655  */
656 #define ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT470BG_SINCE_VERSION 5
657 /**
658  * @ingroup iface_zcr_color_manager_v1
659  */
660 #define ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_GBR_SINCE_VERSION 5
661 /**
662  * @ingroup iface_zcr_color_manager_v1
663  */
664 #define ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YCOCG_SINCE_VERSION 5
665 #endif /* ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_ENUM */
666 
667 #ifndef ZCR_COLOR_MANAGER_V1_RANGE_NAMES_ENUM
668 #define ZCR_COLOR_MANAGER_V1_RANGE_NAMES_ENUM
669 /**
670  * @ingroup iface_zcr_color_manager_v1
671  * For specifying RGB ranges
672  *
673  * Names that describe typical RGB value ranges.
674  *
675  */
676 enum zcr_color_manager_v1_range_names {
677 	/**
678 	 * Unknown range
679 	 */
680 	ZCR_COLOR_MANAGER_V1_RANGE_NAMES_UNKNOWN = 0,
681 	/**
682 	 * Limited RGB color range (values from 16-235 for 8-bit)
683 	 */
684 	ZCR_COLOR_MANAGER_V1_RANGE_NAMES_LIMITED = 1,
685 	/**
686 	 * Full RGB color range (values from 0 to 255 for 8-bit)
687 	 */
688 	ZCR_COLOR_MANAGER_V1_RANGE_NAMES_FULL = 2,
689 	/**
690 	 * Range is defined by EOTF/MatrixID
691 	 */
692 	ZCR_COLOR_MANAGER_V1_RANGE_NAMES_DERIVED = 3,
693 };
694 #endif /* ZCR_COLOR_MANAGER_V1_RANGE_NAMES_ENUM */
695 
696 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_ICC 0
697 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_NAMES 1
698 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_PARAMS 2
699 #define ZCR_COLOR_MANAGER_V1_GET_COLOR_MANAGEMENT_OUTPUT 3
700 #define ZCR_COLOR_MANAGER_V1_GET_COLOR_MANAGEMENT_SURFACE 4
701 #define ZCR_COLOR_MANAGER_V1_DESTROY 5
702 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_COMPLETE_NAMES 6
703 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_COMPLETE_PARAMS 7
704 
705 
706 /**
707  * @ingroup iface_zcr_color_manager_v1
708  */
709 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_ICC_SINCE_VERSION 1
710 /**
711  * @ingroup iface_zcr_color_manager_v1
712  */
713 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_NAMES_SINCE_VERSION 1
714 /**
715  * @ingroup iface_zcr_color_manager_v1
716  */
717 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_PARAMS_SINCE_VERSION 1
718 /**
719  * @ingroup iface_zcr_color_manager_v1
720  */
721 #define ZCR_COLOR_MANAGER_V1_GET_COLOR_MANAGEMENT_OUTPUT_SINCE_VERSION 1
722 /**
723  * @ingroup iface_zcr_color_manager_v1
724  */
725 #define ZCR_COLOR_MANAGER_V1_GET_COLOR_MANAGEMENT_SURFACE_SINCE_VERSION 1
726 /**
727  * @ingroup iface_zcr_color_manager_v1
728  */
729 #define ZCR_COLOR_MANAGER_V1_DESTROY_SINCE_VERSION 1
730 /**
731  * @ingroup iface_zcr_color_manager_v1
732  */
733 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_COMPLETE_NAMES_SINCE_VERSION 3
734 /**
735  * @ingroup iface_zcr_color_manager_v1
736  */
737 #define ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_COMPLETE_PARAMS_SINCE_VERSION 3
738 
739 /** @ingroup iface_zcr_color_manager_v1 */
740 static inline void
zcr_color_manager_v1_set_user_data(struct zcr_color_manager_v1 * zcr_color_manager_v1,void * user_data)741 zcr_color_manager_v1_set_user_data(struct zcr_color_manager_v1 *zcr_color_manager_v1, void *user_data)
742 {
743 	wl_proxy_set_user_data((struct wl_proxy *) zcr_color_manager_v1, user_data);
744 }
745 
746 /** @ingroup iface_zcr_color_manager_v1 */
747 static inline void *
zcr_color_manager_v1_get_user_data(struct zcr_color_manager_v1 * zcr_color_manager_v1)748 zcr_color_manager_v1_get_user_data(struct zcr_color_manager_v1 *zcr_color_manager_v1)
749 {
750 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_color_manager_v1);
751 }
752 
753 static inline uint32_t
zcr_color_manager_v1_get_version(struct zcr_color_manager_v1 * zcr_color_manager_v1)754 zcr_color_manager_v1_get_version(struct zcr_color_manager_v1 *zcr_color_manager_v1)
755 {
756 	return wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1);
757 }
758 
759 /**
760  * @ingroup iface_zcr_color_manager_v1
761  *
762  * Create a color space object from an ICC profile. This request returns
763  * a zcr_color_space_creator_v1 object which either returns an error
764  * or the successfully created zcr_color_space_v1 object.
765  *
766  * The description of the color space to create is sent in the form of an
767  * ICC profile as a file descriptor in the argument icc.
768  *
769  * The fd must be seekable and the maximum size of the ICC profile is 4 MB.
770  * Violating these requirements will raise an icc_fd protocol error. A
771  * compositor must not modify the contents of the file, and the fd may be
772  * sealed for writes and size changes.
773  *
774  * The file contents must represent a valid ICC profile.
775  * The ICC profile version must be 2 or 4, it must be a 3 channel profile
776  * and the class must be 'input', 'output', 'abstract' or 'display'.
777  * Violating these requirements will not result in a protocol error but
778  * raise the zcr_color_space_creator_v1.error event.
779  *
780  * See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
781  * more details about the created object.
782  *
783  * See the specification from International Color Consortium for more
784  * details about ICC profiles, also known as ISO 15076-1:2010.
785  */
786 static inline struct zcr_color_space_creator_v1 *
zcr_color_manager_v1_create_color_space_from_icc(struct zcr_color_manager_v1 * zcr_color_manager_v1,int32_t icc)787 zcr_color_manager_v1_create_color_space_from_icc(struct zcr_color_manager_v1 *zcr_color_manager_v1, int32_t icc)
788 {
789 	struct wl_proxy *id;
790 
791 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
792 			 ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_ICC, &zcr_color_space_creator_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), 0, NULL, icc);
793 
794 	return (struct zcr_color_space_creator_v1 *) id;
795 }
796 
797 /**
798  * @ingroup iface_zcr_color_manager_v1
799  *
800  * [Deprecated] Create a color space object from well-known names. This request returns
801  * a zcr_color_space_creator_v1 object which either returns an error
802  * or the successfully created zcr_color_space_v1 object.
803  *
804  * EOTF, chromaticity and whitepoint must not be unknown. Otherwise, or
805  * if a given value is not listed in the enumeration, the protocol error
806  * bad_enum is raised.
807  *
808  * See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
809  * more details about the created object. Use create_color_space_from_complete_names
810  * instead.
811  */
812 static inline struct zcr_color_space_creator_v1 *
zcr_color_manager_v1_create_color_space_from_names(struct zcr_color_manager_v1 * zcr_color_manager_v1,uint32_t eotf,uint32_t chromaticity,uint32_t whitepoint)813 zcr_color_manager_v1_create_color_space_from_names(struct zcr_color_manager_v1 *zcr_color_manager_v1, uint32_t eotf, uint32_t chromaticity, uint32_t whitepoint)
814 {
815 	struct wl_proxy *id;
816 
817 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
818 			 ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_NAMES, &zcr_color_space_creator_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), 0, NULL, eotf, chromaticity, whitepoint);
819 
820 	return (struct zcr_color_space_creator_v1 *) id;
821 }
822 
823 /**
824  * @ingroup iface_zcr_color_manager_v1
825  *
826  * [Deprecated] Create a color space object from parameters. This request returns
827  * a zcr_color_space_creator_v1 object which either returns an error
828  * or the successfully created zcr_color_space_v1 object.
829  *
830  * EOTF must not be unknown. Otherwise, or if a given EOTF is not listed
831  * in the enumeration, the protocol error bad_enum is raised.
832  *
833  * The white point must be inside the triangle created by the red, green
834  * and blue primaries. Otherwise the bad_param protocol error is raised.
835  *
836  * All the chromaticity values are multiplied by 10000 to produce the
837  * integers carried by the protocol.
838  *
839  * See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
840  * more details about the created object. Use create_color_space_from_complete_params
841  * instead.
842  */
843 static inline struct zcr_color_space_creator_v1 *
zcr_color_manager_v1_create_color_space_from_params(struct zcr_color_manager_v1 * zcr_color_manager_v1,uint32_t eotf,uint32_t primary_r_x,uint32_t primary_r_y,uint32_t primary_g_x,uint32_t primary_g_y,uint32_t primary_b_x,uint32_t primary_b_y,uint32_t white_point_x,uint32_t white_point_y)844 zcr_color_manager_v1_create_color_space_from_params(struct zcr_color_manager_v1 *zcr_color_manager_v1, uint32_t eotf, uint32_t primary_r_x, uint32_t primary_r_y, uint32_t primary_g_x, uint32_t primary_g_y, uint32_t primary_b_x, uint32_t primary_b_y, uint32_t white_point_x, uint32_t white_point_y)
845 {
846 	struct wl_proxy *id;
847 
848 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
849 			 ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_PARAMS, &zcr_color_space_creator_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), 0, NULL, eotf, primary_r_x, primary_r_y, primary_g_x, primary_g_y, primary_b_x, primary_b_y, white_point_x, white_point_y);
850 
851 	return (struct zcr_color_space_creator_v1 *) id;
852 }
853 
854 /**
855  * @ingroup iface_zcr_color_manager_v1
856  *
857  * This creates a new zcr_color_management_output_v1 object for the
858  * given wl_output.
859  *
860  * See the zcr_color_management_output_v1 interface for more details.
861  */
862 static inline struct zcr_color_management_output_v1 *
zcr_color_manager_v1_get_color_management_output(struct zcr_color_manager_v1 * zcr_color_manager_v1,struct wl_output * output)863 zcr_color_manager_v1_get_color_management_output(struct zcr_color_manager_v1 *zcr_color_manager_v1, struct wl_output *output)
864 {
865 	struct wl_proxy *id;
866 
867 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
868 			 ZCR_COLOR_MANAGER_V1_GET_COLOR_MANAGEMENT_OUTPUT, &zcr_color_management_output_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), 0, NULL, output);
869 
870 	return (struct zcr_color_management_output_v1 *) id;
871 }
872 
873 /**
874  * @ingroup iface_zcr_color_manager_v1
875  *
876  * This creates a new color zcr_color_management_surface_v1 object for the
877  * given wl_surface.
878  *
879  * See the zcr_color_management_surface_v1 interface for more details.
880  */
881 static inline struct zcr_color_management_surface_v1 *
zcr_color_manager_v1_get_color_management_surface(struct zcr_color_manager_v1 * zcr_color_manager_v1,struct wl_surface * surface)882 zcr_color_manager_v1_get_color_management_surface(struct zcr_color_manager_v1 *zcr_color_manager_v1, struct wl_surface *surface)
883 {
884 	struct wl_proxy *id;
885 
886 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
887 			 ZCR_COLOR_MANAGER_V1_GET_COLOR_MANAGEMENT_SURFACE, &zcr_color_management_surface_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), 0, NULL, surface);
888 
889 	return (struct zcr_color_management_surface_v1 *) id;
890 }
891 
892 /**
893  * @ingroup iface_zcr_color_manager_v1
894  *
895  * Destroy the zcr_color_manager_v1 object. This does not affect any other
896  * objects in any way.
897  */
898 static inline void
zcr_color_manager_v1_destroy(struct zcr_color_manager_v1 * zcr_color_manager_v1)899 zcr_color_manager_v1_destroy(struct zcr_color_manager_v1 *zcr_color_manager_v1)
900 {
901 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
902 			 ZCR_COLOR_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), WL_MARSHAL_FLAG_DESTROY);
903 }
904 
905 /**
906  * @ingroup iface_zcr_color_manager_v1
907  *
908  * Create a color space object from well-known names. This request returns
909  * a zcr_color_space_creator_v1 object which either returns an error
910  * or the successfully created zcr_color_space_v1 object.
911  *
912  * EOTF, chromaticity and whitepoint must not be unknown. Otherwise, or
913  * if a given value is not listed in the enumeration, the protocol error
914  * bad_enum is raised.
915  *
916  * This request additionally includes matrix and range information.
917  *
918  * See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
919  * more details about the created object.
920  */
921 static inline struct zcr_color_space_creator_v1 *
zcr_color_manager_v1_create_color_space_from_complete_names(struct zcr_color_manager_v1 * zcr_color_manager_v1,uint32_t eotf,uint32_t chromaticity,uint32_t whitepoint,uint32_t matrix,uint32_t range)922 zcr_color_manager_v1_create_color_space_from_complete_names(struct zcr_color_manager_v1 *zcr_color_manager_v1, uint32_t eotf, uint32_t chromaticity, uint32_t whitepoint, uint32_t matrix, uint32_t range)
923 {
924 	struct wl_proxy *id;
925 
926 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
927 			 ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_COMPLETE_NAMES, &zcr_color_space_creator_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), 0, NULL, eotf, chromaticity, whitepoint, matrix, range);
928 
929 	return (struct zcr_color_space_creator_v1 *) id;
930 }
931 
932 /**
933  * @ingroup iface_zcr_color_manager_v1
934  *
935  * Create a color space object from parameters. This request returns
936  * a zcr_color_space_creator_v1 object which either returns an error
937  * or the successfully created zcr_color_space_v1 object.
938  *
939  * EOTF must not be unknown. Otherwise, or if a given EOTF is not listed
940  * in the enumeration, the protocol error bad_enum is raised.
941  *
942  * The white point must be inside the triangle created by the red, green
943  * and blue primaries. Otherwise the bad_param protocol error is raised.
944  *
945  * All the chromaticity values are multiplied by 10000 to produce the
946  * integers carried by the protocol.
947  *
948  * This request additionally includes matrix and range information.
949  *
950  * See the zcr_color_space_v1 and zcr_color_space_creator_v1 interface for
951  * more details about the created object.
952  */
953 static inline struct zcr_color_space_creator_v1 *
zcr_color_manager_v1_create_color_space_from_complete_params(struct zcr_color_manager_v1 * zcr_color_manager_v1,uint32_t eotf,uint32_t matrix,uint32_t range,uint32_t primary_r_x,uint32_t primary_r_y,uint32_t primary_g_x,uint32_t primary_g_y,uint32_t primary_b_x,uint32_t primary_b_y,uint32_t white_point_x,uint32_t white_point_y)954 zcr_color_manager_v1_create_color_space_from_complete_params(struct zcr_color_manager_v1 *zcr_color_manager_v1, uint32_t eotf, uint32_t matrix, uint32_t range, uint32_t primary_r_x, uint32_t primary_r_y, uint32_t primary_g_x, uint32_t primary_g_y, uint32_t primary_b_x, uint32_t primary_b_y, uint32_t white_point_x, uint32_t white_point_y)
955 {
956 	struct wl_proxy *id;
957 
958 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_manager_v1,
959 			 ZCR_COLOR_MANAGER_V1_CREATE_COLOR_SPACE_FROM_COMPLETE_PARAMS, &zcr_color_space_creator_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_manager_v1), 0, NULL, eotf, matrix, range, primary_r_x, primary_r_y, primary_g_x, primary_g_y, primary_b_x, primary_b_y, white_point_x, white_point_y);
960 
961 	return (struct zcr_color_space_creator_v1 *) id;
962 }
963 
964 /**
965  * @ingroup iface_zcr_color_management_output_v1
966  * @struct zcr_color_management_output_v1_listener
967  */
968 struct zcr_color_management_output_v1_listener {
969 	/**
970 	 * color space changed
971 	 *
972 	 * The color_space_changed event is sent whenever the color space
973 	 * of the output changed, followed by one wl_output.done event
974 	 * common to output events across all extensions.
975 	 *
976 	 * This is not an initial event.
977 	 */
978 	void (*color_space_changed)(void *data,
979 				    struct zcr_color_management_output_v1 *zcr_color_management_output_v1);
980 	/**
981 	 * output extended dynamic range
982 	 *
983 	 * This is both an initial event and sent whenever the value
984 	 * changed. When the value changed, this event is followed by one
985 	 * wl_output.done event common to output events across all
986 	 * extensions.
987 	 *
988 	 * The extended dynamic range value describes how much dynamic
989 	 * range is available relative to the SDR maximum white. EDR value
990 	 * is proportional to luminance, and the luminance of black is used
991 	 * as the zero level. A value of 1.0 means that the the display can
992 	 * not display anything brighter than SDR maximum white. A value of
993 	 * 3.0 means that the SDR maximum white is at one third of the
994 	 * highest luminance the display can produce.
995 	 *
996 	 * The absolute luminance of the SDR maximum white depends on the
997 	 * monitor capabilities, the viewing conditions and the viewer
998 	 * personal preferences. A such, it cannot be given a single value
999 	 * in cd/m². Compositors using HDR video modes should allow users
1000 	 * to control the the SDR maximum white level which the output EDR
1001 	 * value is calculated from.
1002 	 *
1003 	 * The SDR maximum white is a relative reference luminance that
1004 	 * allows to tone-map content from different dynamic ranges into a
1005 	 * single common dynamic range for display.
1006 	 *
1007 	 * The EDR value is multiplied by 1000 to produce the integer value
1008 	 * carried by the protocol.
1009 	 * @param value EDR value * 1000
1010 	 */
1011 	void (*extended_dynamic_range)(void *data,
1012 				       struct zcr_color_management_output_v1 *zcr_color_management_output_v1,
1013 				       uint32_t value);
1014 };
1015 
1016 /**
1017  * @ingroup iface_zcr_color_management_output_v1
1018  */
1019 static inline int
zcr_color_management_output_v1_add_listener(struct zcr_color_management_output_v1 * zcr_color_management_output_v1,const struct zcr_color_management_output_v1_listener * listener,void * data)1020 zcr_color_management_output_v1_add_listener(struct zcr_color_management_output_v1 *zcr_color_management_output_v1,
1021 					    const struct zcr_color_management_output_v1_listener *listener, void *data)
1022 {
1023 	return wl_proxy_add_listener((struct wl_proxy *) zcr_color_management_output_v1,
1024 				     (void (**)(void)) listener, data);
1025 }
1026 
1027 #define ZCR_COLOR_MANAGEMENT_OUTPUT_V1_GET_COLOR_SPACE 0
1028 #define ZCR_COLOR_MANAGEMENT_OUTPUT_V1_DESTROY 1
1029 
1030 /**
1031  * @ingroup iface_zcr_color_management_output_v1
1032  */
1033 #define ZCR_COLOR_MANAGEMENT_OUTPUT_V1_COLOR_SPACE_CHANGED_SINCE_VERSION 1
1034 /**
1035  * @ingroup iface_zcr_color_management_output_v1
1036  */
1037 #define ZCR_COLOR_MANAGEMENT_OUTPUT_V1_EXTENDED_DYNAMIC_RANGE_SINCE_VERSION 1
1038 
1039 /**
1040  * @ingroup iface_zcr_color_management_output_v1
1041  */
1042 #define ZCR_COLOR_MANAGEMENT_OUTPUT_V1_GET_COLOR_SPACE_SINCE_VERSION 1
1043 /**
1044  * @ingroup iface_zcr_color_management_output_v1
1045  */
1046 #define ZCR_COLOR_MANAGEMENT_OUTPUT_V1_DESTROY_SINCE_VERSION 1
1047 
1048 /** @ingroup iface_zcr_color_management_output_v1 */
1049 static inline void
zcr_color_management_output_v1_set_user_data(struct zcr_color_management_output_v1 * zcr_color_management_output_v1,void * user_data)1050 zcr_color_management_output_v1_set_user_data(struct zcr_color_management_output_v1 *zcr_color_management_output_v1, void *user_data)
1051 {
1052 	wl_proxy_set_user_data((struct wl_proxy *) zcr_color_management_output_v1, user_data);
1053 }
1054 
1055 /** @ingroup iface_zcr_color_management_output_v1 */
1056 static inline void *
zcr_color_management_output_v1_get_user_data(struct zcr_color_management_output_v1 * zcr_color_management_output_v1)1057 zcr_color_management_output_v1_get_user_data(struct zcr_color_management_output_v1 *zcr_color_management_output_v1)
1058 {
1059 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_color_management_output_v1);
1060 }
1061 
1062 static inline uint32_t
zcr_color_management_output_v1_get_version(struct zcr_color_management_output_v1 * zcr_color_management_output_v1)1063 zcr_color_management_output_v1_get_version(struct zcr_color_management_output_v1 *zcr_color_management_output_v1)
1064 {
1065 	return wl_proxy_get_version((struct wl_proxy *) zcr_color_management_output_v1);
1066 }
1067 
1068 /**
1069  * @ingroup iface_zcr_color_management_output_v1
1070  *
1071  * This creates a new zcr_color_space_v1 object for the current color space
1072  * of the output. There always is exactly one color space active for an
1073  * output so the client should destroy the color space created by earlier
1074  * invocations of this request. This request is usually sent as a reaction
1075  * to the color_space_changed event or when creating a
1076  * zcr_color_management_output_v1 object.
1077  *
1078  * The created zcr_color_space_v1 object preserves the color space
1079  * of the output from the time the object was created.
1080  *
1081  * The resulting color space object allows get_information request.
1082  *
1083  * See the zcr_color_space_v1 interface for more details.
1084  */
1085 static inline struct zcr_color_space_v1 *
zcr_color_management_output_v1_get_color_space(struct zcr_color_management_output_v1 * zcr_color_management_output_v1)1086 zcr_color_management_output_v1_get_color_space(struct zcr_color_management_output_v1 *zcr_color_management_output_v1)
1087 {
1088 	struct wl_proxy *id;
1089 
1090 	id = wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_management_output_v1,
1091 			 ZCR_COLOR_MANAGEMENT_OUTPUT_V1_GET_COLOR_SPACE, &zcr_color_space_v1_interface, wl_proxy_get_version((struct wl_proxy *) zcr_color_management_output_v1), 0, NULL);
1092 
1093 	return (struct zcr_color_space_v1 *) id;
1094 }
1095 
1096 /**
1097  * @ingroup iface_zcr_color_management_output_v1
1098  *
1099  * Destroy the color zcr_color_management_output_v1 object. This does not
1100  * affect any remaining protocol objects.
1101  */
1102 static inline void
zcr_color_management_output_v1_destroy(struct zcr_color_management_output_v1 * zcr_color_management_output_v1)1103 zcr_color_management_output_v1_destroy(struct zcr_color_management_output_v1 *zcr_color_management_output_v1)
1104 {
1105 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_management_output_v1,
1106 			 ZCR_COLOR_MANAGEMENT_OUTPUT_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_management_output_v1), WL_MARSHAL_FLAG_DESTROY);
1107 }
1108 
1109 #ifndef ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_ENUM
1110 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_ENUM
1111 /**
1112  * @ingroup iface_zcr_color_management_surface_v1
1113  * render intent
1114  *
1115  *
1116  * Rendering intent allow the client to hint at how to perform color space
1117  * transformations.
1118  *
1119  * See the ICC specification for more details about rendering intent.
1120  */
1121 enum zcr_color_management_surface_v1_render_intent {
1122 	/**
1123 	 * perceptual
1124 	 */
1125 	ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_PERCEPTUAL = 0,
1126 	/**
1127 	 * media-relative colorimetric
1128 	 */
1129 	ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_RELATIVE = 1,
1130 	/**
1131 	 * saturation
1132 	 */
1133 	ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_SATURATION = 2,
1134 	/**
1135 	 * ICC-absolute colorimetric
1136 	 */
1137 	ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_ABSOLUTE = 3,
1138 	/**
1139 	 * media-relative colorimetric + black point compensation
1140 	 */
1141 	ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_RELATIVE_BPC = 4,
1142 };
1143 #endif /* ZCR_COLOR_MANAGEMENT_SURFACE_V1_RENDER_INTENT_ENUM */
1144 
1145 #ifndef ZCR_COLOR_MANAGEMENT_SURFACE_V1_ALPHA_MODE_ENUM
1146 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_ALPHA_MODE_ENUM
1147 /**
1148  * @ingroup iface_zcr_color_management_surface_v1
1149  * alpha mode
1150  *
1151  * Specifies whether alpha is pre-multiplied into color channels or not.
1152  * If pre-multiplied, the linear alpha value is already multiplied with the
1153  * (non-linear) color channel code values in the color channels.
1154  */
1155 enum zcr_color_management_surface_v1_alpha_mode {
1156 	/**
1157 	 * alpha is independent from color channels
1158 	 */
1159 	ZCR_COLOR_MANAGEMENT_SURFACE_V1_ALPHA_MODE_STRAIGHT = 0,
1160 	/**
1161 	 * alpha is pre-multiplied into color channels
1162 	 */
1163 	ZCR_COLOR_MANAGEMENT_SURFACE_V1_ALPHA_MODE_PREMULTIPLIED = 1,
1164 };
1165 #endif /* ZCR_COLOR_MANAGEMENT_SURFACE_V1_ALPHA_MODE_ENUM */
1166 
1167 /**
1168  * @ingroup iface_zcr_color_management_surface_v1
1169  * @struct zcr_color_management_surface_v1_listener
1170  */
1171 struct zcr_color_management_surface_v1_listener {
1172 	/**
1173 	 * output for color optimization
1174 	 *
1175 	 * The preferred_color_space event is sent when the compositor
1176 	 * determines or switches the output that implies the preferred
1177 	 * color space. The preferred color space is the one which likely
1178 	 * has the most performance and quality benefits if used by a
1179 	 * client for its surface contents.
1180 	 *
1181 	 * The event does not carry a zcr_color_space_v1 but a wl_output
1182 	 * object. The concrete zcr_color_space_v1 can be created by
1183 	 * calling zcr_color_management_output_v1.get_color_space on the
1184 	 * output and listening to
1185 	 * zcr_color_management_output_v1.color_space_changed events.
1186 	 *
1187 	 * As clients may bind to the same global wl_output multiple times,
1188 	 * this event is sent for each bound instance that matches the
1189 	 * preferred color space output. If a client has not bound to the
1190 	 * right wl_output global at all, this event is not sent.
1191 	 *
1192 	 * This is only a hint and clients can set any valid color space
1193 	 * with set_color_space but there might be performance and color
1194 	 * accuracy improvements by providing the surface in the preferred
1195 	 * color space.
1196 	 */
1197 	void (*preferred_color_space)(void *data,
1198 				      struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1,
1199 				      struct wl_output *output);
1200 };
1201 
1202 /**
1203  * @ingroup iface_zcr_color_management_surface_v1
1204  */
1205 static inline int
zcr_color_management_surface_v1_add_listener(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1,const struct zcr_color_management_surface_v1_listener * listener,void * data)1206 zcr_color_management_surface_v1_add_listener(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1,
1207 					     const struct zcr_color_management_surface_v1_listener *listener, void *data)
1208 {
1209 	return wl_proxy_add_listener((struct wl_proxy *) zcr_color_management_surface_v1,
1210 				     (void (**)(void)) listener, data);
1211 }
1212 
1213 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_ALPHA_MODE 0
1214 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_EXTENDED_DYNAMIC_RANGE 1
1215 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_COLOR_SPACE 2
1216 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_DEFAULT_COLOR_SPACE 3
1217 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_DESTROY 4
1218 
1219 /**
1220  * @ingroup iface_zcr_color_management_surface_v1
1221  */
1222 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_PREFERRED_COLOR_SPACE_SINCE_VERSION 1
1223 
1224 /**
1225  * @ingroup iface_zcr_color_management_surface_v1
1226  */
1227 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_ALPHA_MODE_SINCE_VERSION 1
1228 /**
1229  * @ingroup iface_zcr_color_management_surface_v1
1230  */
1231 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_EXTENDED_DYNAMIC_RANGE_SINCE_VERSION 1
1232 /**
1233  * @ingroup iface_zcr_color_management_surface_v1
1234  */
1235 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_COLOR_SPACE_SINCE_VERSION 1
1236 /**
1237  * @ingroup iface_zcr_color_management_surface_v1
1238  */
1239 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_DEFAULT_COLOR_SPACE_SINCE_VERSION 1
1240 /**
1241  * @ingroup iface_zcr_color_management_surface_v1
1242  */
1243 #define ZCR_COLOR_MANAGEMENT_SURFACE_V1_DESTROY_SINCE_VERSION 1
1244 
1245 /** @ingroup iface_zcr_color_management_surface_v1 */
1246 static inline void
zcr_color_management_surface_v1_set_user_data(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1,void * user_data)1247 zcr_color_management_surface_v1_set_user_data(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1, void *user_data)
1248 {
1249 	wl_proxy_set_user_data((struct wl_proxy *) zcr_color_management_surface_v1, user_data);
1250 }
1251 
1252 /** @ingroup iface_zcr_color_management_surface_v1 */
1253 static inline void *
zcr_color_management_surface_v1_get_user_data(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1)1254 zcr_color_management_surface_v1_get_user_data(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1)
1255 {
1256 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_color_management_surface_v1);
1257 }
1258 
1259 static inline uint32_t
zcr_color_management_surface_v1_get_version(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1)1260 zcr_color_management_surface_v1_get_version(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1)
1261 {
1262 	return wl_proxy_get_version((struct wl_proxy *) zcr_color_management_surface_v1);
1263 }
1264 
1265 /**
1266  * @ingroup iface_zcr_color_management_surface_v1
1267  *
1268  * Assuming an alpha channel exists, it is always linear. The alpha mode
1269  * determines whether the color channels include alpha pre-multiplied or
1270  * not. Using straight alpha might have performance benefits.
1271  *
1272  * Alpha mode is double buffered, and will be applied at the time
1273  * wl_surface.commit of the corresponding wl_surface is called.
1274  *
1275  * By default, a surface is assumed to have pre-multiplied alpha.
1276  */
1277 static inline void
zcr_color_management_surface_v1_set_alpha_mode(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1,uint32_t alpha_mode)1278 zcr_color_management_surface_v1_set_alpha_mode(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1, uint32_t alpha_mode)
1279 {
1280 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_management_surface_v1,
1281 			 ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_ALPHA_MODE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_management_surface_v1), 0, alpha_mode);
1282 }
1283 
1284 /**
1285  * @ingroup iface_zcr_color_management_surface_v1
1286  *
1287  * Set the extended dynamic range (EDR) value for the underlying surface.
1288  * The EDR value is double buffered, and will be applied at the time
1289  * wl_surface.commit of the corresponding wl_surface is called.
1290  *
1291  * The EDR value describes how much dynamic range is encoded relative to
1292  * the SDR maximum white. EDR value is proportional to luminance, using
1293  * the luminance of black as the zero level. A value of 1.0 means that the
1294  * SDR maximum white is the highest possible luminance of the surface. A
1295  * value of 3.0 means that the SDR maximum white is one third of the
1296  * highest possible luminance of the surface.
1297  *
1298  * The color space attached to the surface can make the code values in the
1299  * buffer non-linear in regards to the luminance. The code value to produce
1300  * a third of the luminance of the biggest code value therefore might not
1301  * be one third of the biggest code value.
1302  *
1303  * For the definition of the SDR maximum white on an output, see
1304  * zcr_color_management_output_v1.extended_dynamic_range. Content
1305  * producers are free to choose their SDR maximum white level. How it
1306  * shall be displayed depends on the monitor capabilities and the output
1307  * EDR value.
1308  *
1309  * By default the EDR value is 1.0. The compositor will tone map the image
1310  * to match the EDR of each output the surface is shown on. The aim for
1311  * the EDR-EDR mapping is to produce a relative luminance mapping that
1312  * looks equally good regardless of the viewing conditions and the monitor
1313  * capabilities, assuming the output EDR value was tuned to the output
1314  * capabilities and the viewing environment. There might be performance
1315  * and image quality benefits from providing content readily tone mapped to
1316  * the EDR value of the output the surface is shown on.
1317  *
1318  * The EDR value is multiplied by 1000 to produce the integer value
1319  * carried by the protocol.
1320  */
1321 static inline void
zcr_color_management_surface_v1_set_extended_dynamic_range(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1,uint32_t value)1322 zcr_color_management_surface_v1_set_extended_dynamic_range(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1, uint32_t value)
1323 {
1324 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_management_surface_v1,
1325 			 ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_EXTENDED_DYNAMIC_RANGE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_management_surface_v1), 0, value);
1326 }
1327 
1328 /**
1329  * @ingroup iface_zcr_color_management_surface_v1
1330  *
1331  * Set the color space of the underlying surface. The color space and
1332  * render intent are double buffered, and will be applied
1333  * at the time wl_surface.commit of the corresponding wl_surface is called.
1334  *
1335  *
1336  * The render intent gives the compositor a hint what to optimize for in
1337  * color space transformations.
1338  *
1339  * By default, a surface is assumed to have the sRGB color space and an
1340  * arbitrary render intent.
1341  *
1342  * If the color space of the surface matches the color space of an output
1343  * it is shown on the performance and color accuracy might improve. To find
1344  * those color spaces the client can listen to the preferred_color_space or
1345  * the wl_surface.enter/leave events. This improvement may require using
1346  * the color space object created by
1347  * zcr_color_management_output_v1.get_color_space.
1348  */
1349 static inline void
zcr_color_management_surface_v1_set_color_space(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1,struct zcr_color_space_v1 * color_space,uint32_t render_intent)1350 zcr_color_management_surface_v1_set_color_space(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1, struct zcr_color_space_v1 *color_space, uint32_t render_intent)
1351 {
1352 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_management_surface_v1,
1353 			 ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_COLOR_SPACE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_management_surface_v1), 0, color_space, render_intent);
1354 }
1355 
1356 /**
1357  * @ingroup iface_zcr_color_management_surface_v1
1358  *
1359  * This request sets the surface color space to the defaults, see
1360  * set_color_space. The setting will be applied at the time
1361  * wl_surface.commit of the corresponding wl_surface is called.
1362  */
1363 static inline void
zcr_color_management_surface_v1_set_default_color_space(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1)1364 zcr_color_management_surface_v1_set_default_color_space(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1)
1365 {
1366 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_management_surface_v1,
1367 			 ZCR_COLOR_MANAGEMENT_SURFACE_V1_SET_DEFAULT_COLOR_SPACE, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_management_surface_v1), 0);
1368 }
1369 
1370 /**
1371  * @ingroup iface_zcr_color_management_surface_v1
1372  *
1373  * Destroy the zcr_color_management_surface_v1 object.
1374  *
1375  * When the last zcr_color_management_surface_v1 object for a wl_surface
1376  * is destroyed, the destruction will pend unsetting the wl_surface's
1377  * color space, render intent and alpha mode similar to set_color_space
1378  * will pend a set.
1379  */
1380 static inline void
zcr_color_management_surface_v1_destroy(struct zcr_color_management_surface_v1 * zcr_color_management_surface_v1)1381 zcr_color_management_surface_v1_destroy(struct zcr_color_management_surface_v1 *zcr_color_management_surface_v1)
1382 {
1383 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_management_surface_v1,
1384 			 ZCR_COLOR_MANAGEMENT_SURFACE_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_management_surface_v1), WL_MARSHAL_FLAG_DESTROY);
1385 }
1386 
1387 #ifndef ZCR_COLOR_SPACE_CREATOR_V1_CREATION_ERROR_ENUM
1388 #define ZCR_COLOR_SPACE_CREATOR_V1_CREATION_ERROR_ENUM
1389 /**
1390  * @ingroup iface_zcr_color_space_creator_v1
1391  * color space creation error
1392  *
1393  * Bitmask of errors which occured while trying to create a color space
1394  */
1395 enum zcr_color_space_creator_v1_creation_error {
1396 	/**
1397 	 * malformed ICC profile
1398 	 */
1399 	ZCR_COLOR_SPACE_CREATOR_V1_CREATION_ERROR_MALFORMED_ICC = 0x1,
1400 	/**
1401 	 * ICC profile does not meet requirements
1402 	 */
1403 	ZCR_COLOR_SPACE_CREATOR_V1_CREATION_ERROR_BAD_ICC = 0x2,
1404 	/**
1405 	 * bad primaries
1406 	 */
1407 	ZCR_COLOR_SPACE_CREATOR_V1_CREATION_ERROR_BAD_PRIMARIES = 0x4,
1408 	/**
1409 	 * bad whitepoint
1410 	 */
1411 	ZCR_COLOR_SPACE_CREATOR_V1_CREATION_ERROR_BAD_WHITEPOINT = 0x8,
1412 };
1413 #endif /* ZCR_COLOR_SPACE_CREATOR_V1_CREATION_ERROR_ENUM */
1414 
1415 /**
1416  * @ingroup iface_zcr_color_space_creator_v1
1417  * @struct zcr_color_space_creator_v1_listener
1418  */
1419 struct zcr_color_space_creator_v1_listener {
1420 	/**
1421 	 * color space object created
1422 	 *
1423 	 * Delivers the successfully created color space.
1424 	 *
1425 	 * The resulting color space object does not allow get_information
1426 	 * request.
1427 	 */
1428 	void (*created)(void *data,
1429 			struct zcr_color_space_creator_v1 *zcr_color_space_creator_v1,
1430 			struct zcr_color_space_v1 *id);
1431 	/**
1432 	 * color space creation failed
1433 	 *
1434 	 * This event is sent if the color space creation failed.
1435 	 * @param error error bitmask
1436 	 */
1437 	void (*error)(void *data,
1438 		      struct zcr_color_space_creator_v1 *zcr_color_space_creator_v1,
1439 		      uint32_t error);
1440 };
1441 
1442 /**
1443  * @ingroup iface_zcr_color_space_creator_v1
1444  */
1445 static inline int
zcr_color_space_creator_v1_add_listener(struct zcr_color_space_creator_v1 * zcr_color_space_creator_v1,const struct zcr_color_space_creator_v1_listener * listener,void * data)1446 zcr_color_space_creator_v1_add_listener(struct zcr_color_space_creator_v1 *zcr_color_space_creator_v1,
1447 					const struct zcr_color_space_creator_v1_listener *listener, void *data)
1448 {
1449 	return wl_proxy_add_listener((struct wl_proxy *) zcr_color_space_creator_v1,
1450 				     (void (**)(void)) listener, data);
1451 }
1452 
1453 /**
1454  * @ingroup iface_zcr_color_space_creator_v1
1455  */
1456 #define ZCR_COLOR_SPACE_CREATOR_V1_CREATED_SINCE_VERSION 1
1457 /**
1458  * @ingroup iface_zcr_color_space_creator_v1
1459  */
1460 #define ZCR_COLOR_SPACE_CREATOR_V1_ERROR_SINCE_VERSION 1
1461 
1462 
1463 /** @ingroup iface_zcr_color_space_creator_v1 */
1464 static inline void
zcr_color_space_creator_v1_set_user_data(struct zcr_color_space_creator_v1 * zcr_color_space_creator_v1,void * user_data)1465 zcr_color_space_creator_v1_set_user_data(struct zcr_color_space_creator_v1 *zcr_color_space_creator_v1, void *user_data)
1466 {
1467 	wl_proxy_set_user_data((struct wl_proxy *) zcr_color_space_creator_v1, user_data);
1468 }
1469 
1470 /** @ingroup iface_zcr_color_space_creator_v1 */
1471 static inline void *
zcr_color_space_creator_v1_get_user_data(struct zcr_color_space_creator_v1 * zcr_color_space_creator_v1)1472 zcr_color_space_creator_v1_get_user_data(struct zcr_color_space_creator_v1 *zcr_color_space_creator_v1)
1473 {
1474 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_color_space_creator_v1);
1475 }
1476 
1477 static inline uint32_t
zcr_color_space_creator_v1_get_version(struct zcr_color_space_creator_v1 * zcr_color_space_creator_v1)1478 zcr_color_space_creator_v1_get_version(struct zcr_color_space_creator_v1 *zcr_color_space_creator_v1)
1479 {
1480 	return wl_proxy_get_version((struct wl_proxy *) zcr_color_space_creator_v1);
1481 }
1482 
1483 /** @ingroup iface_zcr_color_space_creator_v1 */
1484 static inline void
zcr_color_space_creator_v1_destroy(struct zcr_color_space_creator_v1 * zcr_color_space_creator_v1)1485 zcr_color_space_creator_v1_destroy(struct zcr_color_space_creator_v1 *zcr_color_space_creator_v1)
1486 {
1487 	wl_proxy_destroy((struct wl_proxy *) zcr_color_space_creator_v1);
1488 }
1489 
1490 #ifndef ZCR_COLOR_SPACE_V1_ERROR_ENUM
1491 #define ZCR_COLOR_SPACE_V1_ERROR_ENUM
1492 enum zcr_color_space_v1_error {
1493 	/**
1494 	 * get_information disallowed
1495 	 */
1496 	ZCR_COLOR_SPACE_V1_ERROR_NO_INFORMATION = 0,
1497 };
1498 #endif /* ZCR_COLOR_SPACE_V1_ERROR_ENUM */
1499 
1500 /**
1501  * @ingroup iface_zcr_color_space_v1
1502  * @struct zcr_color_space_v1_listener
1503  */
1504 struct zcr_color_space_v1_listener {
1505 	/**
1506 	 * ICC profile describing the color space
1507 	 *
1508 	 * This event may be sent only as a response to
1509 	 * zcr_color_space_v1.get_information.
1510 	 *
1511 	 * The icc argument provides a file descriptor to the client which
1512 	 * can be memory-mapped to provide the ICC profile describing the
1513 	 * color space. The fd must be mapped with MAP_PRIVATE and
1514 	 * read-only by the client.
1515 	 *
1516 	 * Compositors should send this event always when information is
1517 	 * requested. ICC profiles provide the common foundation which all
1518 	 * color managed clients may rely on.
1519 	 * @param icc ICC profile file descriptor
1520 	 * @param icc_size ICC profile size, in bytes
1521 	 */
1522 	void (*icc_file)(void *data,
1523 			 struct zcr_color_space_v1 *zcr_color_space_v1,
1524 			 int32_t icc,
1525 			 uint32_t icc_size);
1526 	/**
1527 	 * well-known names of a color space
1528 	 *
1529 	 * [Deprecated] This event may be sent only as a response to
1530 	 * zcr_color_space_v1.get_information.
1531 	 *
1532 	 * EOTF, chromaticity and whitepoint contain well-known names of
1533 	 * those properties if available and unknown otherwise.
1534 	 *
1535 	 * Compositors should not assume that all clients can understand
1536 	 * these names. The names are provided for client convenience. If a
1537 	 * client understands the name triplet, it may ignore other
1538 	 * information about the color space, the ICC profile for example.
1539 	 * Use complete_names instead.
1540 	 * @param eotf EOTF
1541 	 * @param chromaticity chromaticity
1542 	 * @param whitepoint whitepoint
1543 	 */
1544 	void (*names)(void *data,
1545 		      struct zcr_color_space_v1 *zcr_color_space_v1,
1546 		      uint32_t eotf,
1547 		      uint32_t chromaticity,
1548 		      uint32_t whitepoint);
1549 	/**
1550 	 * RGB primaries along with whitepoint defining color space
1551 	 *
1552 	 * [Deprecated] This event may be sent only as a response to
1553 	 * zcr_color_space_v1.get_information.
1554 	 *
1555 	 * The RGB primary value arguments along with the whitepoint value
1556 	 * arguments and eotf can be used to define an arbitrary or custom
1557 	 * color space.
1558 	 *
1559 	 * The eotf enum contains well known names of that property, but
1560 	 * the compositor should not assume that all clients will
1561 	 * understand those names. Use complete_params instead.
1562 	 * @param eotf EOTF
1563 	 * @param primary_r_x red primary X * 10000
1564 	 * @param primary_r_y red primary Y * 10000
1565 	 * @param primary_g_x green primary X * 10000
1566 	 * @param primary_g_y green primary Y * 10000
1567 	 * @param primary_b_x blue primary X * 10000
1568 	 * @param primary_b_y blue primary Y * 10000
1569 	 * @param white_point_x white point X * 10000
1570 	 * @param white_point_y white point Y * 10000
1571 	 */
1572 	void (*params)(void *data,
1573 		       struct zcr_color_space_v1 *zcr_color_space_v1,
1574 		       uint32_t eotf,
1575 		       uint32_t primary_r_x,
1576 		       uint32_t primary_r_y,
1577 		       uint32_t primary_g_x,
1578 		       uint32_t primary_g_y,
1579 		       uint32_t primary_b_x,
1580 		       uint32_t primary_b_y,
1581 		       uint32_t white_point_x,
1582 		       uint32_t white_point_y);
1583 	/**
1584 	 * end of color space information
1585 	 *
1586 	 * This event may be sent only as a response to
1587 	 * zcr_color_space_v1.get_information.
1588 	 *
1589 	 * This signifies that all color space information events have been
1590 	 * delivered for the object.
1591 	 */
1592 	void (*done)(void *data,
1593 		     struct zcr_color_space_v1 *zcr_color_space_v1);
1594 	/**
1595 	 * well-known names of a color space
1596 	 *
1597 	 * This event may be sent only as a response to
1598 	 * zcr_color_space_v1.get_information.
1599 	 *
1600 	 * EOTF, chromaticity, matrix, range and whitepoint contain
1601 	 * well-known names of those properties if available and unknown
1602 	 * otherwise.
1603 	 *
1604 	 * Compositors should not assume that all clients can understand
1605 	 * these names. The names are provided for client convenience. If a
1606 	 * client understands the name triplet, it may ignore other
1607 	 * information about the color space, the ICC profile for example.
1608 	 * @param eotf EOTF
1609 	 * @param chromaticity chromaticity
1610 	 * @param whitepoint whitepoint
1611 	 * @param matrix Color matrix
1612 	 * @param range Color range
1613 	 * @since 3
1614 	 */
1615 	void (*complete_names)(void *data,
1616 			       struct zcr_color_space_v1 *zcr_color_space_v1,
1617 			       uint32_t eotf,
1618 			       uint32_t chromaticity,
1619 			       uint32_t whitepoint,
1620 			       uint32_t matrix,
1621 			       uint32_t range);
1622 	/**
1623 	 * RGB primaries along with whitepoint defining color space
1624 	 *
1625 	 * This event may be sent only as a response to
1626 	 * zcr_color_space_v1.get_information.
1627 	 *
1628 	 * The RGB primary value arguments along with the whitepoint value
1629 	 * arguments and eotf can be used to define an arbitrary or custom
1630 	 * color space.
1631 	 *
1632 	 * The eotf enum contains well known names of that property, but
1633 	 * the compositor should not assume that all clients will
1634 	 * understand those names.
1635 	 * @param eotf EOTF
1636 	 * @param matrix Color matrix
1637 	 * @param range Color range
1638 	 * @param primary_r_x red primary X * 10000
1639 	 * @param primary_r_y red primary Y * 10000
1640 	 * @param primary_g_x green primary X * 10000
1641 	 * @param primary_g_y green primary Y * 10000
1642 	 * @param primary_b_x blue primary X * 10000
1643 	 * @param primary_b_y blue primary Y * 10000
1644 	 * @param white_point_x white point X * 10000
1645 	 * @param white_point_y white point Y * 10000
1646 	 * @since 3
1647 	 */
1648 	void (*complete_params)(void *data,
1649 				struct zcr_color_space_v1 *zcr_color_space_v1,
1650 				uint32_t eotf,
1651 				uint32_t matrix,
1652 				uint32_t range,
1653 				uint32_t primary_r_x,
1654 				uint32_t primary_r_y,
1655 				uint32_t primary_g_x,
1656 				uint32_t primary_g_y,
1657 				uint32_t primary_b_x,
1658 				uint32_t primary_b_y,
1659 				uint32_t white_point_x,
1660 				uint32_t white_point_y);
1661 };
1662 
1663 /**
1664  * @ingroup iface_zcr_color_space_v1
1665  */
1666 static inline int
zcr_color_space_v1_add_listener(struct zcr_color_space_v1 * zcr_color_space_v1,const struct zcr_color_space_v1_listener * listener,void * data)1667 zcr_color_space_v1_add_listener(struct zcr_color_space_v1 *zcr_color_space_v1,
1668 				const struct zcr_color_space_v1_listener *listener, void *data)
1669 {
1670 	return wl_proxy_add_listener((struct wl_proxy *) zcr_color_space_v1,
1671 				     (void (**)(void)) listener, data);
1672 }
1673 
1674 #define ZCR_COLOR_SPACE_V1_GET_INFORMATION 0
1675 #define ZCR_COLOR_SPACE_V1_DESTROY 1
1676 
1677 /**
1678  * @ingroup iface_zcr_color_space_v1
1679  */
1680 #define ZCR_COLOR_SPACE_V1_ICC_FILE_SINCE_VERSION 1
1681 /**
1682  * @ingroup iface_zcr_color_space_v1
1683  */
1684 #define ZCR_COLOR_SPACE_V1_NAMES_SINCE_VERSION 1
1685 /**
1686  * @ingroup iface_zcr_color_space_v1
1687  */
1688 #define ZCR_COLOR_SPACE_V1_PARAMS_SINCE_VERSION 1
1689 /**
1690  * @ingroup iface_zcr_color_space_v1
1691  */
1692 #define ZCR_COLOR_SPACE_V1_DONE_SINCE_VERSION 1
1693 /**
1694  * @ingroup iface_zcr_color_space_v1
1695  */
1696 #define ZCR_COLOR_SPACE_V1_COMPLETE_NAMES_SINCE_VERSION 3
1697 /**
1698  * @ingroup iface_zcr_color_space_v1
1699  */
1700 #define ZCR_COLOR_SPACE_V1_COMPLETE_PARAMS_SINCE_VERSION 3
1701 
1702 /**
1703  * @ingroup iface_zcr_color_space_v1
1704  */
1705 #define ZCR_COLOR_SPACE_V1_GET_INFORMATION_SINCE_VERSION 1
1706 /**
1707  * @ingroup iface_zcr_color_space_v1
1708  */
1709 #define ZCR_COLOR_SPACE_V1_DESTROY_SINCE_VERSION 1
1710 
1711 /** @ingroup iface_zcr_color_space_v1 */
1712 static inline void
zcr_color_space_v1_set_user_data(struct zcr_color_space_v1 * zcr_color_space_v1,void * user_data)1713 zcr_color_space_v1_set_user_data(struct zcr_color_space_v1 *zcr_color_space_v1, void *user_data)
1714 {
1715 	wl_proxy_set_user_data((struct wl_proxy *) zcr_color_space_v1, user_data);
1716 }
1717 
1718 /** @ingroup iface_zcr_color_space_v1 */
1719 static inline void *
zcr_color_space_v1_get_user_data(struct zcr_color_space_v1 * zcr_color_space_v1)1720 zcr_color_space_v1_get_user_data(struct zcr_color_space_v1 *zcr_color_space_v1)
1721 {
1722 	return wl_proxy_get_user_data((struct wl_proxy *) zcr_color_space_v1);
1723 }
1724 
1725 static inline uint32_t
zcr_color_space_v1_get_version(struct zcr_color_space_v1 * zcr_color_space_v1)1726 zcr_color_space_v1_get_version(struct zcr_color_space_v1 *zcr_color_space_v1)
1727 {
1728 	return wl_proxy_get_version((struct wl_proxy *) zcr_color_space_v1);
1729 }
1730 
1731 /**
1732  * @ingroup iface_zcr_color_space_v1
1733  *
1734  * As a reply to this request, the compositor will send all available
1735  * information events describing this color space object and finally
1736  * the 'done' event. Other extensions may define more events to be sent
1737  * before 'done'.
1738  *
1739  * This request is allowed only on zcr_color_space_v1 objects where the
1740  * message that created the object specifies that get_information is
1741  * allowed. Otherwise protocol error no_information is raised.
1742  *
1743  * Every get_information request on the same object will always return the
1744  * exact same data.
1745  *
1746  * See zcr_color_management_output_v1.get_color_space and
1747  * zcr_color_space_creator_v1.created.
1748  */
1749 static inline void
zcr_color_space_v1_get_information(struct zcr_color_space_v1 * zcr_color_space_v1)1750 zcr_color_space_v1_get_information(struct zcr_color_space_v1 *zcr_color_space_v1)
1751 {
1752 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_space_v1,
1753 			 ZCR_COLOR_SPACE_V1_GET_INFORMATION, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_space_v1), 0);
1754 }
1755 
1756 /**
1757  * @ingroup iface_zcr_color_space_v1
1758  *
1759  * Destroy the zcr_color_space_v1 object.
1760  *
1761  * Destroying the zcr_color_space_v1 which is active on a surface or an
1762  * output does not change the color space of those objects.
1763  */
1764 static inline void
zcr_color_space_v1_destroy(struct zcr_color_space_v1 * zcr_color_space_v1)1765 zcr_color_space_v1_destroy(struct zcr_color_space_v1 *zcr_color_space_v1)
1766 {
1767 	wl_proxy_marshal_flags((struct wl_proxy *) zcr_color_space_v1,
1768 			 ZCR_COLOR_SPACE_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zcr_color_space_v1), WL_MARSHAL_FLAG_DESTROY);
1769 }
1770 
1771 #ifdef  __cplusplus
1772 }
1773 #endif
1774 
1775 #endif
1776