1/**************************************************************************
2
3   Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
4   Copyright 2000 VA Linux Systems, Inc.
5   Copyright (c) 2002-2012 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 *   Jeremy Huddleston <jeremyhu@apple.com>
36 *
37 */
38
39#ifndef _APPLEDRISTR_H_
40#define _APPLEDRISTR_H_
41
42#include "appledri.h"
43
44#define APPLEDRINAME            "Apple-DRI"
45
46#define APPLE_DRI_MAJOR_VERSION 1       /* current version numbers */
47#define APPLE_DRI_MINOR_VERSION 0
48#define APPLE_DRI_PATCH_VERSION 0
49
50typedef struct _AppleDRIQueryVersion {
51    CARD8 reqType;               /* always DRIReqCode */
52    CARD8 driReqType;            /* always X_DRIQueryVersion */
53    CARD16 length;
54} xAppleDRIQueryVersionReq;
55#define sz_xAppleDRIQueryVersionReq 4
56
57typedef struct {
58    BYTE type;                   /* X_Reply */
59    BOOL pad1;
60    CARD16 sequenceNumber;
61    CARD32 length;
62    CARD16 majorVersion;         /* major version of DRI protocol */
63    CARD16 minorVersion;         /* minor version of DRI protocol */
64    CARD32 patchVersion;         /* patch version of DRI protocol */
65    CARD32 pad3;
66    CARD32 pad4;
67    CARD32 pad5;
68    CARD32 pad6;
69} xAppleDRIQueryVersionReply;
70#define sz_xAppleDRIQueryVersionReply 32
71
72typedef struct _AppleDRIQueryDirectRenderingCapable {
73    CARD8 reqType;               /* always DRIReqCode */
74    CARD8 driReqType;            /* X_DRIQueryDirectRenderingCapable */
75    CARD16 length;
76    CARD32 screen;
77} xAppleDRIQueryDirectRenderingCapableReq;
78#define sz_xAppleDRIQueryDirectRenderingCapableReq 8
79
80typedef struct {
81    BYTE type;                   /* X_Reply */
82    BOOL pad1;
83    CARD16 sequenceNumber;
84    CARD32 length;
85    BOOL isCapable;
86    BOOL pad2;
87    BOOL pad3;
88    BOOL pad4;
89    CARD32 pad5;
90    CARD32 pad6;
91    CARD32 pad7;
92    CARD32 pad8;
93    CARD32 pad9;
94} xAppleDRIQueryDirectRenderingCapableReply;
95#define sz_xAppleDRIQueryDirectRenderingCapableReply 32
96
97typedef struct _AppleDRIAuthConnection {
98    CARD8 reqType;               /* always DRIReqCode */
99    CARD8 driReqType;            /* always X_DRICloseConnection */
100    CARD16 length;
101    CARD32 screen;
102    CARD32 magic;
103} xAppleDRIAuthConnectionReq;
104#define sz_xAppleDRIAuthConnectionReq 12
105
106typedef struct {
107    BYTE type;
108    BOOL pad1;
109    CARD16 sequenceNumber;
110    CARD32 length;
111    CARD32 authenticated;
112    CARD32 pad2;
113    CARD32 pad3;
114    CARD32 pad4;
115    CARD32 pad5;
116    CARD32 pad6;
117} xAppleDRIAuthConnectionReply;
118#define zx_xAppleDRIAuthConnectionReply 32
119
120typedef struct _AppleDRICreateSurface {
121    CARD8 reqType;               /* always DRIReqCode */
122    CARD8 driReqType;            /* always X_DRICreateSurface */
123    CARD16 length;
124    CARD32 screen;
125    CARD32 drawable;
126    CARD32 client_id;
127} xAppleDRICreateSurfaceReq;
128#define sz_xAppleDRICreateSurfaceReq 16
129
130typedef struct {
131    BYTE type;                   /* X_Reply */
132    BOOL pad1;
133    CARD16 sequenceNumber;
134    CARD32 length;
135    CARD32 key_0;
136    CARD32 key_1;
137    CARD32 uid;
138    CARD32 pad4;
139    CARD32 pad5;
140    CARD32 pad6;
141} xAppleDRICreateSurfaceReply;
142#define sz_xAppleDRICreateSurfaceReply 32
143
144typedef struct _AppleDRIDestroySurface {
145    CARD8 reqType;               /* always DRIReqCode */
146    CARD8 driReqType;            /* always X_DRIDestroySurface */
147    CARD16 length;
148    CARD32 screen;
149    CARD32 drawable;
150} xAppleDRIDestroySurfaceReq;
151#define sz_xAppleDRIDestroySurfaceReq 12
152
153typedef struct _AppleDRINotify {
154    BYTE type;                   /* always eventBase + event type */
155    BYTE kind;
156    CARD16 sequenceNumber;
157    CARD32 time;                 /* time of change */
158    CARD32 pad1;
159    CARD32 arg;
160    CARD32 pad3;
161    CARD32 pad4;
162    CARD32 pad5;
163    CARD32 pad6;
164} xAppleDRINotifyEvent;
165#define sz_xAppleDRINotifyEvent 32
166
167typedef struct {
168    CARD8 reqType;
169    CARD8 driReqType;
170    CARD16 length;
171    CARD32 screen;
172    CARD32 drawable;
173    BOOL doubleSwap;
174    CARD8 pad1, pad2, pad3;
175} xAppleDRICreateSharedBufferReq;
176
177#define sz_xAppleDRICreateSharedBufferReq 16
178
179typedef struct {
180    BYTE type;
181    BYTE data1;
182    CARD16 sequenceNumber;
183    CARD32 length;
184    CARD32 stringLength;         /* 0 on error */
185    CARD32 width;
186    CARD32 height;
187    CARD32 pad1;
188    CARD32 pad2;
189    CARD32 pad3;
190} xAppleDRICreateSharedBufferReply;
191
192#define sz_xAppleDRICreateSharedBufferReply 32
193
194typedef struct {
195    CARD8 reqType;
196    CARD8 driReqType;
197    CARD16 length;
198    CARD32 screen;
199    CARD32 drawable;
200} xAppleDRISwapBuffersReq;
201
202#define sz_xAppleDRISwapBuffersReq 12
203
204typedef struct {
205    CARD8 reqType;               /*1 */
206    CARD8 driReqType;            /*2 */
207    CARD16 length;               /*4 */
208    CARD32 screen;               /*8 */
209    CARD32 drawable;             /*12 */
210} xAppleDRICreatePixmapReq;
211
212#define sz_xAppleDRICreatePixmapReq 12
213
214typedef struct {
215    BYTE type;                   /*1 */
216    BOOL pad1;                   /*2 */
217    CARD16 sequenceNumber;       /*4 */
218    CARD32 length;               /*8 */
219    CARD32 width;                /*12 */
220    CARD32 height;               /*16 */
221    CARD32 pitch;                /*20 */
222    CARD32 bpp;                  /*24 */
223    CARD32 size;                 /*28 */
224    CARD32 stringLength;         /*32 */
225} xAppleDRICreatePixmapReply;
226
227#define sz_xAppleDRICreatePixmapReply 32
228
229typedef struct {
230    CARD8 reqType;               /*1 */
231    CARD8 driReqType;            /*2 */
232    CARD16 length;               /*4 */
233    CARD32 drawable;             /*8 */
234} xAppleDRIDestroyPixmapReq;
235
236#define sz_xAppleDRIDestroyPixmapReq 8
237
238#ifdef _APPLEDRI_SERVER_
239
240void AppleDRISendEvent(
241#if NeedFunctionPrototypes
242    int /* type */,
243    unsigned int /* mask */,
244    int /* which */,
245    int                       /* arg */
246#endif
247    );
248
249#endif /* _APPLEDRI_SERVER_ */
250#endif /* _APPLEDRISTR_H_ */
251