1/*
2 * Copyright © 2013 Keith Packard
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission.  The copyright holders make no representations
11 * about the suitability of this software for any purpose.  It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifndef _DRI3_PROTO_H_
24#define _DRI3_PROTO_H_
25
26#define DRI3_NAME			"DRI3"
27#define DRI3_MAJOR			1
28#define DRI3_MINOR			4
29
30#define DRI3NumberErrors		0
31#define DRI3NumberEvents		0
32
33#define X_DRI3QueryVersion		0
34#define X_DRI3Open			1
35#define X_DRI3PixmapFromBuffer          2
36#define X_DRI3BufferFromPixmap          3
37#define X_DRI3FenceFromFD               4
38#define X_DRI3FDFromFence               5
39
40/* v1.2 */
41#define xDRI3GetSupportedModifiers      6
42#define xDRI3PixmapFromBuffers          7
43#define xDRI3BuffersFromPixmap          8
44
45/* v1.3 */
46#define xDRI3SetDRMDeviceInUse  9
47
48/* v1.4 */
49#define xDRI3ImportSyncobj		10
50#define xDRI3FreeSyncobj		11
51
52#define DRI3NumberRequests		12
53
54#define DRI3Syncobj CARD32
55
56typedef struct {
57    CARD8   reqType;
58    CARD8   dri3ReqType;
59    CARD16  length;
60    CARD32  majorVersion;
61    CARD32  minorVersion;
62} xDRI3QueryVersionReq;
63#define sz_xDRI3QueryVersionReq   12
64
65typedef struct {
66    BYTE    type;   /* X_Reply */
67    BYTE    pad1;
68    CARD16  sequenceNumber;
69    CARD32  length;
70    CARD32  majorVersion;
71    CARD32  minorVersion;
72    CARD32  pad2;
73    CARD32  pad3;
74    CARD32  pad4;
75    CARD32  pad5;
76} xDRI3QueryVersionReply;
77#define sz_xDRI3QueryVersionReply	32
78
79typedef struct {
80    CARD8   reqType;
81    CARD8   dri3ReqType;
82    CARD16  length;
83    CARD32  drawable;
84    CARD32  provider;
85} xDRI3OpenReq;
86#define sz_xDRI3OpenReq	12
87
88typedef struct {
89    BYTE    type;   /* X_Reply */
90    CARD8   nfd;
91    CARD16  sequenceNumber;
92    CARD32  length;
93    CARD32  pad2;
94    CARD32  pad3;
95    CARD32  pad4;
96    CARD32  pad5;
97    CARD32  pad6;
98    CARD32  pad7;
99} xDRI3OpenReply;
100#define sz_xDRI3OpenReply	32
101
102typedef struct {
103    CARD8   reqType;
104    CARD8   dri3ReqType;
105    CARD16  length;
106    CARD32  pixmap;
107    CARD32  drawable;
108    CARD32  size;
109    CARD16  width;
110    CARD16  height;
111    CARD16  stride;
112    CARD8   depth;
113    CARD8   bpp;
114} xDRI3PixmapFromBufferReq;
115
116#define sz_xDRI3PixmapFromBufferReq     24
117
118typedef struct {
119    CARD8   reqType;
120    CARD8   dri3ReqType;
121    CARD16  length;
122    CARD32  pixmap;
123} xDRI3BufferFromPixmapReq;
124#define sz_xDRI3BufferFromPixmapReq     8
125
126typedef struct {
127    BYTE    type;   /* X_Reply */
128    CARD8   nfd;    /* Number of file descriptors returned (1) */
129    CARD16  sequenceNumber;
130    CARD32  length;
131    CARD32  size;
132    CARD16  width;
133    CARD16  height;
134    CARD16  stride;
135    CARD8   depth;
136    CARD8   bpp;
137    CARD32  pad20;
138    CARD32  pad24;
139    CARD32  pad28;
140} xDRI3BufferFromPixmapReply;
141#define sz_xDRI3BufferFromPixmapReply   32
142
143typedef struct {
144    CARD8   reqType;
145    CARD8   dri3ReqType;
146    CARD16  length;
147    CARD32  drawable;
148    CARD32  fence;
149    BOOL    initially_triggered;
150    CARD8   pad13;
151    CARD16  pad14;
152} xDRI3FenceFromFDReq;
153
154#define sz_xDRI3FenceFromFDReq  16
155
156typedef struct {
157    CARD8   reqType;
158    CARD8   dri3ReqType;
159    CARD16  length;
160    CARD32  drawable;
161    CARD32  fence;
162} xDRI3FDFromFenceReq;
163
164#define sz_xDRI3FDFromFenceReq  12
165
166typedef struct {
167    BYTE    type;   /* X_Reply */
168    CARD8   nfd;    /* Number of file descriptors returned (1) */
169    CARD16  sequenceNumber;
170    CARD32  length;
171    CARD32  pad08;
172    CARD32  pad12;
173    CARD32  pad16;
174    CARD32  pad20;
175    CARD32  pad24;
176    CARD32  pad28;
177} xDRI3FDFromFenceReply;
178
179#define sz_xDRI3FDFromFenceReply   32
180
181/* v1.2 */
182
183typedef struct {
184    CARD8   reqType;
185    CARD8   dri3ReqType;
186    CARD16  length;
187    CARD32  window;
188    CARD8   depth;
189    CARD8   bpp;
190    CARD16  pad10;
191} xDRI3GetSupportedModifiersReq;
192#define sz_xDRI3GetSupportedModifiersReq     12
193
194typedef struct {
195    BYTE    type;   /* X_Reply */
196    CARD8   pad1;
197    CARD16  sequenceNumber;
198    CARD32  length;
199    CARD32  numWindowModifiers;
200    CARD32  numScreenModifiers;
201    CARD32  pad16;
202    CARD32  pad20;
203    CARD32  pad24;
204    CARD32  pad28;
205} xDRI3GetSupportedModifiersReply;
206#define sz_xDRI3GetSupportedModifiersReply   32
207
208typedef struct {
209    CARD8   reqType;
210    CARD8   dri3ReqType;
211    CARD16  length;
212    CARD32  pixmap;
213    CARD32  window;
214    CARD8   num_buffers; /* Number of file descriptors passed */
215    CARD8   pad13;
216    CARD16  pad14;
217    CARD16  width;
218    CARD16  height;
219    CARD32  stride0;
220    CARD32  offset0;
221    CARD32  stride1;
222    CARD32  offset1;
223    CARD32  stride2;
224    CARD32  offset2;
225    CARD32  stride3;
226    CARD32  offset3;
227    CARD8   depth;
228    CARD8   bpp;
229    CARD16  pad54;
230    CARD64  modifier;
231} xDRI3PixmapFromBuffersReq;
232#define sz_xDRI3PixmapFromBuffersReq 64
233
234typedef struct {
235    CARD8   reqType;
236    CARD8   dri3ReqType;
237    CARD16  length;
238    CARD32  pixmap;
239} xDRI3BuffersFromPixmapReq;
240#define sz_xDRI3BuffersFromPixmapReq     8
241
242typedef struct {
243    BYTE    type;   /* X_Reply */
244    CARD8   nfd;    /* Number of file descriptors returned */
245    CARD16  sequenceNumber;
246    CARD32  length;
247    CARD16  width;
248    CARD16  height;
249    CARD32  pad12;
250    CARD64  modifier;
251    CARD8   depth;
252    CARD8   bpp;
253    CARD16  pad26;
254    CARD32  pad28;
255} xDRI3BuffersFromPixmapReply;
256#define sz_xDRI3BuffersFromPixmapReply   32
257
258/* v1.3 */
259
260typedef struct {
261    CARD8   reqType;
262    CARD8   dri3ReqType;
263    CARD16  length;
264    CARD32  window;
265    CARD32  drmMajor;
266    CARD32  drmMinor;
267} xDRI3SetDRMDeviceInUseReq;
268#define sz_xDRI3SetDRMDeviceInUseReq    16
269
270/* v1.4 */
271typedef struct {
272    CARD8        reqType;
273    CARD8        dri3ReqType;
274    CARD16       length;
275    DRI3Syncobj  syncobj;
276    CARD32       drawable;
277} xDRI3ImportSyncobjReq;
278#define sz_xDRI3ImportSyncobjReq 12
279
280typedef struct {
281    CARD8        reqType;
282    CARD8        dri3ReqType;
283    CARD16       length;
284    DRI3Syncobj  syncobj;
285} xDRI3FreeSyncobjReq;
286#define sz_xDRI3FreeSyncobjReq 8
287
288#endif
289