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