1 /**************************************************************************
2 
3 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
4 Copyright 2000 VA Linux Systems, Inc.
5 Copyright (c) 2002, 2008, 2009 Apple Computer, Inc.
6 All Rights Reserved.
7 
8 Permission is hereby granted, free of charge, to any person obtaining a
9 copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sub license, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
15 
16 The above copyright notice and this permission notice (including the
17 next paragraph) shall be included in all copies or substantial portions
18 of the Software.
19 
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
24 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 
28 **************************************************************************/
29 
30 /*
31  * Authors:
32  *   Kevin E. Martin <martin@valinux.com>
33  *   Jens Owen <jens@valinux.com>
34  *   Rickard E. (Rik) Fiath <faith@valinux.com>
35  *
36  */
37 
38 #ifndef _APPLEDRISTR_H_
39 #define _APPLEDRISTR_H_
40 
41 #include "appledri.h"
42 
43 #define APPLEDRINAME "Apple-DRI"
44 
45 #define APPLE_DRI_MAJOR_VERSION	1       /* current version numbers */
46 #define APPLE_DRI_MINOR_VERSION	0
47 #define APPLE_DRI_PATCH_VERSION	0
48 
49 typedef struct _AppleDRIQueryVersion
50 {
51    CARD8 reqType;               /* always DRIReqCode */
52    CARD8 driReqType;            /* always X_DRIQueryVersion */
53    CARD16 length B16;
54 } xAppleDRIQueryVersionReq;
55 #define sz_xAppleDRIQueryVersionReq	4
56 
57 typedef struct
58 {
59    BYTE type;                   /* X_Reply */
60    BOOL pad1;
61    CARD16 sequenceNumber B16;
62    CARD32 length B32;
63    CARD16 majorVersion B16;     /* major version of DRI protocol */
64    CARD16 minorVersion B16;     /* minor version of DRI protocol */
65    CARD32 patchVersion B32;     /* patch version of DRI protocol */
66    CARD32 pad3 B32;
67    CARD32 pad4 B32;
68    CARD32 pad5 B32;
69    CARD32 pad6 B32;
70 } xAppleDRIQueryVersionReply;
71 #define sz_xAppleDRIQueryVersionReply	32
72 
73 typedef struct _AppleDRIQueryDirectRenderingCapable
74 {
75    CARD8 reqType;               /* always DRIReqCode */
76    CARD8 driReqType;            /* X_DRIQueryDirectRenderingCapable */
77    CARD16 length B16;
78    CARD32 screen B32;
79 } xAppleDRIQueryDirectRenderingCapableReq;
80 #define sz_xAppleDRIQueryDirectRenderingCapableReq	8
81 
82 typedef struct
83 {
84    BYTE type;                   /* X_Reply */
85    BOOL pad1;
86    CARD16 sequenceNumber B16;
87    CARD32 length B32;
88    BOOL isCapable;
89    BOOL pad2;
90    BOOL pad3;
91    BOOL pad4;
92    CARD32 pad5 B32;
93    CARD32 pad6 B32;
94    CARD32 pad7 B32;
95    CARD32 pad8 B32;
96    CARD32 pad9 B32;
97 } xAppleDRIQueryDirectRenderingCapableReply;
98 #define sz_xAppleDRIQueryDirectRenderingCapableReply	32
99 
100 typedef struct _AppleDRIAuthConnection
101 {
102    CARD8 reqType;               /* always DRIReqCode */
103    CARD8 driReqType;            /* always X_DRICloseConnection */
104    CARD16 length B16;
105    CARD32 screen B32;
106    CARD32 magic B32;
107 } xAppleDRIAuthConnectionReq;
108 #define sz_xAppleDRIAuthConnectionReq	12
109 
110 typedef struct
111 {
112    BYTE type;
113    BOOL pad1;
114    CARD16 sequenceNumber B16;
115    CARD32 length B32;
116    CARD32 authenticated B32;
117    CARD32 pad2 B32;
118    CARD32 pad3 B32;
119    CARD32 pad4 B32;
120    CARD32 pad5 B32;
121    CARD32 pad6 B32;
122 } xAppleDRIAuthConnectionReply;
123 #define zx_xAppleDRIAuthConnectionReply  32
124 
125 typedef struct _AppleDRICreateSurface
126 {
127    CARD8 reqType;               /* always DRIReqCode */
128    CARD8 driReqType;            /* always X_DRICreateSurface */
129    CARD16 length B16;
130    CARD32 screen B32;
131    CARD32 drawable B32;
132    CARD32 client_id B32;
133 } xAppleDRICreateSurfaceReq;
134 #define sz_xAppleDRICreateSurfaceReq	16
135 
136 typedef struct
137 {
138    BYTE type;                   /* X_Reply */
139    BOOL pad1;
140    CARD16 sequenceNumber B16;
141    CARD32 length B32;
142    CARD32 key_0 B32;
143    CARD32 key_1 B32;
144    CARD32 uid B32;
145    CARD32 pad4 B32;
146    CARD32 pad5 B32;
147    CARD32 pad6 B32;
148 } xAppleDRICreateSurfaceReply;
149 #define sz_xAppleDRICreateSurfaceReply	32
150 
151 typedef struct _AppleDRIDestroySurface
152 {
153    CARD8 reqType;               /* always DRIReqCode */
154    CARD8 driReqType;            /* always X_DRIDestroySurface */
155    CARD16 length B16;
156    CARD32 screen B32;
157    CARD32 drawable B32;
158 } xAppleDRIDestroySurfaceReq;
159 #define sz_xAppleDRIDestroySurfaceReq	12
160 
161 typedef struct _AppleDRINotify
162 {
163    BYTE type;                   /* always eventBase + event type */
164    BYTE kind;
165    CARD16 sequenceNumber B16;
166    CARD32 time B32;             /* time of change */
167    CARD32 pad1 B32;
168    CARD32 arg B32;
169    CARD32 pad3 B32;
170    CARD32 pad4 B32;
171    CARD32 pad5 B32;
172    CARD32 pad6 B32;
173 } xAppleDRINotifyEvent;
174 #define sz_xAppleDRINotifyEvent	32
175 
176 
177 typedef struct
178 {
179    CARD8 reqType;
180    CARD8 driReqType;
181    CARD16 length B16;
182    CARD32 screen B32;
183    CARD32 drawable B32;
184    BOOL doubleSwap;
185    CARD8 pad1, pad2, pad3;
186 } xAppleDRICreateSharedBufferReq;
187 
188 #define sz_xAppleDRICreateSharedBufferReq 16
189 
190 typedef struct
191 {
192    BYTE type;
193    BYTE data1;
194    CARD16 sequenceNumber B16;
195    CARD32 length B32;
196    CARD32 stringLength B32;     /* 0 on error */
197    CARD32 width B32;
198    CARD32 height B32;
199    CARD32 pad1 B32;
200    CARD32 pad2 B32;
201    CARD32 pad3 B32;
202 } xAppleDRICreateSharedBufferReply;
203 
204 #define sz_xAppleDRICreateSharedBufferReply 32
205 
206 typedef struct
207 {
208    CARD8 reqType;
209    CARD8 driReqType;
210    CARD16 length B16;
211    CARD32 screen B32;
212    CARD32 drawable B32;
213 } xAppleDRISwapBuffersReq;
214 
215 #define sz_xAppleDRISwapBuffersReq 12
216 
217 typedef struct
218 {
219    CARD8 reqType;               /*1 */
220    CARD8 driReqType;            /*2 */
221    CARD16 length B16;           /*4 */
222    CARD32 screen B32;           /*8 */
223    CARD32 drawable B32;         /*12 */
224 } xAppleDRICreatePixmapReq;
225 
226 #define sz_xAppleDRICreatePixmapReq 12
227 
228 typedef struct
229 {
230    BYTE type;                   /*1 */
231    BOOL pad1;                   /*2 */
232    CARD16 sequenceNumber B16;   /*4 */
233    CARD32 length B32;           /*8 */
234    CARD32 width B32;            /*12 */
235    CARD32 height B32;           /*16 */
236    CARD32 pitch B32;            /*20 */
237    CARD32 bpp B32;              /*24 */
238    CARD32 size B32;             /*28 */
239    CARD32 stringLength B32;     /*32 */
240 } xAppleDRICreatePixmapReply;
241 
242 #define sz_xAppleDRICreatePixmapReply 32
243 
244 typedef struct
245 {
246    CARD8 reqType;               /*1 */
247    CARD8 driReqType;            /*2 */
248    CARD16 length B16;           /*4 */
249    CARD32 drawable B32;         /*8 */
250 } xAppleDRIDestroyPixmapReq;
251 
252 #define sz_xAppleDRIDestroyPixmapReq 8
253 
254 #ifdef _APPLEDRI_SERVER_
255 
256 void AppleDRISendEvent(
257 #if NeedFunctionPrototypes
258                          int /* type */ ,
259                          unsigned int /* mask */ ,
260                          int /* which */ ,
261                          int    /* arg */
262 #endif
263    );
264 
265 #endif /* _APPLEDRI_SERVER_ */
266 #endif /* _APPLEDRISTR_H_ */
267