xref: /OK3568_Linux_fs/external/xserver/hw/xquartz/xpr/appledri.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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-2012 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  *   Jeremy Huddleston <jeremyhu@apple.com>
37  *
38  */
39 
40 #ifndef _APPLEDRI_H_
41 #define _APPLEDRI_H_
42 
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     int type;               /* of event */
77     unsigned long serial;   /* # of last request processed by server */
78     Bool send_event;        /* true if this came frome a SendEvent request */
79     Display *display;       /* Display the event was read from */
80     Window window;          /* window of event */
81     Time time;              /* server timestamp when event happened */
82     int kind;               /* subtype of event */
83     int arg;
84 } XAppleDRINotifyEvent;
85 
86 _XFUNCPROTOBEGIN
87 
88 Bool
89 XAppleDRIQueryExtension(Display *dpy, int *event_base, int *error_base);
90 
91 Bool
92 XAppleDRIQueryVersion(Display *dpy, int *majorVersion, int *minorVersion,
93                       int *patchVersion);
94 
95 Bool
96 XAppleDRIQueryDirectRenderingCapable(Display *dpy, int screen,
97                                      Bool *isCapable);
98 
99 void *
100 XAppleDRISetSurfaceNotifyHandler(void (*fun)(Display *dpy, unsigned uid,
101                                              int kind));
102 
103 Bool
104 XAppleDRIAuthConnection(Display *dpy, int screen, unsigned int magic);
105 
106 Bool XAppleDRICreateSurface(Display * dpy, int screen, Drawable drawable,
107                             unsigned int client_id, unsigned int key[2],
108                             unsigned int* uid);
109 
110 Bool
111 XAppleDRIDestroySurface(Display *dpy, int screen, Drawable drawable);
112 
113 Bool
114 XAppleDRISynchronizeSurfaces(Display *dpy);
115 
116 Bool
117 XAppleDRICreateSharedBuffer(Display *dpy, int screen, Drawable drawable,
118                             Bool doubleSwap, char *path, size_t pathlen,
119                             int *width,
120                             int *height);
121 
122 Bool
123 XAppleDRISwapBuffers(Display *dpy, int screen, Drawable drawable);
124 
125 Bool
126 XAppleDRICreatePixmap(Display *dpy, int screen, Drawable drawable, int *width,
127                       int *height, int *pitch, int *bpp, size_t *size,
128                       char *bufname,
129                       size_t bufnamesize);
130 
131 Bool
132 XAppleDRIDestroyPixmap(Display *dpy, Pixmap pixmap);
133 
134 _XFUNCPROTOEND
135 
136 #endif /* _APPLEDRI_SERVER_ */
137 #endif /* _APPLEDRI_H_ */
138