1 /*
2  * Copyright © 2008 Red Hat, Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Soft-
6  * ware"), to deal in the Software without restriction, including without
7  * limitation the rights to use, copy, modify, merge, publish, distribute,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, provided that the above copyright
10  * notice(s) and this permission notice appear in all copies of the Soft-
11  * ware and that both the above copyright notice(s) and this permission
12  * notice appear in supporting documentation.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
16  * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
17  * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
18  * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
19  * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
22  * MANCE OF THIS SOFTWARE.
23  *
24  * Except as contained in this notice, the name of a copyright holder shall
25  * not be used in advertising or otherwise to promote the sale, use or
26  * other dealings in this Software without prior written authorization of
27  * the copyright holder.
28  *
29  * Authors:
30  *   Kristian Høgsberg (krh@redhat.com)
31  */
32 
33 #ifndef _DRI2_PROTO_H_
34 #define _DRI2_PROTO_H_
35 
36 #define DRI2_NAME			"DRI2"
37 #define DRI2_MAJOR			1
38 #define DRI2_MINOR			4
39 
40 #define DRI2NumberErrors		0
41 #define DRI2NumberEvents		2
42 #define DRI2NumberRequests		14
43 
44 #define X_DRI2QueryVersion		0
45 #define X_DRI2Connect			1
46 #define X_DRI2Authenticate		2
47 #define X_DRI2CreateDrawable		3
48 #define X_DRI2DestroyDrawable		4
49 #define X_DRI2GetBuffers		5
50 #define X_DRI2CopyRegion		6
51 #define X_DRI2GetBuffersWithFormat	7
52 #define X_DRI2SwapBuffers		8
53 #define X_DRI2GetMSC			9
54 #define X_DRI2WaitMSC			10
55 #define X_DRI2WaitSBC			11
56 #define X_DRI2SwapInterval		12
57 #define X_DRI2GetParam			13
58 
59 /*
60  * Events
61  */
62 #define DRI2_BufferSwapComplete	0
63 #define DRI2_InvalidateBuffers	1
64 
65 typedef struct {
66     CARD32  attachment;
67     CARD32  name;
68     CARD32  pitch;
69     CARD32  cpp;
70     CARD32  flags;
71 } xDRI2Buffer;
72 
73 typedef struct {
74     CARD8   reqType;
75     CARD8   dri2ReqType;
76     CARD16  length;
77     CARD32  majorVersion;
78     CARD32  minorVersion;
79 } xDRI2QueryVersionReq;
80 #define sz_xDRI2QueryVersionReq   12
81 
82 typedef struct {
83     BYTE    type;   /* X_Reply */
84     BYTE    pad1;
85     CARD16  sequenceNumber;
86     CARD32  length;
87     CARD32  majorVersion;
88     CARD32  minorVersion;
89     CARD32  pad2;
90     CARD32  pad3;
91     CARD32  pad4;
92     CARD32  pad5;
93 } xDRI2QueryVersionReply;
94 #define sz_xDRI2QueryVersionReply	32
95 
96 typedef struct {
97     CARD8   reqType;
98     CARD8   dri2ReqType;
99     CARD16  length;
100     CARD32  window;
101     CARD32  driverType;
102 } xDRI2ConnectReq;
103 #define sz_xDRI2ConnectReq	12
104 
105 typedef struct {
106     BYTE    type;   /* X_Reply */
107     BYTE    pad1;
108     CARD16  sequenceNumber;
109     CARD32  length;
110     CARD32  driverNameLength;
111     CARD32  deviceNameLength;
112     CARD32  pad2;
113     CARD32  pad3;
114     CARD32  pad4;
115     CARD32  pad5;
116 } xDRI2ConnectReply;
117 #define sz_xDRI2ConnectReply	32
118 
119 typedef struct {
120     CARD8   reqType;
121     CARD8   dri2ReqType;
122     CARD16  length;
123     CARD32  window;
124     CARD32  magic;
125 } xDRI2AuthenticateReq;
126 #define sz_xDRI2AuthenticateReq   12
127 
128 typedef struct {
129     BYTE    type;   /* X_Reply */
130     BYTE    pad1;
131     CARD16  sequenceNumber;
132     CARD32  length;
133     CARD32  authenticated;
134     CARD32  pad2;
135     CARD32  pad3;
136     CARD32  pad4;
137     CARD32  pad5;
138     CARD32  pad6;
139 } xDRI2AuthenticateReply;
140 #define sz_xDRI2AuthenticateReply	32
141 
142 typedef struct {
143     CARD8   reqType;
144     CARD8   dri2ReqType;
145     CARD16  length;
146     CARD32  drawable;
147 } xDRI2CreateDrawableReq;
148 #define sz_xDRI2CreateDrawableReq   8
149 
150 typedef struct {
151     CARD8   reqType;
152     CARD8   dri2ReqType;
153     CARD16  length;
154     CARD32  drawable;
155 } xDRI2DestroyDrawableReq;
156 #define sz_xDRI2DestroyDrawableReq   8
157 
158 typedef struct {
159     CARD8   reqType;
160     CARD8   dri2ReqType;
161     CARD16  length;
162     CARD32  drawable;
163     CARD32  count;
164 } xDRI2GetBuffersReq;
165 #define sz_xDRI2GetBuffersReq   12
166 
167 typedef struct {
168     BYTE    type;   /* X_Reply */
169     BYTE    pad1;
170     CARD16  sequenceNumber;
171     CARD32  length;
172     CARD32  width;
173     CARD32  height;
174     CARD32  count;
175     CARD32  pad2;
176     CARD32  pad3;
177     CARD32  pad4;
178 } xDRI2GetBuffersReply;
179 #define sz_xDRI2GetBuffersReply	32
180 
181 typedef struct {
182     CARD8   reqType;
183     CARD8   dri2ReqType;
184     CARD16  length;
185     CARD32  drawable;
186     CARD32  region;
187     CARD32  dest;
188     CARD32  src;
189 } xDRI2CopyRegionReq;
190 #define sz_xDRI2CopyRegionReq   20
191 
192 typedef struct {
193     BYTE    type;   /* X_Reply */
194     BYTE    pad1;
195     CARD16  sequenceNumber;
196     CARD32  length;
197     CARD32  pad2;
198     CARD32  pad3;
199     CARD32  pad4;
200     CARD32  pad5;
201     CARD32  pad6;
202     CARD32  pad7;
203 } xDRI2CopyRegionReply;
204 #define sz_xDRI2CopyRegionReply	32
205 
206 typedef struct {
207     CARD8   reqType;
208     CARD8   dri2ReqType;
209     CARD16  length;
210     CARD32  drawable;
211     CARD32  target_msc_hi;
212     CARD32  target_msc_lo;
213     CARD32  divisor_hi;
214     CARD32  divisor_lo;
215     CARD32  remainder_hi;
216     CARD32  remainder_lo;
217 } xDRI2SwapBuffersReq;
218 #define sz_xDRI2SwapBuffersReq  32
219 
220 typedef struct {
221     BYTE    type;   /* X_Reply */
222     BYTE    pad1;
223     CARD16  sequenceNumber;
224     CARD32  length;
225     CARD32  swap_hi;
226     CARD32  swap_lo;
227     CARD32  pad2;
228     CARD32  pad3;
229     CARD32  pad4;
230     CARD32  pad5;
231 } xDRI2SwapBuffersReply;
232 #define sz_xDRI2SwapBuffersReply 32
233 
234 typedef struct {
235     CARD8   reqType;
236     CARD8   dri2ReqType;
237     CARD16  length;
238     CARD32  drawable;
239 } xDRI2GetMSCReq;
240 #define sz_xDRI2GetMSCReq 8
241 
242 typedef struct {
243     CARD8   reqType;
244     CARD8   dri2ReqType;
245     CARD16  length;
246     CARD32  drawable;
247     CARD32  target_msc_hi;
248     CARD32  target_msc_lo;
249     CARD32  divisor_hi;
250     CARD32  divisor_lo;
251     CARD32  remainder_hi;
252     CARD32  remainder_lo;
253 } xDRI2WaitMSCReq;
254 #define sz_xDRI2WaitMSCReq 32
255 
256 typedef struct {
257     CARD8   reqType;
258     CARD8   dri2ReqType;
259     CARD16  length;
260     CARD32  drawable;
261     CARD32  target_sbc_hi;
262     CARD32  target_sbc_lo;
263 } xDRI2WaitSBCReq;
264 #define sz_xDRI2WaitSBCReq 16
265 
266 typedef struct {
267     CARD8   type;
268     CARD8   pad1;
269     CARD16  sequenceNumber;
270     CARD32  length;
271     CARD32  ust_hi;
272     CARD32  ust_lo;
273     CARD32  msc_hi;
274     CARD32  msc_lo;
275     CARD32  sbc_hi;
276     CARD32  sbc_lo;
277 } xDRI2MSCReply;
278 #define sz_xDRI2MSCReply 32
279 
280 typedef struct {
281     CARD8   reqType;
282     CARD8   dri2ReqType;
283     CARD16  length;
284     CARD32  drawable;
285     CARD32  interval;
286 } xDRI2SwapIntervalReq;
287 #define sz_xDRI2SwapIntervalReq 12
288 
289 typedef struct {
290     CARD8 type;
291     CARD8 pad;
292     CARD16 sequenceNumber;
293     CARD16 event_type;
294     CARD16 pad2;
295     CARD32 drawable;
296     CARD32 ust_hi;
297     CARD32 ust_lo;
298     CARD32 msc_hi;
299     CARD32 msc_lo;
300     CARD32 sbc_hi;
301     CARD32 sbc_lo;
302 } xDRI2BufferSwapComplete;
303 #define sz_xDRI2BufferSwapComplete 32
304 
305 typedef struct {
306     CARD8 type;
307     CARD8 pad;
308     CARD16 sequenceNumber;
309     CARD16 event_type;
310     CARD16 pad2;
311     CARD32 drawable;
312     CARD32 ust_hi;
313     CARD32 ust_lo;
314     CARD32 msc_hi;
315     CARD32 msc_lo;
316     CARD32 sbc;
317 } xDRI2BufferSwapComplete2;
318 #define sz_xDRI2BufferSwapComplete2 32
319 
320 typedef struct {
321     CARD8 type;
322     CARD8 pad;
323     CARD16 sequenceNumber;
324     CARD32 drawable;
325     CARD32 pad1;
326     CARD32 pad2;
327     CARD32 pad3;
328     CARD32 pad4;
329     CARD32 pad5;
330     CARD32 pad6;
331 } xDRI2InvalidateBuffers;
332 #define sz_xDRI2InvalidateBuffers 32
333 
334 typedef struct {
335     CARD8   reqType;
336     CARD8   dri2ReqType;
337     CARD16  length;
338     CARD32  drawable;
339     CARD32  param;
340 } xDRI2GetParamReq;
341 #define sz_xDRI2GetParamReq 12
342 
343 typedef struct {
344     BYTE    type; /*X_Reply*/
345     BOOL    is_param_recognized;
346     CARD16  sequenceNumber;
347     CARD32  length;
348     CARD32  value_hi;
349     CARD32  value_lo;
350     CARD32  pad1;
351     CARD32  pad2;
352     CARD32  pad3;
353     CARD32  pad4;
354 } xDRI2GetParamReply;
355 #define sz_xDRI2GetParamReply 32
356 
357 #endif
358