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