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			2
39
40#define DRI2NumberErrors		0
41#define DRI2NumberEvents		2
42#define DRI2NumberRequests		13
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
58typedef struct {
59    CARD32  attachment B32;
60    CARD32  name B32;
61    CARD32  pitch B32;
62    CARD32  cpp B32;
63    CARD32  flags B32;
64} xDRI2Buffer;
65
66typedef struct {
67    CARD8   reqType;
68    CARD8   dri2ReqType;
69    CARD16  length B16;
70    CARD32  majorVersion B32;
71    CARD32  minorVersion B32;
72} xDRI2QueryVersionReq;
73#define sz_xDRI2QueryVersionReq   12
74
75typedef struct {
76    BYTE    type;   /* X_Reply */
77    BYTE    pad1;
78    CARD16  sequenceNumber B16;
79    CARD32  length B32;
80    CARD32  majorVersion B32;
81    CARD32  minorVersion B32;
82    CARD32  pad2 B32;
83    CARD32  pad3 B32;
84    CARD32  pad4 B32;
85    CARD32  pad5 B32;
86} xDRI2QueryVersionReply;
87#define sz_xDRI2QueryVersionReply	32
88
89typedef struct {
90    CARD8   reqType;
91    CARD8   dri2ReqType;
92    CARD16  length B16;
93    CARD32  window B32;
94    CARD32  driverType B32;
95} xDRI2ConnectReq;
96#define sz_xDRI2ConnectReq	12
97
98typedef struct {
99    BYTE    type;   /* X_Reply */
100    BYTE    pad1;
101    CARD16  sequenceNumber B16;
102    CARD32  length B32;
103    CARD32  driverNameLength B32;
104    CARD32  deviceNameLength B32;
105    CARD32  pad2 B32;
106    CARD32  pad3 B32;
107    CARD32  pad4 B32;
108    CARD32  pad5 B32;
109} xDRI2ConnectReply;
110#define sz_xDRI2ConnectReply	32
111
112typedef struct {
113    CARD8   reqType;
114    CARD8   dri2ReqType;
115    CARD16  length B16;
116    CARD32  window B32;
117    CARD32  magic B32;
118} xDRI2AuthenticateReq;
119#define sz_xDRI2AuthenticateReq   12
120
121typedef struct {
122    BYTE    type;   /* X_Reply */
123    BYTE    pad1;
124    CARD16  sequenceNumber B16;
125    CARD32  length B32;
126    CARD32  authenticated B32;
127    CARD32  pad2 B32;
128    CARD32  pad3 B32;
129    CARD32  pad4 B32;
130    CARD32  pad5 B32;
131    CARD32  pad6 B32;
132} xDRI2AuthenticateReply;
133#define sz_xDRI2AuthenticateReply	32
134
135typedef struct {
136    CARD8   reqType;
137    CARD8   dri2ReqType;
138    CARD16  length B16;
139    CARD32  drawable B32;
140} xDRI2CreateDrawableReq;
141#define sz_xDRI2CreateDrawableReq   8
142
143typedef struct {
144    CARD8   reqType;
145    CARD8   dri2ReqType;
146    CARD16  length B16;
147    CARD32  drawable B32;
148} xDRI2DestroyDrawableReq;
149#define sz_xDRI2DestroyDrawableReq   8
150
151typedef struct {
152    CARD8   reqType;
153    CARD8   dri2ReqType;
154    CARD16  length B16;
155    CARD32  drawable B32;
156    CARD32  count B32;
157} xDRI2GetBuffersReq;
158#define sz_xDRI2GetBuffersReq   12
159
160typedef struct {
161    BYTE    type;   /* X_Reply */
162    BYTE    pad1;
163    CARD16  sequenceNumber B16;
164    CARD32  length B32;
165    CARD32  width B32;
166    CARD32  height B32;
167    CARD32  count B32;
168    CARD32  pad2 B32;
169    CARD32  pad3 B32;
170    CARD32  pad4 B32;
171} xDRI2GetBuffersReply;
172#define sz_xDRI2GetBuffersReply	32
173
174typedef struct {
175    CARD8   reqType;
176    CARD8   dri2ReqType;
177    CARD16  length B16;
178    CARD32  drawable B32;
179    CARD32  region B32;
180    CARD32  dest B32;
181    CARD32  src B32;
182} xDRI2CopyRegionReq;
183#define sz_xDRI2CopyRegionReq   20
184
185typedef struct {
186    BYTE    type;   /* X_Reply */
187    BYTE    pad1;
188    CARD16  sequenceNumber B16;
189    CARD32  length B32;
190    CARD32  pad2 B32;
191    CARD32  pad3 B32;
192    CARD32  pad4 B32;
193    CARD32  pad5 B32;
194    CARD32  pad6 B32;
195    CARD32  pad7 B32;
196} xDRI2CopyRegionReply;
197#define sz_xDRI2CopyRegionReply	32
198
199typedef struct {
200    CARD8   reqType;
201    CARD8   dri2ReqType;
202    CARD16  length B16;
203    CARD32  drawable B32;
204    CARD32  target_msc_hi B32;
205    CARD32  target_msc_lo B32;
206    CARD32  divisor_hi B32;
207    CARD32  divisor_lo B32;
208    CARD32  remainder_hi B32;
209    CARD32  remainder_lo B32;
210} xDRI2SwapBuffersReq;
211#define sz_xDRI2SwapBuffersReq  32
212
213typedef struct {
214    BYTE    type;   /* X_Reply */
215    BYTE    pad1;
216    CARD16  sequenceNumber B16;
217    CARD32  length B32;
218    CARD32  swap_hi B32;
219    CARD32  swap_lo B32;
220    CARD32  pad2 B32;
221    CARD32  pad3 B32;
222    CARD32  pad4 B32;
223    CARD32  pad5 B32;
224} xDRI2SwapBuffersReply;
225#define sz_xDRI2SwapBuffersReply 32
226
227#endif
228