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