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