1848b8605Smrg/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
2848b8605Smrg/**************************************************************************
3848b8605Smrg
4848b8605SmrgCopyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
5848b8605SmrgCopyright 2000 VA Linux Systems, Inc.
6848b8605SmrgCopyright (c) 2002, 2008, 2009 Apple Computer, Inc.
7848b8605SmrgAll Rights Reserved.
8848b8605Smrg
9848b8605SmrgPermission is hereby granted, free of charge, to any person obtaining a
10848b8605Smrgcopy of this software and associated documentation files (the
11848b8605Smrg"Software"), to deal in the Software without restriction, including
12848b8605Smrgwithout limitation the rights to use, copy, modify, merge, publish,
13848b8605Smrgdistribute, sub license, and/or sell copies of the Software, and to
14848b8605Smrgpermit persons to whom the Software is furnished to do so, subject to
15848b8605Smrgthe following conditions:
16848b8605Smrg
17848b8605SmrgThe above copyright notice and this permission notice (including the
18848b8605Smrgnext paragraph) shall be included in all copies or substantial portions
19848b8605Smrgof the Software.
20848b8605Smrg
21848b8605SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22848b8605SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23848b8605SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
24848b8605SmrgIN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
25848b8605SmrgANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26848b8605SmrgTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27848b8605SmrgSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28848b8605Smrg
29848b8605Smrg**************************************************************************/
30848b8605Smrg
31848b8605Smrg/*
32848b8605Smrg * Authors:
33848b8605Smrg *   Kevin E. Martin <martin@valinux.com>
34848b8605Smrg *   Jens Owen <jens@valinux.com>
35848b8605Smrg *   Rickard E. (Rik) Faith <faith@valinux.com>
36848b8605Smrg *
37848b8605Smrg */
38848b8605Smrg
39848b8605Smrg#ifndef _APPLEDRI_H_
40848b8605Smrg#define _APPLEDRI_H_
41848b8605Smrg
42848b8605Smrg#include <X11/Xlib.h>
43848b8605Smrg#include <X11/Xfuncproto.h>
44848b8605Smrg
45848b8605Smrg#define X_AppleDRIQueryVersion			0
46848b8605Smrg#define X_AppleDRIQueryDirectRenderingCapable	1
47848b8605Smrg#define X_AppleDRICreateSurface			2
48848b8605Smrg#define X_AppleDRIDestroySurface		3
49848b8605Smrg#define X_AppleDRIAuthConnection                4
50848b8605Smrg#define X_AppleDRICreateSharedBuffer            5
51848b8605Smrg#define X_AppleDRISwapBuffers                   6
52848b8605Smrg#define X_AppleDRICreatePixmap                  7
53848b8605Smrg#define X_AppleDRIDestroyPixmap                 8
54848b8605Smrg
55848b8605Smrg/* Requests up to and including 18 were used in a previous version */
56848b8605Smrg
57848b8605Smrg/* Events */
58848b8605Smrg#define AppleDRIObsoleteEvent1		0
59848b8605Smrg#define AppleDRIObsoleteEvent2		1
60848b8605Smrg#define AppleDRIObsoleteEvent3		2
61848b8605Smrg#define AppleDRISurfaceNotify		3
62848b8605Smrg#define AppleDRINumberEvents		4
63848b8605Smrg
64848b8605Smrg/* Errors */
65848b8605Smrg#define AppleDRIClientNotLocal		0
66848b8605Smrg#define AppleDRIOperationNotSupported	1
67848b8605Smrg#define AppleDRINumberErrors		(AppleDRIOperationNotSupported + 1)
68848b8605Smrg
69848b8605Smrg/* Kinds of SurfaceNotify events: */
70848b8605Smrg#define AppleDRISurfaceNotifyChanged	0
71848b8605Smrg#define AppleDRISurfaceNotifyDestroyed	1
72848b8605Smrg
73848b8605Smrg#ifndef _APPLEDRI_SERVER_
74848b8605Smrg
75848b8605Smrgtypedef struct
76848b8605Smrg{
77848b8605Smrg   int type;                    /* of event */
78848b8605Smrg   unsigned long serial;        /* # of last request processed by server */
79848b8605Smrg   Bool send_event;             /* true if this came frome a SendEvent request */
80848b8605Smrg   Display *display;            /* Display the event was read from */
81848b8605Smrg   Window window;               /* window of event */
82848b8605Smrg   Time time;                   /* server timestamp when event happened */
83848b8605Smrg   int kind;                    /* subtype of event */
84848b8605Smrg   int arg;
85848b8605Smrg} XAppleDRINotifyEvent;
86848b8605Smrg
87848b8605Smrg_XFUNCPROTOBEGIN
88848b8605Smrg   Bool XAppleDRIQueryExtension(Display * dpy, int *event_base,
89848b8605Smrg                                int *error_base);
90848b8605Smrg
91848b8605SmrgBool XAppleDRIQueryVersion(Display * dpy, int *majorVersion,
92848b8605Smrg                           int *minorVersion, int *patchVersion);
93848b8605Smrg
94848b8605SmrgBool XAppleDRIQueryDirectRenderingCapable(Display * dpy, int screen,
95848b8605Smrg                                          Bool * isCapable);
96848b8605Smrg
97848b8605Smrgvoid *XAppleDRISetSurfaceNotifyHandler(void (*fun) (Display * dpy,
98848b8605Smrg                                                    unsigned uid, int kind));
99848b8605Smrg
100848b8605SmrgBool XAppleDRIAuthConnection(Display * dpy, int screen, unsigned int magic);
101848b8605Smrg
102848b8605SmrgBool XAppleDRICreateSurface(Display * dpy, int screen, Drawable drawable,
103848b8605Smrg                            unsigned int client_id, unsigned int key[2],
104848b8605Smrg                            unsigned int *uid);
105848b8605Smrg
106848b8605SmrgBool XAppleDRIDestroySurface(Display * dpy, int screen, Drawable drawable);
107848b8605Smrg
108848b8605SmrgBool XAppleDRISynchronizeSurfaces(Display * dpy);
109848b8605Smrg
110848b8605SmrgBool XAppleDRICreateSharedBuffer(Display * dpy, int screen, Drawable drawable,
111848b8605Smrg                                 Bool doubleSwap, char *path, size_t pathlen,
112848b8605Smrg                                 int *width, int *height);
113848b8605Smrg
114848b8605SmrgBool XAppleDRISwapBuffers(Display * dpy, int screen, Drawable drawable);
115848b8605Smrg
116848b8605SmrgBool XAppleDRICreatePixmap(Display * dpy, int screen, Drawable drawable,
117848b8605Smrg                           int *width, int *height, int *pitch, int *bpp,
118848b8605Smrg                           size_t * size, char *bufname, size_t bufnamesize);
119848b8605Smrg
120848b8605SmrgBool XAppleDRIDestroyPixmap(Display * dpy, Pixmap pixmap);
121848b8605Smrg
122848b8605Smrg_XFUNCPROTOEND
123848b8605Smrg#endif /* _APPLEDRI_SERVER_ */
124848b8605Smrg#endif /* _APPLEDRI_H_ */
125