1 | /* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.18 2001/03/21 16:21:40 dawes Exp $ */
|
---|
2 | /**************************************************************************
|
---|
3 |
|
---|
4 | Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
---|
5 | All Rights Reserved.
|
---|
6 |
|
---|
7 | Permission is hereby granted, free of charge, to any person obtaining a
|
---|
8 | copy of this software and associated documentation files (the
|
---|
9 | "Software"), to deal in the Software without restriction, including
|
---|
10 | without limitation the rights to use, copy, modify, merge, publish,
|
---|
11 | distribute, sub license, and/or sell copies of the Software, and to
|
---|
12 | permit persons to whom the Software is furnished to do so, subject to
|
---|
13 | the following conditions:
|
---|
14 |
|
---|
15 | The above copyright notice and this permission notice (including the
|
---|
16 | next paragraph) shall be included in all copies or substantial portions
|
---|
17 | of the Software.
|
---|
18 |
|
---|
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
20 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
---|
21 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
---|
22 | IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
---|
23 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
---|
24 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
---|
25 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
26 |
|
---|
27 | **************************************************************************/
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * Authors:
|
---|
31 | * Jens Owen <[email protected]>
|
---|
32 | *
|
---|
33 | */
|
---|
34 |
|
---|
35 | /* Prototypes for DRI functions */
|
---|
36 |
|
---|
37 | #ifndef _DRI_H_
|
---|
38 |
|
---|
39 | #include "scrnintstr.h"
|
---|
40 | #include "xf86dri.h"
|
---|
41 |
|
---|
42 | typedef int DRISyncType;
|
---|
43 |
|
---|
44 | #define DRI_NO_SYNC 0
|
---|
45 | #define DRI_2D_SYNC 1
|
---|
46 | #define DRI_3D_SYNC 2
|
---|
47 |
|
---|
48 | typedef int DRIContextType;
|
---|
49 |
|
---|
50 | typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
|
---|
51 |
|
---|
52 | typedef enum _DRIContextFlags
|
---|
53 | {
|
---|
54 | DRI_CONTEXT_2DONLY = 0x01,
|
---|
55 | DRI_CONTEXT_PRESERVED = 0x02,
|
---|
56 | DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
|
---|
57 | } DRIContextFlags;
|
---|
58 |
|
---|
59 | #define DRI_NO_CONTEXT 0
|
---|
60 | #define DRI_2D_CONTEXT 1
|
---|
61 | #define DRI_3D_CONTEXT 2
|
---|
62 |
|
---|
63 | typedef int DRISwapMethod;
|
---|
64 |
|
---|
65 | #define DRI_HIDE_X_CONTEXT 0
|
---|
66 | #define DRI_SERVER_SWAP 1
|
---|
67 | #define DRI_KERNEL_SWAP 2
|
---|
68 |
|
---|
69 | typedef int DRIWindowRequests;
|
---|
70 |
|
---|
71 | #define DRI_NO_WINDOWS 0
|
---|
72 | #define DRI_3D_WINDOWS_ONLY 1
|
---|
73 | #define DRI_ALL_WINDOWS 2
|
---|
74 |
|
---|
75 |
|
---|
76 | typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
|
---|
77 | typedef void (*AdjustFramePtr)(int scrnIndex, int x, int y, int flags);
|
---|
78 |
|
---|
79 |
|
---|
80 | /*
|
---|
81 | * These functions can be wrapped by the DRI. Each of these have
|
---|
82 | * generic default funcs (initialized in DRICreateInfoRec) and can be
|
---|
83 | * overridden by the driver in its [driver]DRIScreenInit function.
|
---|
84 | */
|
---|
85 | typedef struct {
|
---|
86 | ScreenWakeupHandlerProcPtr WakeupHandler;
|
---|
87 | ScreenBlockHandlerProcPtr BlockHandler;
|
---|
88 | WindowExposuresProcPtr WindowExposures;
|
---|
89 | CopyWindowProcPtr CopyWindow;
|
---|
90 | ValidateTreeProcPtr ValidateTree;
|
---|
91 | PostValidateTreeProcPtr PostValidateTree;
|
---|
92 | ClipNotifyProcPtr ClipNotify;
|
---|
93 | AdjustFramePtr AdjustFrame;
|
---|
94 | } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
|
---|
95 |
|
---|
96 |
|
---|
97 | /*
|
---|
98 | * Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned
|
---|
99 | * by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also
|
---|
100 | * being used to version the XFree86-DRI protocol. Bugs #3066 and #3163
|
---|
101 | * showed that this was inadequate. The DRIInfoRec structure is now versioned
|
---|
102 | * by the DRIINFO_*_VERSION defines in this file. - ajax, 2005-05-18.
|
---|
103 | *
|
---|
104 | * Revision history:
|
---|
105 | * 4.1.0 and earlier: DRIQueryVersion returns XF86DRI_*_VERSION.
|
---|
106 | * 4.2.0: DRIQueryVersion begins returning DRIINFO_*_VERSION.
|
---|
107 | * 5.0.0: frameBufferPhysicalAddress changed from CARD32 to pointer.
|
---|
108 | */
|
---|
109 |
|
---|
110 | #define DRIINFO_MAJOR_VERSION 5
|
---|
111 | #define DRIINFO_MINOR_VERSION 0
|
---|
112 | #define DRIINFO_PATCH_VERSION 0
|
---|
113 |
|
---|
114 | typedef struct {
|
---|
115 | /* driver call back functions
|
---|
116 | *
|
---|
117 | * New fields should be added at the end for backwards compatibility.
|
---|
118 | * Bump the DRIINFO patch number to indicate bugfixes.
|
---|
119 | * Bump the DRIINFO minor number to indicate new fields.
|
---|
120 | * Bump the DRIINFO major number to indicate binary-incompatible changes.
|
---|
121 | */
|
---|
122 | Bool (*CreateContext)(ScreenPtr pScreen,
|
---|
123 | VisualPtr visual,
|
---|
124 | drm_context_t hHWContext,
|
---|
125 | void* pVisualConfigPriv,
|
---|
126 | DRIContextType context);
|
---|
127 | void (*DestroyContext)(ScreenPtr pScreen,
|
---|
128 | drm_context_t hHWContext,
|
---|
129 | DRIContextType context);
|
---|
130 | void (*SwapContext)(ScreenPtr pScreen,
|
---|
131 | DRISyncType syncType,
|
---|
132 | DRIContextType readContextType,
|
---|
133 | void* readContextStore,
|
---|
134 | DRIContextType writeContextType,
|
---|
135 | void* writeContextStore);
|
---|
136 | void (*InitBuffers)(WindowPtr pWin,
|
---|
137 | RegionPtr prgn,
|
---|
138 | CARD32 indx);
|
---|
139 | void (*MoveBuffers)(WindowPtr pWin,
|
---|
140 | DDXPointRec ptOldOrg,
|
---|
141 | RegionPtr prgnSrc,
|
---|
142 | CARD32 indx);
|
---|
143 | void (*TransitionTo3d)(ScreenPtr pScreen);
|
---|
144 | void (*TransitionTo2d)(ScreenPtr pScreen);
|
---|
145 |
|
---|
146 | void (*SetDrawableIndex)(WindowPtr pWin, CARD32 indx);
|
---|
147 | Bool (*OpenFullScreen)(ScreenPtr pScreen);
|
---|
148 | Bool (*CloseFullScreen)(ScreenPtr pScreen);
|
---|
149 |
|
---|
150 | /* wrapped functions */
|
---|
151 | DRIWrappedFuncsRec wrap;
|
---|
152 |
|
---|
153 | /* device info */
|
---|
154 | char* drmDriverName;
|
---|
155 | char* clientDriverName;
|
---|
156 | char* busIdString;
|
---|
157 | int ddxDriverMajorVersion;
|
---|
158 | int ddxDriverMinorVersion;
|
---|
159 | int ddxDriverPatchVersion;
|
---|
160 | pointer frameBufferPhysicalAddress;
|
---|
161 | long frameBufferSize;
|
---|
162 | long frameBufferStride;
|
---|
163 | long SAREASize;
|
---|
164 | int maxDrawableTableEntry;
|
---|
165 | int ddxDrawableTableEntry;
|
---|
166 | long contextSize;
|
---|
167 | DRISwapMethod driverSwapMethod;
|
---|
168 | DRIWindowRequests bufferRequests;
|
---|
169 | int devPrivateSize;
|
---|
170 | void* devPrivate;
|
---|
171 | Bool createDummyCtx;
|
---|
172 | Bool createDummyCtxPriv;
|
---|
173 |
|
---|
174 | /* New with DRI version 4.1.0 */
|
---|
175 | void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
|
---|
176 | void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
|
---|
177 | } DRIInfoRec, *DRIInfoPtr;
|
---|
178 |
|
---|
179 |
|
---|
180 | extern Bool DRIScreenInit(ScreenPtr pScreen,
|
---|
181 | DRIInfoPtr pDRIInfo,
|
---|
182 | int *pDRMFD);
|
---|
183 |
|
---|
184 | extern void DRICloseScreen(ScreenPtr pScreen);
|
---|
185 |
|
---|
186 | extern Bool DRIExtensionInit(void);
|
---|
187 |
|
---|
188 | extern void DRIReset(void);
|
---|
189 |
|
---|
190 | extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
|
---|
191 | Bool *isCapable);
|
---|
192 |
|
---|
193 | extern Bool DRIOpenConnection(ScreenPtr pScreen,
|
---|
194 | drm_handle_t * hSAREA,
|
---|
195 | char **busIdString);
|
---|
196 |
|
---|
197 | extern Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
|
---|
198 |
|
---|
199 | extern Bool DRICloseConnection(ScreenPtr pScreen);
|
---|
200 |
|
---|
201 | extern Bool DRIGetClientDriverName(ScreenPtr pScreen,
|
---|
202 | int* ddxDriverMajorVersion,
|
---|
203 | int* ddxDriverMinorVersion,
|
---|
204 | int* ddxDriverPatchVersion,
|
---|
205 | char** clientDriverName);
|
---|
206 |
|
---|
207 | extern Bool DRICreateContext(ScreenPtr pScreen,
|
---|
208 | VisualPtr visual,
|
---|
209 | XID context,
|
---|
210 | drm_context_t * pHWContext);
|
---|
211 |
|
---|
212 | extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
|
---|
213 |
|
---|
214 | extern Bool DRIContextPrivDelete(pointer pResource, XID id);
|
---|
215 |
|
---|
216 | extern Bool DRICreateDrawable(ScreenPtr pScreen,
|
---|
217 | Drawable id,
|
---|
218 | DrawablePtr pDrawable,
|
---|
219 | drm_drawable_t * hHWDrawable);
|
---|
220 |
|
---|
221 | extern Bool DRIDestroyDrawable(ScreenPtr pScreen,
|
---|
222 | Drawable id,
|
---|
223 | DrawablePtr pDrawable);
|
---|
224 |
|
---|
225 | extern Bool DRIDrawablePrivDelete(pointer pResource,
|
---|
226 | XID id);
|
---|
227 |
|
---|
228 | extern Bool DRIGetDrawableInfo(ScreenPtr pScreen,
|
---|
229 | DrawablePtr pDrawable,
|
---|
230 | unsigned int* indx,
|
---|
231 | unsigned int* stamp,
|
---|
232 | int* X,
|
---|
233 | int* Y,
|
---|
234 | int* W,
|
---|
235 | int* H,
|
---|
236 | int* numClipRects,
|
---|
237 | drm_clip_rect_t ** pClipRects,
|
---|
238 | int* backX,
|
---|
239 | int* backY,
|
---|
240 | int* numBackClipRects,
|
---|
241 | drm_clip_rect_t ** pBackClipRects);
|
---|
242 |
|
---|
243 | extern Bool DRIGetDeviceInfo(ScreenPtr pScreen,
|
---|
244 | drm_handle_t * hFrameBuffer,
|
---|
245 | int* fbOrigin,
|
---|
246 | int* fbSize,
|
---|
247 | int* fbStride,
|
---|
248 | int* devPrivateSize,
|
---|
249 | void** pDevPrivate);
|
---|
250 |
|
---|
251 | extern DRIInfoPtr DRICreateInfoRec(void);
|
---|
252 |
|
---|
253 | extern void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
|
---|
254 |
|
---|
255 | extern Bool DRIFinishScreenInit(ScreenPtr pScreen);
|
---|
256 |
|
---|
257 | extern void DRIWakeupHandler(pointer wakeupData,
|
---|
258 | int result,
|
---|
259 | pointer pReadmask);
|
---|
260 |
|
---|
261 | extern void DRIBlockHandler(pointer blockData,
|
---|
262 | OSTimePtr pTimeout,
|
---|
263 | pointer pReadmask);
|
---|
264 |
|
---|
265 | extern void DRIDoWakeupHandler(int screenNum,
|
---|
266 | pointer wakeupData,
|
---|
267 | unsigned long result,
|
---|
268 | pointer pReadmask);
|
---|
269 |
|
---|
270 | extern void DRIDoBlockHandler(int screenNum,
|
---|
271 | pointer blockData,
|
---|
272 | pointer pTimeout,
|
---|
273 | pointer pReadmask);
|
---|
274 |
|
---|
275 | extern void DRISwapContext(int drmFD,
|
---|
276 | void *oldctx,
|
---|
277 | void *newctx);
|
---|
278 |
|
---|
279 | extern void *DRIGetContextStore(DRIContextPrivPtr context);
|
---|
280 |
|
---|
281 | extern void DRIWindowExposures(WindowPtr pWin,
|
---|
282 | RegionPtr prgn,
|
---|
283 | RegionPtr bsreg);
|
---|
284 |
|
---|
285 | extern void DRICopyWindow(WindowPtr pWin,
|
---|
286 | DDXPointRec ptOldOrg,
|
---|
287 | RegionPtr prgnSrc);
|
---|
288 |
|
---|
289 | extern int DRIValidateTree(WindowPtr pParent,
|
---|
290 | WindowPtr pChild,
|
---|
291 | VTKind kind);
|
---|
292 |
|
---|
293 | extern void DRIPostValidateTree(WindowPtr pParent,
|
---|
294 | WindowPtr pChild,
|
---|
295 | VTKind kind);
|
---|
296 |
|
---|
297 | extern void DRIClipNotify(WindowPtr pWin,
|
---|
298 | int dx,
|
---|
299 | int dy);
|
---|
300 |
|
---|
301 | extern CARD32 DRIGetDrawableIndex(WindowPtr pWin);
|
---|
302 |
|
---|
303 | extern void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg);
|
---|
304 |
|
---|
305 | extern void DRILock(ScreenPtr pScreen, int flags);
|
---|
306 |
|
---|
307 | extern void DRIUnlock(ScreenPtr pScreen);
|
---|
308 |
|
---|
309 | extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
|
---|
310 |
|
---|
311 | extern void *DRIGetSAREAPrivate(ScreenPtr pScreen);
|
---|
312 |
|
---|
313 | extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
|
---|
314 | CARD32 drawable_index);
|
---|
315 |
|
---|
316 | extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
|
---|
317 | drm_context_t * pHWContext,
|
---|
318 | DRIContextFlags flags);
|
---|
319 |
|
---|
320 | extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen,
|
---|
321 | drm_context_t hHWContext,
|
---|
322 | DRIContextFlags flags);
|
---|
323 |
|
---|
324 | extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
|
---|
325 |
|
---|
326 | extern drm_context_t DRIGetContext(ScreenPtr pScreen);
|
---|
327 |
|
---|
328 | extern void DRIQueryVersion(int *majorVersion,
|
---|
329 | int *minorVersion,
|
---|
330 | int *patchVersion);
|
---|
331 |
|
---|
332 | extern void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
|
---|
333 |
|
---|
334 | extern void DRIMoveBuffersHelper(ScreenPtr pScreen,
|
---|
335 | int dx,
|
---|
336 | int dy,
|
---|
337 | int *xdir,
|
---|
338 | int *ydir,
|
---|
339 | RegionPtr reg);
|
---|
340 |
|
---|
341 | extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
|
---|
342 |
|
---|
343 | #define _DRI_H_
|
---|
344 |
|
---|
345 | #endif
|
---|