VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/dri.h

Last change on this file was 32163, checked in by vboxsync, 14 years ago

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

  • Property svn:eol-style set to native
File size: 13.4 KB
Line 
1/**************************************************************************
2
3Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
4All Rights Reserved.
5
6Permission is hereby granted, free of charge, to any person obtaining a
7copy of this software and associated documentation files (the
8"Software"), to deal in the Software without restriction, including
9without limitation the rights to use, copy, modify, merge, publish,
10distribute, sub license, and/or sell copies of the Software, and to
11permit persons to whom the Software is furnished to do so, subject to
12the following conditions:
13
14The above copyright notice and this permission notice (including the
15next paragraph) shall be included in all copies or substantial portions
16of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
22ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26**************************************************************************/
27
28/*
29 * Authors:
30 * Jens Owen <jens@tungstengraphics.com>
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
43typedef int DRISyncType;
44
45#define DRI_NO_SYNC 0
46#define DRI_2D_SYNC 1
47#define DRI_3D_SYNC 2
48
49typedef int DRIContextType;
50
51typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
52
53typedef 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
64typedef int DRISwapMethod;
65
66#define DRI_HIDE_X_CONTEXT 0
67#define DRI_SERVER_SWAP 1
68#define DRI_KERNEL_SWAP 2
69
70typedef int DRIWindowRequests;
71
72#define DRI_NO_WINDOWS 0
73#define DRI_3D_WINDOWS_ONLY 1
74#define DRI_ALL_WINDOWS 2
75
76
77typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
78typedef 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 */
86typedef 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
115typedef unsigned long long (*DRITexOffsetStartProcPtr)(PixmapPtr pPix);
116typedef void (*DRITexOffsetFinishProcPtr)(PixmapPtr pPix);
117
118typedef 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
201extern _X_EXPORT Bool DRIOpenDRMMaster(ScrnInfoPtr pScrn, unsigned long sAreaSize,
202 const char *busID,
203 const char *drmDriverName);
204
205extern _X_EXPORT Bool DRIScreenInit(ScreenPtr pScreen,
206 DRIInfoPtr pDRIInfo,
207 int *pDRMFD);
208
209extern _X_EXPORT void DRICloseScreen(ScreenPtr pScreen);
210
211extern _X_EXPORT Bool DRIExtensionInit(void);
212
213extern _X_EXPORT void DRIReset(void);
214
215extern _X_EXPORT Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
216 Bool *isCapable);
217
218extern _X_EXPORT Bool DRIOpenConnection(ScreenPtr pScreen,
219 drm_handle_t * hSAREA,
220 char **busIdString);
221
222extern _X_EXPORT Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
223
224extern _X_EXPORT Bool DRICloseConnection(ScreenPtr pScreen);
225
226extern _X_EXPORT Bool DRIGetClientDriverName(ScreenPtr pScreen,
227 int* ddxDriverMajorVersion,
228 int* ddxDriverMinorVersion,
229 int* ddxDriverPatchVersion,
230 char** clientDriverName);
231
232extern _X_EXPORT Bool DRICreateContext(ScreenPtr pScreen,
233 VisualPtr visual,
234 XID context,
235 drm_context_t * pHWContext);
236
237extern _X_EXPORT Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
238
239extern _X_EXPORT Bool DRIContextPrivDelete(pointer pResource, XID id);
240
241extern _X_EXPORT Bool DRICreateDrawable(ScreenPtr pScreen,
242 ClientPtr client,
243 DrawablePtr pDrawable,
244 drm_drawable_t * hHWDrawable);
245
246extern _X_EXPORT Bool DRIDestroyDrawable(ScreenPtr pScreen,
247 ClientPtr client,
248 DrawablePtr pDrawable);
249
250extern _X_EXPORT Bool DRIDrawablePrivDelete(pointer pResource,
251 XID id);
252
253extern _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
268extern _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
276extern _X_EXPORT DRIInfoPtr DRICreateInfoRec(void);
277
278extern _X_EXPORT void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
279
280extern _X_EXPORT Bool DRIFinishScreenInit(ScreenPtr pScreen);
281
282extern _X_EXPORT void DRIWakeupHandler(pointer wakeupData,
283 int result,
284 pointer pReadmask);
285
286extern _X_EXPORT void DRIBlockHandler(pointer blockData,
287 OSTimePtr pTimeout,
288 pointer pReadmask);
289
290extern _X_EXPORT void DRIDoWakeupHandler(int screenNum,
291 pointer wakeupData,
292 unsigned long result,
293 pointer pReadmask);
294
295extern _X_EXPORT void DRIDoBlockHandler(int screenNum,
296 pointer blockData,
297 pointer pTimeout,
298 pointer pReadmask);
299
300extern _X_EXPORT void DRISwapContext(int drmFD,
301 void *oldctx,
302 void *newctx);
303
304extern _X_EXPORT void *DRIGetContextStore(DRIContextPrivPtr context);
305
306extern _X_EXPORT void DRIWindowExposures(WindowPtr pWin,
307 RegionPtr prgn,
308 RegionPtr bsreg);
309
310extern _X_EXPORT Bool DRIDestroyWindow(WindowPtr pWin);
311
312extern _X_EXPORT void DRICopyWindow(WindowPtr pWin,
313 DDXPointRec ptOldOrg,
314 RegionPtr prgnSrc);
315
316extern _X_EXPORT int DRIValidateTree(WindowPtr pParent,
317 WindowPtr pChild,
318 VTKind kind);
319
320extern _X_EXPORT void DRIPostValidateTree(WindowPtr pParent,
321 WindowPtr pChild,
322 VTKind kind);
323
324extern _X_EXPORT void DRIClipNotify(WindowPtr pWin,
325 int dx,
326 int dy);
327
328extern _X_EXPORT CARD32 DRIGetDrawableIndex(WindowPtr pWin);
329
330extern _X_EXPORT void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg);
331
332extern _X_EXPORT void DRILock(ScreenPtr pScreen, int flags);
333
334extern _X_EXPORT void DRIUnlock(ScreenPtr pScreen);
335
336extern _X_EXPORT DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
337
338extern _X_EXPORT void *DRIGetSAREAPrivate(ScreenPtr pScreen);
339
340extern _X_EXPORT unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
341 CARD32 drawable_index);
342
343extern _X_EXPORT DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
344 drm_context_t * pHWContext,
345 DRIContextFlags flags);
346
347extern _X_EXPORT DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen,
348 drm_context_t hHWContext,
349 DRIContextFlags flags);
350
351extern _X_EXPORT Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
352
353extern _X_EXPORT drm_context_t DRIGetContext(ScreenPtr pScreen);
354
355extern _X_EXPORT void DRIQueryVersion(int *majorVersion,
356 int *minorVersion,
357 int *patchVersion);
358
359extern _X_EXPORT void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
360
361extern _X_EXPORT void DRIMoveBuffersHelper(ScreenPtr pScreen,
362 int dx,
363 int dy,
364 int *xdir,
365 int *ydir,
366 RegionPtr reg);
367
368extern _X_EXPORT char *DRICreatePCIBusID(const struct pci_device *PciInfo);
369
370extern _X_EXPORT int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *));
371extern _X_EXPORT int drmRemoveSIGIOHandler(int fd);
372extern _X_EXPORT int DRIMasterFD(ScrnInfoPtr pScrn);
373
374extern _X_EXPORT void *DRIMasterSareaPointer(ScrnInfoPtr pScrn);
375
376extern _X_EXPORT drm_handle_t DRIMasterSareaHandle(ScrnInfoPtr pScrn);
377
378extern _X_EXPORT void DRIGetTexOffsetFuncs(ScreenPtr pScreen,
379 DRITexOffsetStartProcPtr *texOffsetStartFunc,
380 DRITexOffsetFinishProcPtr *texOffsetFinishFunc);
381
382#define _DRI_H_
383
384#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette