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