xref: /minix/external/mit/xorg/lib/libxcb/files/dri3.c (revision 0a6a1f1d)
1 /*
2  * This file generated automatically from dri3.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif
9 #include <stdlib.h>
10 #include <string.h>
11 #include <assert.h>
12 #include <stddef.h>  /* for offsetof() */
13 #include "xcbext.h"
14 #include "dri3.h"
15 
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
18 
19 xcb_extension_t xcb_dri3_id = { "DRI3", 0 };
20 
21 xcb_dri3_query_version_cookie_t
xcb_dri3_query_version(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)22 xcb_dri3_query_version (xcb_connection_t *c  /**< */,
23                         uint32_t          major_version  /**< */,
24                         uint32_t          minor_version  /**< */)
25 {
26     static const xcb_protocol_request_t xcb_req = {
27         /* count */ 2,
28         /* ext */ &xcb_dri3_id,
29         /* opcode */ XCB_DRI3_QUERY_VERSION,
30         /* isvoid */ 0
31     };
32 
33     struct iovec xcb_parts[4];
34     xcb_dri3_query_version_cookie_t xcb_ret;
35     xcb_dri3_query_version_request_t xcb_out;
36 
37     xcb_out.major_version = major_version;
38     xcb_out.minor_version = minor_version;
39 
40     xcb_parts[2].iov_base = (char *) &xcb_out;
41     xcb_parts[2].iov_len = sizeof(xcb_out);
42     xcb_parts[3].iov_base = 0;
43     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
44 
45     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
46     return xcb_ret;
47 }
48 
49 xcb_dri3_query_version_cookie_t
xcb_dri3_query_version_unchecked(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)50 xcb_dri3_query_version_unchecked (xcb_connection_t *c  /**< */,
51                                   uint32_t          major_version  /**< */,
52                                   uint32_t          minor_version  /**< */)
53 {
54     static const xcb_protocol_request_t xcb_req = {
55         /* count */ 2,
56         /* ext */ &xcb_dri3_id,
57         /* opcode */ XCB_DRI3_QUERY_VERSION,
58         /* isvoid */ 0
59     };
60 
61     struct iovec xcb_parts[4];
62     xcb_dri3_query_version_cookie_t xcb_ret;
63     xcb_dri3_query_version_request_t xcb_out;
64 
65     xcb_out.major_version = major_version;
66     xcb_out.minor_version = minor_version;
67 
68     xcb_parts[2].iov_base = (char *) &xcb_out;
69     xcb_parts[2].iov_len = sizeof(xcb_out);
70     xcb_parts[3].iov_base = 0;
71     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
72 
73     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
74     return xcb_ret;
75 }
76 
77 xcb_dri3_query_version_reply_t *
xcb_dri3_query_version_reply(xcb_connection_t * c,xcb_dri3_query_version_cookie_t cookie,xcb_generic_error_t ** e)78 xcb_dri3_query_version_reply (xcb_connection_t                 *c  /**< */,
79                               xcb_dri3_query_version_cookie_t   cookie  /**< */,
80                               xcb_generic_error_t             **e  /**< */)
81 {
82     return (xcb_dri3_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
83 }
84 
85 xcb_dri3_open_cookie_t
xcb_dri3_open(xcb_connection_t * c,xcb_drawable_t drawable,uint32_t provider)86 xcb_dri3_open (xcb_connection_t *c  /**< */,
87                xcb_drawable_t    drawable  /**< */,
88                uint32_t          provider  /**< */)
89 {
90     static const xcb_protocol_request_t xcb_req = {
91         /* count */ 2,
92         /* ext */ &xcb_dri3_id,
93         /* opcode */ XCB_DRI3_OPEN,
94         /* isvoid */ 0
95     };
96 
97     struct iovec xcb_parts[4];
98     xcb_dri3_open_cookie_t xcb_ret;
99     xcb_dri3_open_request_t xcb_out;
100 
101     xcb_out.drawable = drawable;
102     xcb_out.provider = provider;
103 
104     xcb_parts[2].iov_base = (char *) &xcb_out;
105     xcb_parts[2].iov_len = sizeof(xcb_out);
106     xcb_parts[3].iov_base = 0;
107     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
108 
109     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
110     return xcb_ret;
111 }
112 
113 xcb_dri3_open_cookie_t
xcb_dri3_open_unchecked(xcb_connection_t * c,xcb_drawable_t drawable,uint32_t provider)114 xcb_dri3_open_unchecked (xcb_connection_t *c  /**< */,
115                          xcb_drawable_t    drawable  /**< */,
116                          uint32_t          provider  /**< */)
117 {
118     static const xcb_protocol_request_t xcb_req = {
119         /* count */ 2,
120         /* ext */ &xcb_dri3_id,
121         /* opcode */ XCB_DRI3_OPEN,
122         /* isvoid */ 0
123     };
124 
125     struct iovec xcb_parts[4];
126     xcb_dri3_open_cookie_t xcb_ret;
127     xcb_dri3_open_request_t xcb_out;
128 
129     xcb_out.drawable = drawable;
130     xcb_out.provider = provider;
131 
132     xcb_parts[2].iov_base = (char *) &xcb_out;
133     xcb_parts[2].iov_len = sizeof(xcb_out);
134     xcb_parts[3].iov_base = 0;
135     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
136 
137     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
138     return xcb_ret;
139 }
140 
141 xcb_dri3_open_reply_t *
xcb_dri3_open_reply(xcb_connection_t * c,xcb_dri3_open_cookie_t cookie,xcb_generic_error_t ** e)142 xcb_dri3_open_reply (xcb_connection_t        *c  /**< */,
143                      xcb_dri3_open_cookie_t   cookie  /**< */,
144                      xcb_generic_error_t    **e  /**< */)
145 {
146     return (xcb_dri3_open_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
147 }
148 
149 int *
xcb_dri3_open_reply_fds(xcb_connection_t * c,xcb_dri3_open_reply_t * reply)150 xcb_dri3_open_reply_fds (xcb_connection_t       *c  /**< */,
151                          xcb_dri3_open_reply_t  *reply  /**< */)
152 {
153     return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_open_reply_t) + 4 * reply->length);
154 }
155 
156 xcb_void_cookie_t
xcb_dri3_pixmap_from_buffer_checked(xcb_connection_t * c,xcb_pixmap_t pixmap,xcb_drawable_t drawable,uint32_t size,uint16_t width,uint16_t height,uint16_t stride,uint8_t depth,uint8_t bpp,int32_t pixmap_fd)157 xcb_dri3_pixmap_from_buffer_checked (xcb_connection_t *c  /**< */,
158                                      xcb_pixmap_t      pixmap  /**< */,
159                                      xcb_drawable_t    drawable  /**< */,
160                                      uint32_t          size  /**< */,
161                                      uint16_t          width  /**< */,
162                                      uint16_t          height  /**< */,
163                                      uint16_t          stride  /**< */,
164                                      uint8_t           depth  /**< */,
165                                      uint8_t           bpp  /**< */,
166                                      int32_t           pixmap_fd  /**< */)
167 {
168     static const xcb_protocol_request_t xcb_req = {
169         /* count */ 2,
170         /* ext */ &xcb_dri3_id,
171         /* opcode */ XCB_DRI3_PIXMAP_FROM_BUFFER,
172         /* isvoid */ 1
173     };
174 
175     struct iovec xcb_parts[4];
176     xcb_void_cookie_t xcb_ret;
177     xcb_dri3_pixmap_from_buffer_request_t xcb_out;
178 
179     xcb_out.pixmap = pixmap;
180     xcb_out.drawable = drawable;
181     xcb_out.size = size;
182     xcb_out.width = width;
183     xcb_out.height = height;
184     xcb_out.stride = stride;
185     xcb_out.depth = depth;
186     xcb_out.bpp = bpp;
187 
188     xcb_parts[2].iov_base = (char *) &xcb_out;
189     xcb_parts[2].iov_len = sizeof(xcb_out);
190     xcb_parts[3].iov_base = 0;
191     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
192 
193     xcb_send_fd(c, pixmap_fd);
194     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
195     return xcb_ret;
196 }
197 
198 xcb_void_cookie_t
xcb_dri3_pixmap_from_buffer(xcb_connection_t * c,xcb_pixmap_t pixmap,xcb_drawable_t drawable,uint32_t size,uint16_t width,uint16_t height,uint16_t stride,uint8_t depth,uint8_t bpp,int32_t pixmap_fd)199 xcb_dri3_pixmap_from_buffer (xcb_connection_t *c  /**< */,
200                              xcb_pixmap_t      pixmap  /**< */,
201                              xcb_drawable_t    drawable  /**< */,
202                              uint32_t          size  /**< */,
203                              uint16_t          width  /**< */,
204                              uint16_t          height  /**< */,
205                              uint16_t          stride  /**< */,
206                              uint8_t           depth  /**< */,
207                              uint8_t           bpp  /**< */,
208                              int32_t           pixmap_fd  /**< */)
209 {
210     static const xcb_protocol_request_t xcb_req = {
211         /* count */ 2,
212         /* ext */ &xcb_dri3_id,
213         /* opcode */ XCB_DRI3_PIXMAP_FROM_BUFFER,
214         /* isvoid */ 1
215     };
216 
217     struct iovec xcb_parts[4];
218     xcb_void_cookie_t xcb_ret;
219     xcb_dri3_pixmap_from_buffer_request_t xcb_out;
220 
221     xcb_out.pixmap = pixmap;
222     xcb_out.drawable = drawable;
223     xcb_out.size = size;
224     xcb_out.width = width;
225     xcb_out.height = height;
226     xcb_out.stride = stride;
227     xcb_out.depth = depth;
228     xcb_out.bpp = bpp;
229 
230     xcb_parts[2].iov_base = (char *) &xcb_out;
231     xcb_parts[2].iov_len = sizeof(xcb_out);
232     xcb_parts[3].iov_base = 0;
233     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
234 
235     xcb_send_fd(c, pixmap_fd);
236     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
237     return xcb_ret;
238 }
239 
240 xcb_dri3_buffer_from_pixmap_cookie_t
xcb_dri3_buffer_from_pixmap(xcb_connection_t * c,xcb_pixmap_t pixmap)241 xcb_dri3_buffer_from_pixmap (xcb_connection_t *c  /**< */,
242                              xcb_pixmap_t      pixmap  /**< */)
243 {
244     static const xcb_protocol_request_t xcb_req = {
245         /* count */ 2,
246         /* ext */ &xcb_dri3_id,
247         /* opcode */ XCB_DRI3_BUFFER_FROM_PIXMAP,
248         /* isvoid */ 0
249     };
250 
251     struct iovec xcb_parts[4];
252     xcb_dri3_buffer_from_pixmap_cookie_t xcb_ret;
253     xcb_dri3_buffer_from_pixmap_request_t xcb_out;
254 
255     xcb_out.pixmap = pixmap;
256 
257     xcb_parts[2].iov_base = (char *) &xcb_out;
258     xcb_parts[2].iov_len = sizeof(xcb_out);
259     xcb_parts[3].iov_base = 0;
260     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
261 
262     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
263     return xcb_ret;
264 }
265 
266 xcb_dri3_buffer_from_pixmap_cookie_t
xcb_dri3_buffer_from_pixmap_unchecked(xcb_connection_t * c,xcb_pixmap_t pixmap)267 xcb_dri3_buffer_from_pixmap_unchecked (xcb_connection_t *c  /**< */,
268                                        xcb_pixmap_t      pixmap  /**< */)
269 {
270     static const xcb_protocol_request_t xcb_req = {
271         /* count */ 2,
272         /* ext */ &xcb_dri3_id,
273         /* opcode */ XCB_DRI3_BUFFER_FROM_PIXMAP,
274         /* isvoid */ 0
275     };
276 
277     struct iovec xcb_parts[4];
278     xcb_dri3_buffer_from_pixmap_cookie_t xcb_ret;
279     xcb_dri3_buffer_from_pixmap_request_t xcb_out;
280 
281     xcb_out.pixmap = pixmap;
282 
283     xcb_parts[2].iov_base = (char *) &xcb_out;
284     xcb_parts[2].iov_len = sizeof(xcb_out);
285     xcb_parts[3].iov_base = 0;
286     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
287 
288     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
289     return xcb_ret;
290 }
291 
292 xcb_dri3_buffer_from_pixmap_reply_t *
xcb_dri3_buffer_from_pixmap_reply(xcb_connection_t * c,xcb_dri3_buffer_from_pixmap_cookie_t cookie,xcb_generic_error_t ** e)293 xcb_dri3_buffer_from_pixmap_reply (xcb_connection_t                      *c  /**< */,
294                                    xcb_dri3_buffer_from_pixmap_cookie_t   cookie  /**< */,
295                                    xcb_generic_error_t                  **e  /**< */)
296 {
297     return (xcb_dri3_buffer_from_pixmap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
298 }
299 
300 int *
xcb_dri3_buffer_from_pixmap_reply_fds(xcb_connection_t * c,xcb_dri3_buffer_from_pixmap_reply_t * reply)301 xcb_dri3_buffer_from_pixmap_reply_fds (xcb_connection_t                     *c  /**< */,
302                                        xcb_dri3_buffer_from_pixmap_reply_t  *reply  /**< */)
303 {
304     return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_buffer_from_pixmap_reply_t) + 4 * reply->length);
305 }
306 
307 xcb_void_cookie_t
xcb_dri3_fence_from_fd_checked(xcb_connection_t * c,xcb_drawable_t drawable,uint32_t fence,uint8_t initially_triggered,int32_t fence_fd)308 xcb_dri3_fence_from_fd_checked (xcb_connection_t *c  /**< */,
309                                 xcb_drawable_t    drawable  /**< */,
310                                 uint32_t          fence  /**< */,
311                                 uint8_t           initially_triggered  /**< */,
312                                 int32_t           fence_fd  /**< */)
313 {
314     static const xcb_protocol_request_t xcb_req = {
315         /* count */ 2,
316         /* ext */ &xcb_dri3_id,
317         /* opcode */ XCB_DRI3_FENCE_FROM_FD,
318         /* isvoid */ 1
319     };
320 
321     struct iovec xcb_parts[4];
322     xcb_void_cookie_t xcb_ret;
323     xcb_dri3_fence_from_fd_request_t xcb_out;
324 
325     xcb_out.drawable = drawable;
326     xcb_out.fence = fence;
327     xcb_out.initially_triggered = initially_triggered;
328     memset(xcb_out.pad0, 0, 3);
329 
330     xcb_parts[2].iov_base = (char *) &xcb_out;
331     xcb_parts[2].iov_len = sizeof(xcb_out);
332     xcb_parts[3].iov_base = 0;
333     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
334 
335     xcb_send_fd(c, fence_fd);
336     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
337     return xcb_ret;
338 }
339 
340 xcb_void_cookie_t
xcb_dri3_fence_from_fd(xcb_connection_t * c,xcb_drawable_t drawable,uint32_t fence,uint8_t initially_triggered,int32_t fence_fd)341 xcb_dri3_fence_from_fd (xcb_connection_t *c  /**< */,
342                         xcb_drawable_t    drawable  /**< */,
343                         uint32_t          fence  /**< */,
344                         uint8_t           initially_triggered  /**< */,
345                         int32_t           fence_fd  /**< */)
346 {
347     static const xcb_protocol_request_t xcb_req = {
348         /* count */ 2,
349         /* ext */ &xcb_dri3_id,
350         /* opcode */ XCB_DRI3_FENCE_FROM_FD,
351         /* isvoid */ 1
352     };
353 
354     struct iovec xcb_parts[4];
355     xcb_void_cookie_t xcb_ret;
356     xcb_dri3_fence_from_fd_request_t xcb_out;
357 
358     xcb_out.drawable = drawable;
359     xcb_out.fence = fence;
360     xcb_out.initially_triggered = initially_triggered;
361     memset(xcb_out.pad0, 0, 3);
362 
363     xcb_parts[2].iov_base = (char *) &xcb_out;
364     xcb_parts[2].iov_len = sizeof(xcb_out);
365     xcb_parts[3].iov_base = 0;
366     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
367 
368     xcb_send_fd(c, fence_fd);
369     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
370     return xcb_ret;
371 }
372 
373 xcb_dri3_fd_from_fence_cookie_t
xcb_dri3_fd_from_fence(xcb_connection_t * c,xcb_drawable_t drawable,uint32_t fence)374 xcb_dri3_fd_from_fence (xcb_connection_t *c  /**< */,
375                         xcb_drawable_t    drawable  /**< */,
376                         uint32_t          fence  /**< */)
377 {
378     static const xcb_protocol_request_t xcb_req = {
379         /* count */ 2,
380         /* ext */ &xcb_dri3_id,
381         /* opcode */ XCB_DRI3_FD_FROM_FENCE,
382         /* isvoid */ 0
383     };
384 
385     struct iovec xcb_parts[4];
386     xcb_dri3_fd_from_fence_cookie_t xcb_ret;
387     xcb_dri3_fd_from_fence_request_t xcb_out;
388 
389     xcb_out.drawable = drawable;
390     xcb_out.fence = fence;
391 
392     xcb_parts[2].iov_base = (char *) &xcb_out;
393     xcb_parts[2].iov_len = sizeof(xcb_out);
394     xcb_parts[3].iov_base = 0;
395     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
396 
397     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
398     return xcb_ret;
399 }
400 
401 xcb_dri3_fd_from_fence_cookie_t
xcb_dri3_fd_from_fence_unchecked(xcb_connection_t * c,xcb_drawable_t drawable,uint32_t fence)402 xcb_dri3_fd_from_fence_unchecked (xcb_connection_t *c  /**< */,
403                                   xcb_drawable_t    drawable  /**< */,
404                                   uint32_t          fence  /**< */)
405 {
406     static const xcb_protocol_request_t xcb_req = {
407         /* count */ 2,
408         /* ext */ &xcb_dri3_id,
409         /* opcode */ XCB_DRI3_FD_FROM_FENCE,
410         /* isvoid */ 0
411     };
412 
413     struct iovec xcb_parts[4];
414     xcb_dri3_fd_from_fence_cookie_t xcb_ret;
415     xcb_dri3_fd_from_fence_request_t xcb_out;
416 
417     xcb_out.drawable = drawable;
418     xcb_out.fence = fence;
419 
420     xcb_parts[2].iov_base = (char *) &xcb_out;
421     xcb_parts[2].iov_len = sizeof(xcb_out);
422     xcb_parts[3].iov_base = 0;
423     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
424 
425     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req);
426     return xcb_ret;
427 }
428 
429 xcb_dri3_fd_from_fence_reply_t *
xcb_dri3_fd_from_fence_reply(xcb_connection_t * c,xcb_dri3_fd_from_fence_cookie_t cookie,xcb_generic_error_t ** e)430 xcb_dri3_fd_from_fence_reply (xcb_connection_t                 *c  /**< */,
431                               xcb_dri3_fd_from_fence_cookie_t   cookie  /**< */,
432                               xcb_generic_error_t             **e  /**< */)
433 {
434     return (xcb_dri3_fd_from_fence_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
435 }
436 
437 int *
xcb_dri3_fd_from_fence_reply_fds(xcb_connection_t * c,xcb_dri3_fd_from_fence_reply_t * reply)438 xcb_dri3_fd_from_fence_reply_fds (xcb_connection_t                *c  /**< */,
439                                   xcb_dri3_fd_from_fence_reply_t  *reply  /**< */)
440 {
441     return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_fd_from_fence_reply_t) + 4 * reply->length);
442 }
443 
444