xref: /netbsd-src/external/mit/xorg/lib/libxcb/files/present.h (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1 /*
2  * This file generated automatically from present.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
6 /**
7  * @defgroup XCB_Present_API XCB Present API
8  * @brief Present XCB Protocol Implementation.
9  * @{
10  **/
11 
12 #ifndef __PRESENT_H
13 #define __PRESENT_H
14 
15 #include "xcb.h"
16 #include "xproto.h"
17 #include "randr.h"
18 #include "xfixes.h"
19 #include "sync.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #define XCB_PRESENT_MAJOR_VERSION 1
26 #define XCB_PRESENT_MINOR_VERSION 2
27 
28 extern xcb_extension_t xcb_present_id;
29 
30 typedef enum xcb_present_event_enum_t {
31     XCB_PRESENT_EVENT_CONFIGURE_NOTIFY = 0,
32     XCB_PRESENT_EVENT_COMPLETE_NOTIFY = 1,
33     XCB_PRESENT_EVENT_IDLE_NOTIFY = 2,
34     XCB_PRESENT_EVENT_REDIRECT_NOTIFY = 3
35 } xcb_present_event_enum_t;
36 
37 typedef enum xcb_present_event_mask_t {
38     XCB_PRESENT_EVENT_MASK_NO_EVENT = 0,
39     XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY = 1,
40     XCB_PRESENT_EVENT_MASK_COMPLETE_NOTIFY = 2,
41     XCB_PRESENT_EVENT_MASK_IDLE_NOTIFY = 4,
42     XCB_PRESENT_EVENT_MASK_REDIRECT_NOTIFY = 8
43 } xcb_present_event_mask_t;
44 
45 typedef enum xcb_present_option_t {
46     XCB_PRESENT_OPTION_NONE = 0,
47     XCB_PRESENT_OPTION_ASYNC = 1,
48     XCB_PRESENT_OPTION_COPY = 2,
49     XCB_PRESENT_OPTION_UST = 4,
50     XCB_PRESENT_OPTION_SUBOPTIMAL = 8
51 } xcb_present_option_t;
52 
53 typedef enum xcb_present_capability_t {
54     XCB_PRESENT_CAPABILITY_NONE = 0,
55     XCB_PRESENT_CAPABILITY_ASYNC = 1,
56     XCB_PRESENT_CAPABILITY_FENCE = 2,
57     XCB_PRESENT_CAPABILITY_UST = 4
58 } xcb_present_capability_t;
59 
60 typedef enum xcb_present_complete_kind_t {
61     XCB_PRESENT_COMPLETE_KIND_PIXMAP = 0,
62     XCB_PRESENT_COMPLETE_KIND_NOTIFY_MSC = 1
63 } xcb_present_complete_kind_t;
64 
65 typedef enum xcb_present_complete_mode_t {
66     XCB_PRESENT_COMPLETE_MODE_COPY = 0,
67     XCB_PRESENT_COMPLETE_MODE_FLIP = 1,
68     XCB_PRESENT_COMPLETE_MODE_SKIP = 2,
69     XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY = 3
70 } xcb_present_complete_mode_t;
71 
72 /**
73  * @brief xcb_present_notify_t
74  **/
75 typedef struct xcb_present_notify_t {
76     xcb_window_t window;
77     uint32_t     serial;
78 } xcb_present_notify_t;
79 
80 /**
81  * @brief xcb_present_notify_iterator_t
82  **/
83 typedef struct xcb_present_notify_iterator_t {
84     xcb_present_notify_t *data;
85     int                   rem;
86     int                   index;
87 } xcb_present_notify_iterator_t;
88 
89 /**
90  * @brief xcb_present_query_version_cookie_t
91  **/
92 typedef struct xcb_present_query_version_cookie_t {
93     unsigned int sequence;
94 } xcb_present_query_version_cookie_t;
95 
96 /** Opcode for xcb_present_query_version. */
97 #define XCB_PRESENT_QUERY_VERSION 0
98 
99 /**
100  * @brief xcb_present_query_version_request_t
101  **/
102 typedef struct xcb_present_query_version_request_t {
103     uint8_t  major_opcode;
104     uint8_t  minor_opcode;
105     uint16_t length;
106     uint32_t major_version;
107     uint32_t minor_version;
108 } xcb_present_query_version_request_t;
109 
110 /**
111  * @brief xcb_present_query_version_reply_t
112  **/
113 typedef struct xcb_present_query_version_reply_t {
114     uint8_t  response_type;
115     uint8_t  pad0;
116     uint16_t sequence;
117     uint32_t length;
118     uint32_t major_version;
119     uint32_t minor_version;
120 } xcb_present_query_version_reply_t;
121 
122 /** Opcode for xcb_present_pixmap. */
123 #define XCB_PRESENT_PIXMAP 1
124 
125 /**
126  * @brief xcb_present_pixmap_request_t
127  **/
128 typedef struct xcb_present_pixmap_request_t {
129     uint8_t             major_opcode;
130     uint8_t             minor_opcode;
131     uint16_t            length;
132     xcb_window_t        window;
133     xcb_pixmap_t        pixmap;
134     uint32_t            serial;
135     xcb_xfixes_region_t valid;
136     xcb_xfixes_region_t update;
137     int16_t             x_off;
138     int16_t             y_off;
139     xcb_randr_crtc_t    target_crtc;
140     xcb_sync_fence_t    wait_fence;
141     xcb_sync_fence_t    idle_fence;
142     uint32_t            options;
143     uint8_t             pad0[4];
144     uint64_t            target_msc;
145     uint64_t            divisor;
146     uint64_t            remainder;
147 } xcb_present_pixmap_request_t;
148 
149 /** Opcode for xcb_present_notify_msc. */
150 #define XCB_PRESENT_NOTIFY_MSC 2
151 
152 /**
153  * @brief xcb_present_notify_msc_request_t
154  **/
155 typedef struct xcb_present_notify_msc_request_t {
156     uint8_t      major_opcode;
157     uint8_t      minor_opcode;
158     uint16_t     length;
159     xcb_window_t window;
160     uint32_t     serial;
161     uint8_t      pad0[4];
162     uint64_t     target_msc;
163     uint64_t     divisor;
164     uint64_t     remainder;
165 } xcb_present_notify_msc_request_t;
166 
167 typedef uint32_t xcb_present_event_t;
168 
169 /**
170  * @brief xcb_present_event_iterator_t
171  **/
172 typedef struct xcb_present_event_iterator_t {
173     xcb_present_event_t *data;
174     int                  rem;
175     int                  index;
176 } xcb_present_event_iterator_t;
177 
178 /** Opcode for xcb_present_select_input. */
179 #define XCB_PRESENT_SELECT_INPUT 3
180 
181 /**
182  * @brief xcb_present_select_input_request_t
183  **/
184 typedef struct xcb_present_select_input_request_t {
185     uint8_t             major_opcode;
186     uint8_t             minor_opcode;
187     uint16_t            length;
188     xcb_present_event_t eid;
189     xcb_window_t        window;
190     uint32_t            event_mask;
191 } xcb_present_select_input_request_t;
192 
193 /**
194  * @brief xcb_present_query_capabilities_cookie_t
195  **/
196 typedef struct xcb_present_query_capabilities_cookie_t {
197     unsigned int sequence;
198 } xcb_present_query_capabilities_cookie_t;
199 
200 /** Opcode for xcb_present_query_capabilities. */
201 #define XCB_PRESENT_QUERY_CAPABILITIES 4
202 
203 /**
204  * @brief xcb_present_query_capabilities_request_t
205  **/
206 typedef struct xcb_present_query_capabilities_request_t {
207     uint8_t  major_opcode;
208     uint8_t  minor_opcode;
209     uint16_t length;
210     uint32_t target;
211 } xcb_present_query_capabilities_request_t;
212 
213 /**
214  * @brief xcb_present_query_capabilities_reply_t
215  **/
216 typedef struct xcb_present_query_capabilities_reply_t {
217     uint8_t  response_type;
218     uint8_t  pad0;
219     uint16_t sequence;
220     uint32_t length;
221     uint32_t capabilities;
222 } xcb_present_query_capabilities_reply_t;
223 
224 /** Opcode for xcb_present_generic. */
225 #define XCB_PRESENT_GENERIC 0
226 
227 /**
228  * @brief xcb_present_generic_event_t
229  **/
230 typedef struct xcb_present_generic_event_t {
231     uint8_t             response_type;
232     uint8_t             extension;
233     uint16_t            sequence;
234     uint32_t            length;
235     uint16_t            evtype;
236     uint8_t             pad0[2];
237     xcb_present_event_t event;
238 } xcb_present_generic_event_t;
239 
240 /** Opcode for xcb_present_configure_notify. */
241 #define XCB_PRESENT_CONFIGURE_NOTIFY 0
242 
243 /**
244  * @brief xcb_present_configure_notify_event_t
245  **/
246 typedef struct xcb_present_configure_notify_event_t {
247     uint8_t             response_type;
248     uint8_t             extension;
249     uint16_t            sequence;
250     uint32_t            length;
251     uint16_t            event_type;
252     uint8_t             pad0[2];
253     xcb_present_event_t event;
254     xcb_window_t        window;
255     int16_t             x;
256     int16_t             y;
257     uint16_t            width;
258     uint16_t            height;
259     int16_t             off_x;
260     int16_t             off_y;
261     uint32_t            full_sequence;
262     uint16_t            pixmap_width;
263     uint16_t            pixmap_height;
264     uint32_t            pixmap_flags;
265 } xcb_present_configure_notify_event_t;
266 
267 /** Opcode for xcb_present_complete_notify. */
268 #define XCB_PRESENT_COMPLETE_NOTIFY 1
269 
270 /**
271  * @brief xcb_present_complete_notify_event_t
272  **/
273 typedef struct xcb_present_complete_notify_event_t {
274     uint8_t             response_type;
275     uint8_t             extension;
276     uint16_t            sequence;
277     uint32_t            length;
278     uint16_t            event_type;
279     uint8_t             kind;
280     uint8_t             mode;
281     xcb_present_event_t event;
282     xcb_window_t        window;
283     uint32_t            serial;
284     uint64_t            ust;
285     uint32_t            full_sequence;
286     uint64_t            msc;
287 } XCB_PACKED xcb_present_complete_notify_event_t;
288 
289 /** Opcode for xcb_present_idle_notify. */
290 #define XCB_PRESENT_IDLE_NOTIFY 2
291 
292 /**
293  * @brief xcb_present_idle_notify_event_t
294  **/
295 typedef struct xcb_present_idle_notify_event_t {
296     uint8_t             response_type;
297     uint8_t             extension;
298     uint16_t            sequence;
299     uint32_t            length;
300     uint16_t            event_type;
301     uint8_t             pad0[2];
302     xcb_present_event_t event;
303     xcb_window_t        window;
304     uint32_t            serial;
305     xcb_pixmap_t        pixmap;
306     xcb_sync_fence_t    idle_fence;
307     uint32_t            full_sequence;
308 } xcb_present_idle_notify_event_t;
309 
310 /** Opcode for xcb_present_redirect_notify. */
311 #define XCB_PRESENT_REDIRECT_NOTIFY 3
312 
313 /**
314  * @brief xcb_present_redirect_notify_event_t
315  **/
316 typedef struct xcb_present_redirect_notify_event_t {
317     uint8_t             response_type;
318     uint8_t             extension;
319     uint16_t            sequence;
320     uint32_t            length;
321     uint16_t            event_type;
322     uint8_t             update_window;
323     uint8_t             pad0;
324     xcb_present_event_t event;
325     xcb_window_t        event_window;
326     xcb_window_t        window;
327     xcb_pixmap_t        pixmap;
328     uint32_t            serial;
329     uint32_t            full_sequence;
330     xcb_xfixes_region_t valid_region;
331     xcb_xfixes_region_t update_region;
332     xcb_rectangle_t     valid_rect;
333     xcb_rectangle_t     update_rect;
334     int16_t             x_off;
335     int16_t             y_off;
336     xcb_randr_crtc_t    target_crtc;
337     xcb_sync_fence_t    wait_fence;
338     xcb_sync_fence_t    idle_fence;
339     uint32_t            options;
340     uint8_t             pad1[4];
341     uint64_t            target_msc;
342     uint64_t            divisor;
343     uint64_t            remainder;
344 } XCB_PACKED xcb_present_redirect_notify_event_t;
345 
346 /**
347  * Get the next element of the iterator
348  * @param i Pointer to a xcb_present_notify_iterator_t
349  *
350  * Get the next element in the iterator. The member rem is
351  * decreased by one. The member data points to the next
352  * element. The member index is increased by sizeof(xcb_present_notify_t)
353  */
354 void
355 xcb_present_notify_next (xcb_present_notify_iterator_t *i);
356 
357 /**
358  * Return the iterator pointing to the last element
359  * @param i An xcb_present_notify_iterator_t
360  * @return  The iterator pointing to the last element
361  *
362  * Set the current element in the iterator to the last element.
363  * The member rem is set to 0. The member data points to the
364  * last element.
365  */
366 xcb_generic_iterator_t
367 xcb_present_notify_end (xcb_present_notify_iterator_t i);
368 
369 /**
370  *
371  * @param c The connection
372  * @return A cookie
373  *
374  * Delivers a request to the X server.
375  *
376  */
377 xcb_present_query_version_cookie_t
378 xcb_present_query_version (xcb_connection_t *c,
379                            uint32_t          major_version,
380                            uint32_t          minor_version);
381 
382 /**
383  *
384  * @param c The connection
385  * @return A cookie
386  *
387  * Delivers a request to the X server.
388  *
389  * This form can be used only if the request will cause
390  * a reply to be generated. Any returned error will be
391  * placed in the event queue.
392  */
393 xcb_present_query_version_cookie_t
394 xcb_present_query_version_unchecked (xcb_connection_t *c,
395                                      uint32_t          major_version,
396                                      uint32_t          minor_version);
397 
398 /**
399  * Return the reply
400  * @param c      The connection
401  * @param cookie The cookie
402  * @param e      The xcb_generic_error_t supplied
403  *
404  * Returns the reply of the request asked by
405  *
406  * The parameter @p e supplied to this function must be NULL if
407  * xcb_present_query_version_unchecked(). is used.
408  * Otherwise, it stores the error if any.
409  *
410  * The returned value must be freed by the caller using free().
411  */
412 xcb_present_query_version_reply_t *
413 xcb_present_query_version_reply (xcb_connection_t                    *c,
414                                  xcb_present_query_version_cookie_t   cookie  /**< */,
415                                  xcb_generic_error_t                **e);
416 
417 int
418 xcb_present_pixmap_sizeof (const void  *_buffer,
419                            uint32_t     notifies_len);
420 
421 /**
422  *
423  * @param c The connection
424  * @return A cookie
425  *
426  * Delivers a request to the X server.
427  *
428  * This form can be used only if the request will not cause
429  * a reply to be generated. Any returned error will be
430  * saved for handling by xcb_request_check().
431  */
432 xcb_void_cookie_t
433 xcb_present_pixmap_checked (xcb_connection_t           *c,
434                             xcb_window_t                window,
435                             xcb_pixmap_t                pixmap,
436                             uint32_t                    serial,
437                             xcb_xfixes_region_t         valid,
438                             xcb_xfixes_region_t         update,
439                             int16_t                     x_off,
440                             int16_t                     y_off,
441                             xcb_randr_crtc_t            target_crtc,
442                             xcb_sync_fence_t            wait_fence,
443                             xcb_sync_fence_t            idle_fence,
444                             uint32_t                    options,
445                             uint64_t                    target_msc,
446                             uint64_t                    divisor,
447                             uint64_t                    remainder,
448                             uint32_t                    notifies_len,
449                             const xcb_present_notify_t *notifies);
450 
451 /**
452  *
453  * @param c The connection
454  * @return A cookie
455  *
456  * Delivers a request to the X server.
457  *
458  */
459 xcb_void_cookie_t
460 xcb_present_pixmap (xcb_connection_t           *c,
461                     xcb_window_t                window,
462                     xcb_pixmap_t                pixmap,
463                     uint32_t                    serial,
464                     xcb_xfixes_region_t         valid,
465                     xcb_xfixes_region_t         update,
466                     int16_t                     x_off,
467                     int16_t                     y_off,
468                     xcb_randr_crtc_t            target_crtc,
469                     xcb_sync_fence_t            wait_fence,
470                     xcb_sync_fence_t            idle_fence,
471                     uint32_t                    options,
472                     uint64_t                    target_msc,
473                     uint64_t                    divisor,
474                     uint64_t                    remainder,
475                     uint32_t                    notifies_len,
476                     const xcb_present_notify_t *notifies);
477 
478 xcb_present_notify_t *
479 xcb_present_pixmap_notifies (const xcb_present_pixmap_request_t *R);
480 
481 int
482 xcb_present_pixmap_notifies_length (const xcb_present_pixmap_request_t *R);
483 
484 xcb_present_notify_iterator_t
485 xcb_present_pixmap_notifies_iterator (const xcb_present_pixmap_request_t *R);
486 
487 /**
488  *
489  * @param c The connection
490  * @return A cookie
491  *
492  * Delivers a request to the X server.
493  *
494  * This form can be used only if the request will not cause
495  * a reply to be generated. Any returned error will be
496  * saved for handling by xcb_request_check().
497  */
498 xcb_void_cookie_t
499 xcb_present_notify_msc_checked (xcb_connection_t *c,
500                                 xcb_window_t      window,
501                                 uint32_t          serial,
502                                 uint64_t          target_msc,
503                                 uint64_t          divisor,
504                                 uint64_t          remainder);
505 
506 /**
507  *
508  * @param c The connection
509  * @return A cookie
510  *
511  * Delivers a request to the X server.
512  *
513  */
514 xcb_void_cookie_t
515 xcb_present_notify_msc (xcb_connection_t *c,
516                         xcb_window_t      window,
517                         uint32_t          serial,
518                         uint64_t          target_msc,
519                         uint64_t          divisor,
520                         uint64_t          remainder);
521 
522 /**
523  * Get the next element of the iterator
524  * @param i Pointer to a xcb_present_event_iterator_t
525  *
526  * Get the next element in the iterator. The member rem is
527  * decreased by one. The member data points to the next
528  * element. The member index is increased by sizeof(xcb_present_event_t)
529  */
530 void
531 xcb_present_event_next (xcb_present_event_iterator_t *i);
532 
533 /**
534  * Return the iterator pointing to the last element
535  * @param i An xcb_present_event_iterator_t
536  * @return  The iterator pointing to the last element
537  *
538  * Set the current element in the iterator to the last element.
539  * The member rem is set to 0. The member data points to the
540  * last element.
541  */
542 xcb_generic_iterator_t
543 xcb_present_event_end (xcb_present_event_iterator_t i);
544 
545 /**
546  *
547  * @param c The connection
548  * @return A cookie
549  *
550  * Delivers a request to the X server.
551  *
552  * This form can be used only if the request will not cause
553  * a reply to be generated. Any returned error will be
554  * saved for handling by xcb_request_check().
555  */
556 xcb_void_cookie_t
557 xcb_present_select_input_checked (xcb_connection_t    *c,
558                                   xcb_present_event_t  eid,
559                                   xcb_window_t         window,
560                                   uint32_t             event_mask);
561 
562 /**
563  *
564  * @param c The connection
565  * @return A cookie
566  *
567  * Delivers a request to the X server.
568  *
569  */
570 xcb_void_cookie_t
571 xcb_present_select_input (xcb_connection_t    *c,
572                           xcb_present_event_t  eid,
573                           xcb_window_t         window,
574                           uint32_t             event_mask);
575 
576 /**
577  *
578  * @param c The connection
579  * @return A cookie
580  *
581  * Delivers a request to the X server.
582  *
583  */
584 xcb_present_query_capabilities_cookie_t
585 xcb_present_query_capabilities (xcb_connection_t *c,
586                                 uint32_t          target);
587 
588 /**
589  *
590  * @param c The connection
591  * @return A cookie
592  *
593  * Delivers a request to the X server.
594  *
595  * This form can be used only if the request will cause
596  * a reply to be generated. Any returned error will be
597  * placed in the event queue.
598  */
599 xcb_present_query_capabilities_cookie_t
600 xcb_present_query_capabilities_unchecked (xcb_connection_t *c,
601                                           uint32_t          target);
602 
603 /**
604  * Return the reply
605  * @param c      The connection
606  * @param cookie The cookie
607  * @param e      The xcb_generic_error_t supplied
608  *
609  * Returns the reply of the request asked by
610  *
611  * The parameter @p e supplied to this function must be NULL if
612  * xcb_present_query_capabilities_unchecked(). is used.
613  * Otherwise, it stores the error if any.
614  *
615  * The returned value must be freed by the caller using free().
616  */
617 xcb_present_query_capabilities_reply_t *
618 xcb_present_query_capabilities_reply (xcb_connection_t                         *c,
619                                       xcb_present_query_capabilities_cookie_t   cookie  /**< */,
620                                       xcb_generic_error_t                     **e);
621 
622 int
623 xcb_present_redirect_notify_sizeof (const void  *_buffer,
624                                     uint32_t     notifies_len);
625 
626 xcb_present_notify_t *
627 xcb_present_redirect_notify_notifies (const xcb_present_redirect_notify_event_t *R);
628 
629 int
630 xcb_present_redirect_notify_notifies_length (const xcb_present_redirect_notify_event_t *R);
631 
632 xcb_present_notify_iterator_t
633 xcb_present_redirect_notify_notifies_iterator (const xcb_present_redirect_notify_event_t *R);
634 
635 
636 #ifdef __cplusplus
637 }
638 #endif
639 
640 #endif
641 
642 /**
643  * @}
644  */
645