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 0
|
---|
111 | #define DRIINFO_PATCH_VERSION 0
|
---|
112 |
|
---|
113 | typedef struct {
|
---|
114 | /* driver call back functions
|
---|
115 | *
|
---|
116 | * New fields should be added at the end for backwards compatibility.
|
---|
117 | * Bump the DRIINFO patch number to indicate bugfixes.
|
---|
118 | * Bump the DRIINFO minor number to indicate new fields.
|
---|
119 | * Bump the DRIINFO major number to indicate binary-incompatible changes.
|
---|
120 | */
|
---|
121 | Bool (*CreateContext)(ScreenPtr pScreen,
|
---|
122 | VisualPtr visual,
|
---|
123 | drm_context_t hHWContext,
|
---|
124 | void* pVisualConfigPriv,
|
---|
125 | DRIContextType context);
|
---|
126 | void (*DestroyContext)(ScreenPtr pScreen,
|
---|
127 | drm_context_t hHWContext,
|
---|
128 | DRIContextType context);
|
---|
129 | void (*SwapContext)(ScreenPtr pScreen,
|
---|
130 | DRISyncType syncType,
|
---|
131 | DRIContextType readContextType,
|
---|
132 | void* readContextStore,
|
---|
133 | DRIContextType writeContextType,
|
---|
134 | void* writeContextStore);
|
---|
135 | void (*InitBuffers)(WindowPtr pWin,
|
---|
136 | RegionPtr prgn,
|
---|
137 | CARD32 indx);
|
---|
138 | void (*MoveBuffers)(WindowPtr pWin,
|
---|
139 | DDXPointRec ptOldOrg,
|
---|
140 | RegionPtr prgnSrc,
|
---|
141 | CARD32 indx);
|
---|
142 | void (*TransitionTo3d)(ScreenPtr pScreen);
|
---|
143 | void (*TransitionTo2d)(ScreenPtr pScreen);
|
---|
144 |
|
---|
145 | void (*SetDrawableIndex)(WindowPtr pWin, CARD32 indx);
|
---|
146 | Bool (*OpenFullScreen)(ScreenPtr pScreen);
|
---|
147 | Bool (*CloseFullScreen)(ScreenPtr pScreen);
|
---|
148 |
|
---|
149 | /* wrapped functions */
|
---|
150 | DRIWrappedFuncsRec wrap;
|
---|
151 |
|
---|
152 | /* device info */
|
---|
153 | char* drmDriverName;
|
---|
154 | char* clientDriverName;
|
---|
155 | char* busIdString;
|
---|
156 | int ddxDriverMajorVersion;
|
---|
157 | int ddxDriverMinorVersion;
|
---|
158 | int ddxDriverPatchVersion;
|
---|
159 | pointer frameBufferPhysicalAddress;
|
---|
160 | long frameBufferSize;
|
---|
161 | long frameBufferStride;
|
---|
162 | long SAREASize;
|
---|
163 | int maxDrawableTableEntry;
|
---|
164 | int ddxDrawableTableEntry;
|
---|
165 | long contextSize;
|
---|
166 | DRISwapMethod driverSwapMethod;
|
---|
167 | DRIWindowRequests bufferRequests;
|
---|
168 | int devPrivateSize;
|
---|
169 | void* devPrivate;
|
---|
170 | Bool createDummyCtx;
|
---|
171 | Bool createDummyCtxPriv;
|
---|
172 |
|
---|
173 | /* New with DRI version 4.1.0 */
|
---|
174 | void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
|
---|
175 | void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
|
---|
176 | } DRIInfoRec, *DRIInfoPtr;
|
---|
177 |
|
---|
178 |
|
---|
179 | extern Bool DRIScreenInit(ScreenPtr pScreen,
|
---|
180 | DRIInfoPtr pDRIInfo,
|
---|
181 | int *pDRMFD);
|
---|
182 |
|
---|
183 | extern void DRICloseScreen(ScreenPtr pScreen);
|
---|
184 |
|
---|
185 | extern Bool DRIExtensionInit(void);
|
---|
186 |
|
---|
187 | extern void DRIReset(void);
|
---|
188 |
|
---|
189 | extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
|
---|
190 | Bool *isCapable);
|
---|
191 |
|
---|
192 | extern Bool DRIOpenConnection(ScreenPtr pScreen,
|
---|
193 | drm_handle_t * hSAREA,
|
---|
194 | char **busIdString);
|
---|
195 |
|
---|
196 | extern Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
|
---|
197 |
|
---|
198 | extern Bool DRICloseConnection(ScreenPtr pScreen);
|
---|
199 |
|
---|
200 | extern Bool DRIGetClientDriverName(ScreenPtr pScreen,
|
---|
201 | int* ddxDriverMajorVersion,
|
---|
202 | int* ddxDriverMinorVersion,
|
---|
203 | int* ddxDriverPatchVersion,
|
---|
204 | char** clientDriverName);
|
---|
205 |
|
---|
206 | extern Bool DRICreateContext(ScreenPtr pScreen,
|
---|
207 | VisualPtr visual,
|
---|
208 | XID context,
|
---|
209 | drm_context_t * pHWContext);
|
---|
210 |
|
---|
211 | extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
|
---|
212 |
|
---|
213 | extern Bool DRIContextPrivDelete(pointer pResource, XID id);
|
---|
214 |
|
---|
215 | extern Bool DRICreateDrawable(ScreenPtr pScreen,
|
---|
216 | Drawable id,
|
---|
217 | DrawablePtr pDrawable,
|
---|
218 | drm_drawable_t * hHWDrawable);
|
---|
219 |
|
---|
220 | extern Bool DRIDestroyDrawable(ScreenPtr pScreen,
|
---|
221 | Drawable id,
|
---|
222 | DrawablePtr pDrawable);
|
---|
223 |
|
---|
224 | extern Bool DRIDrawablePrivDelete(pointer pResource,
|
---|
225 | XID id);
|
---|
226 |
|
---|
227 | extern Bool DRIGetDrawableInfo(ScreenPtr pScreen,
|
---|
228 | DrawablePtr pDrawable,
|
---|
229 | unsigned int* indx,
|
---|
230 | unsigned int* stamp,
|
---|
231 | int* X,
|
---|
232 | int* Y,
|
---|
233 | int* W,
|
---|
234 | int* H,
|
---|
235 | int* numClipRects,
|
---|
236 | drm_clip_rect_t ** pClipRects,
|
---|
237 | int* backX,
|
---|
238 | int* backY,
|
---|
239 | int* numBackClipRects,
|
---|
240 | drm_clip_rect_t ** pBackClipRects);
|
---|
241 |
|
---|
242 | extern Bool DRIGetDeviceInfo(ScreenPtr pScreen,
|
---|
243 | drm_handle_t * hFrameBuffer,
|
---|
244 | int* fbOrigin,
|
---|
245 | int* fbSize,
|
---|
246 | int* fbStride,
|
---|
247 | int* devPrivateSize,
|
---|
248 | void** pDevPrivate);
|
---|
249 |
|
---|
250 | extern DRIInfoPtr DRICreateInfoRec(void);
|
---|
251 |
|
---|
252 | extern void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
|
---|
253 |
|
---|
254 | extern Bool DRIFinishScreenInit(ScreenPtr pScreen);
|
---|
255 |
|
---|
256 | extern void DRIWakeupHandler(pointer wakeupData,
|
---|
257 | int result,
|
---|
258 | pointer pReadmask);
|
---|
259 |
|
---|
260 | extern void DRIBlockHandler(pointer blockData,
|
---|
261 | OSTimePtr pTimeout,
|
---|
262 | pointer pReadmask);
|
---|
263 |
|
---|
264 | extern void DRIDoWakeupHandler(int screenNum,
|
---|
265 | pointer wakeupData,
|
---|
266 | unsigned long result,
|
---|
267 | pointer pReadmask);
|
---|
268 |
|
---|
269 | extern void DRIDoBlockHandler(int screenNum,
|
---|
270 | pointer blockData,
|
---|
271 | pointer pTimeout,
|
---|
272 | pointer pReadmask);
|
---|
273 |
|
---|
274 | extern void DRISwapContext(int drmFD,
|
---|
275 | void *oldctx,
|
---|
276 | void *newctx);
|
---|
277 |
|
---|
278 | extern void *DRIGetContextStore(DRIContextPrivPtr context);
|
---|
279 |
|
---|
280 | extern void DRIWindowExposures(WindowPtr pWin,
|
---|
281 | RegionPtr prgn,
|
---|
282 | RegionPtr bsreg);
|
---|
283 |
|
---|
284 | extern void DRICopyWindow(WindowPtr pWin,
|
---|
285 | DDXPointRec ptOldOrg,
|
---|
286 | RegionPtr prgnSrc);
|
---|
287 |
|
---|
288 | extern int DRIValidateTree(WindowPtr pParent,
|
---|
289 | WindowPtr pChild,
|
---|
290 | VTKind kind);
|
---|
291 |
|
---|
292 | extern void DRIPostValidateTree(WindowPtr pParent,
|
---|
293 | WindowPtr pChild,
|
---|
294 | VTKind kind);
|
---|
295 |
|
---|
296 | extern void DRIClipNotify(WindowPtr pWin,
|
---|
297 | int dx,
|
---|
298 | int dy);
|
---|
299 |
|
---|
300 | extern CARD32 DRIGetDrawableIndex(WindowPtr pWin);
|
---|
301 |
|
---|
302 | extern void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg);
|
---|
303 |
|
---|
304 | extern void DRILock(ScreenPtr pScreen, int flags);
|
---|
305 |
|
---|
306 | extern void DRIUnlock(ScreenPtr pScreen);
|
---|
307 |
|
---|
308 | extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
|
---|
309 |
|
---|
310 | extern void *DRIGetSAREAPrivate(ScreenPtr pScreen);
|
---|
311 |
|
---|
312 | extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
|
---|
313 | CARD32 drawable_index);
|
---|
314 |
|
---|
315 | extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
|
---|
316 | drm_context_t * pHWContext,
|
---|
317 | DRIContextFlags flags);
|
---|
318 |
|
---|
319 | extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen,
|
---|
320 | drm_context_t hHWContext,
|
---|
321 | DRIContextFlags flags);
|
---|
322 |
|
---|
323 | extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
|
---|
324 |
|
---|
325 | extern drm_context_t DRIGetContext(ScreenPtr pScreen);
|
---|
326 |
|
---|
327 | extern void DRIQueryVersion(int *majorVersion,
|
---|
328 | int *minorVersion,
|
---|
329 | int *patchVersion);
|
---|
330 |
|
---|
331 | extern void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
|
---|
332 |
|
---|
333 | extern void DRIMoveBuffersHelper(ScreenPtr pScreen,
|
---|
334 | int dx,
|
---|
335 | int dy,
|
---|
336 | int *xdir,
|
---|
337 | int *ydir,
|
---|
338 | RegionPtr reg);
|
---|
339 |
|
---|
340 | extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
|
---|
341 |
|
---|
342 | extern int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
|
---|
343 | extern int drmRemoveSIGIOHandler(int fd);
|
---|
344 | #define _DRI_H_
|
---|
345 |
|
---|
346 | #endif
|
---|