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