dri.h revision 706f2543
1/**************************************************************************
2
3Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
4Copyright (c) 2002, 2009 Apple Computer, Inc.
5All Rights Reserved.
6
7Permission is hereby granted, free of charge, to any person obtaining a
8copy of this software and associated documentation files (the
9"Software"), to deal in the Software without restriction, including
10without limitation the rights to use, copy, modify, merge, publish,
11distribute, sub license, and/or sell copies of the Software, and to
12permit persons to whom the Software is furnished to do so, subject to
13the following conditions:
14
15The above copyright notice and this permission notice (including the
16next paragraph) shall be included in all copies or substantial portions
17of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
27**************************************************************************/
28
29/*
30 * Authors:
31 *   Jens Owen <jens@precisioninsight.com>
32 *
33 */
34
35/* Prototypes for AppleDRI functions */
36
37#ifndef _DRI_H_
38#define _DRI_H_
39
40#include <X11/Xdefs.h>
41#include "scrnintstr.h"
42#define _APPLEDRI_SERVER_
43#include "appledri.h"
44#include <Xplugin.h>
45
46typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
47
48
49/*
50 * These functions can be wrapped by the DRI.  Each of these have
51 * generic default funcs (initialized in DRICreateInfoRec) and can be
52 * overridden by the driver in its [driver]DRIScreenInit function.
53 */
54typedef struct {
55    WindowExposuresProcPtr       WindowExposures;
56    CopyWindowProcPtr            CopyWindow;
57    ValidateTreeProcPtr          ValidateTree;
58    PostValidateTreeProcPtr      PostValidateTree;
59    ClipNotifyProcPtr            ClipNotify;
60} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
61
62typedef struct {
63    xp_surface_id id;
64    int kind;
65} DRISurfaceNotifyArg;
66
67extern Bool DRIScreenInit(ScreenPtr pScreen);
68
69extern Bool DRIFinishScreenInit(ScreenPtr pScreen);
70
71extern void DRICloseScreen(ScreenPtr pScreen);
72
73extern Bool DRIExtensionInit(void);
74
75extern void DRIReset(void);
76
77extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
78                                           Bool *isCapable);
79
80extern Bool DRIAuthConnection(ScreenPtr pScreen, unsigned int magic);
81
82extern Bool DRICreateSurface(ScreenPtr pScreen,
83                             Drawable id,
84                             DrawablePtr pDrawable,
85                             xp_client_id client_id,
86                             xp_surface_id *surface_id,
87                             unsigned int key[2],
88                             void (*notify) (void *arg, void *data),
89                             void *notify_data);
90
91extern Bool DRIDestroySurface(ScreenPtr pScreen,
92                             Drawable id,
93                             DrawablePtr pDrawable,
94                             void (*notify) (void *arg, void *data),
95                             void *notify_data);
96
97extern Bool DRIDrawablePrivDelete(pointer pResource,
98                                  XID id);
99
100extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
101
102extern void DRICopyWindow(WindowPtr pWin,
103                          DDXPointRec ptOldOrg,
104                          RegionPtr prgnSrc);
105
106extern int DRIValidateTree(WindowPtr pParent,
107                           WindowPtr pChild,
108                           VTKind    kind);
109
110extern void DRIPostValidateTree(WindowPtr pParent,
111                                WindowPtr pChild,
112                                VTKind    kind);
113
114extern void DRIClipNotify(WindowPtr pWin,
115                          int dx,
116                          int dy);
117
118extern void DRIWindowExposures(WindowPtr pWin,
119                              RegionPtr prgn,
120                              RegionPtr bsreg);
121
122extern void DRISurfaceNotify (xp_surface_id id, int kind);
123
124extern void DRIQueryVersion(int *majorVersion,
125                            int *minorVersion,
126                            int *patchVersion);
127
128extern Bool DRICreatePixmap(ScreenPtr pScreen, Drawable id,
129			    DrawablePtr pDrawable, char *path,
130			    size_t pathmax);
131
132extern Bool DRIGetPixmapData(DrawablePtr pDrawable, int *width, int *height,
133			     int *pitch, int *bpp, void **ptr);
134
135
136extern void DRIDestroyPixmap(DrawablePtr pDrawable);
137
138#endif
139