appledri.h revision 0594cf70883b64692ba617d85f4f9b4e636e5c2b
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/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
75typedef 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
91Bool XAppleDRIQueryVersion(Display * dpy, int *majorVersion,
92                           int *minorVersion, int *patchVersion);
93
94Bool XAppleDRIQueryDirectRenderingCapable(Display * dpy, int screen,
95                                          Bool * isCapable);
96
97void *XAppleDRISetSurfaceNotifyHandler(void (*fun) (Display * dpy,
98                                                    unsigned uid, int kind));
99
100Bool XAppleDRIAuthConnection(Display * dpy, int screen, unsigned int magic);
101
102Bool XAppleDRICreateSurface(Display * dpy, int screen, Drawable drawable,
103                            unsigned int client_id, unsigned int key[2],
104                            unsigned int *uid);
105
106Bool XAppleDRIDestroySurface(Display * dpy, int screen, Drawable drawable);
107
108Bool XAppleDRISynchronizeSurfaces(Display * dpy);
109
110Bool XAppleDRICreateSharedBuffer(Display * dpy, int screen, Drawable drawable,
111                                 Bool doubleSwap, char *path, size_t pathlen,
112                                 int *width, int *height);
113
114Bool XAppleDRISwapBuffers(Display * dpy, int screen, Drawable drawable);
115
116Bool 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
120Bool XAppleDRIDestroyPixmap(Display * dpy, Pixmap pixmap);
121
122_XFUNCPROTOEND
123#endif /* _APPLEDRI_SERVER_ */
124#endif /* _APPLEDRI_H_ */
125