1 /* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
2 /**************************************************************************
3 
4 Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
5 Copyright 2000 VA Linux Systems, Inc.
6 Copyright (c) 2002, 2008, 2009 Apple Computer, Inc.
7 All Rights Reserved.
8 
9 Permission is hereby granted, free of charge, to any person obtaining a
10 copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sub license, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16 
17 The above copyright notice and this permission notice (including the
18 next paragraph) shall be included in all copies or substantial portions
19 of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
24 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
25 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 
29 **************************************************************************/
30 
31 /*
32  * Authors:
33  *   Kevin E. Martin <martin@valinux.com>
34  *   Jens Owen <jens@valinux.com>
35  *   Rickard E. (Rik) Faith <faith@valinux.com>
36  *
37  */
38 
39 #ifndef _APPLEDRI_H_
40 #define _APPLEDRI_H_
41 
42 #include <X11/Xlib.h>
43 #include <X11/Xfuncproto.h>
44 
45 #define X_AppleDRIQueryVersion			0
46 #define X_AppleDRIQueryDirectRenderingCapable	1
47 #define X_AppleDRICreateSurface			2
48 #define X_AppleDRIDestroySurface		3
49 #define X_AppleDRIAuthConnection                4
50 #define X_AppleDRICreateSharedBuffer            5
51 #define X_AppleDRISwapBuffers                   6
52 #define X_AppleDRICreatePixmap                  7
53 #define X_AppleDRIDestroyPixmap                 8
54 
55 /* Requests up to and including 18 were used in a previous version */
56 
57 /* Events */
58 #define AppleDRIObsoleteEvent1		0
59 #define AppleDRIObsoleteEvent2		1
60 #define AppleDRIObsoleteEvent3		2
61 #define AppleDRISurfaceNotify		3
62 #define AppleDRINumberEvents		4
63 
64 /* Errors */
65 #define AppleDRIClientNotLocal		0
66 #define AppleDRIOperationNotSupported	1
67 #define AppleDRINumberErrors		(AppleDRIOperationNotSupported + 1)
68 
69 /* Kinds of SurfaceNotify events: */
70 #define AppleDRISurfaceNotifyChanged	0
71 #define AppleDRISurfaceNotifyDestroyed	1
72 
73 #ifndef _APPLEDRI_SERVER_
74 
75 typedef struct
76 {
77    int type;                    /* of event */
78    unsigned long serial;        /* # of last request processed by server */
79    Bool send_event;             /* true if this came frome a SendEvent request */
80    Display *display;            /* Display the event was read from */
81    Window window;               /* window of event */
82    Time time;                   /* server timestamp when event happened */
83    int kind;                    /* subtype of event */
84    int arg;
85 } XAppleDRINotifyEvent;
86 
87 _XFUNCPROTOBEGIN
88    Bool XAppleDRIQueryExtension(Display * dpy, int *event_base,
89                                 int *error_base);
90 
91 Bool XAppleDRIQueryVersion(Display * dpy, int *majorVersion,
92                            int *minorVersion, int *patchVersion);
93 
94 Bool XAppleDRIQueryDirectRenderingCapable(Display * dpy, int screen,
95                                           Bool * isCapable);
96 
97 void *XAppleDRISetSurfaceNotifyHandler(void (*fun) (Display * dpy,
98                                                     unsigned uid, int kind));
99 
100 Bool XAppleDRIAuthConnection(Display * dpy, int screen, unsigned int magic);
101 
102 Bool XAppleDRICreateSurface(Display * dpy, int screen, Drawable drawable,
103                             unsigned int client_id, unsigned int key[2],
104                             unsigned int *uid);
105 
106 Bool XAppleDRIDestroySurface(Display * dpy, int screen, Drawable drawable);
107 
108 Bool XAppleDRISynchronizeSurfaces(Display * dpy);
109 
110 Bool XAppleDRICreateSharedBuffer(Display * dpy, int screen, Drawable drawable,
111                                  Bool doubleSwap, char *path, size_t pathlen,
112                                  int *width, int *height);
113 
114 Bool XAppleDRISwapBuffers(Display * dpy, int screen, Drawable drawable);
115 
116 Bool XAppleDRICreatePixmap(Display * dpy, int screen, Drawable drawable,
117                            int *width, int *height, int *pitch, int *bpp,
118                            size_t * size, char *bufname, size_t bufnamesize);
119 
120 Bool XAppleDRIDestroyPixmap(Display * dpy, Pixmap pixmap);
121 
122 _XFUNCPROTOEND
123 #endif /* _APPLEDRI_SERVER_ */
124 #endif /* _APPLEDRI_H_ */
125