1
/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.18 2001/03/21 16:21:40 dawes Exp $ */
2
/**************************************************************************
4
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
7
Permission is hereby granted, free of charge, to any person obtaining a
8
copy of this software and associated documentation files (the
9
"Software"), to deal in the Software without restriction, including
10
without limitation the rights to use, copy, modify, merge, publish,
11
distribute, sub license, and/or sell copies of the Software, and to
12
permit persons to whom the Software is furnished to do so, subject to
13
the following conditions:
15
The above copyright notice and this permission notice (including the
16
next paragraph) shall be included in all copies or substantial portions
19
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
23
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
**************************************************************************/
31
* Jens Owen <jens@tungstengraphics.com>
35
/* Prototypes for DRI functions */
39
#include "scrnintstr.h"
42
typedef int DRISyncType;
48
typedef int DRIContextType;
50
typedef struct _DRIContextPrivRec DRIContextPrivRec, *DRIContextPrivPtr;
52
typedef enum _DRIContextFlags
54
DRI_CONTEXT_2DONLY = 0x01,
55
DRI_CONTEXT_PRESERVED = 0x02,
56
DRI_CONTEXT_RESERVED = 0x04 /* DRI Only -- no kernel equivalent */
59
#define DRI_NO_CONTEXT 0
60
#define DRI_2D_CONTEXT 1
61
#define DRI_3D_CONTEXT 2
63
typedef int DRISwapMethod;
65
#define DRI_HIDE_X_CONTEXT 0
66
#define DRI_SERVER_SWAP 1
67
#define DRI_KERNEL_SWAP 2
69
typedef int DRIWindowRequests;
71
#define DRI_NO_WINDOWS 0
72
#define DRI_3D_WINDOWS_ONLY 1
73
#define DRI_ALL_WINDOWS 2
76
typedef void (*ClipNotifyPtr)( WindowPtr, int, int );
77
typedef void (*AdjustFramePtr)(int scrnIndex, int x, int y, int flags);
81
* These functions can be wrapped by the DRI. Each of these have
82
* generic default funcs (initialized in DRICreateInfoRec) and can be
83
* overridden by the driver in its [driver]DRIScreenInit function.
86
ScreenWakeupHandlerProcPtr WakeupHandler;
87
ScreenBlockHandlerProcPtr BlockHandler;
88
WindowExposuresProcPtr WindowExposures;
89
CopyWindowProcPtr CopyWindow;
90
ValidateTreeProcPtr ValidateTree;
91
PostValidateTreeProcPtr PostValidateTree;
92
ClipNotifyProcPtr ClipNotify;
93
AdjustFramePtr AdjustFrame;
94
} DRIWrappedFuncsRec, *DRIWrappedFuncsPtr;
98
* Prior to Xorg 6.8.99.8, the DRIInfoRec structure was implicitly versioned
99
* by the XF86DRI_*_VERSION defines in xf86dristr.h. These numbers were also
100
* being used to version the XFree86-DRI protocol. Bugs #3066 and #3163
101
* showed that this was inadequate. The DRIInfoRec structure is now versioned
102
* by the DRIINFO_*_VERSION defines in this file. - ajax, 2005-05-18.
105
* 4.1.0 and earlier: DRIQueryVersion returns XF86DRI_*_VERSION.
106
* 4.2.0: DRIQueryVersion begins returning DRIINFO_*_VERSION.
107
* 5.0.0: frameBufferPhysicalAddress changed from CARD32 to pointer.
110
#define DRIINFO_MAJOR_VERSION 5
111
#define DRIINFO_MINOR_VERSION 0
112
#define DRIINFO_PATCH_VERSION 0
115
/* driver call back functions
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.
122
Bool (*CreateContext)(ScreenPtr pScreen,
124
drm_context_t hHWContext,
125
void* pVisualConfigPriv,
126
DRIContextType context);
127
void (*DestroyContext)(ScreenPtr pScreen,
128
drm_context_t hHWContext,
129
DRIContextType context);
130
void (*SwapContext)(ScreenPtr pScreen,
131
DRISyncType syncType,
132
DRIContextType readContextType,
133
void* readContextStore,
134
DRIContextType writeContextType,
135
void* writeContextStore);
136
void (*InitBuffers)(WindowPtr pWin,
139
void (*MoveBuffers)(WindowPtr pWin,
140
DDXPointRec ptOldOrg,
143
void (*TransitionTo3d)(ScreenPtr pScreen);
144
void (*TransitionTo2d)(ScreenPtr pScreen);
146
void (*SetDrawableIndex)(WindowPtr pWin, CARD32 indx);
147
Bool (*OpenFullScreen)(ScreenPtr pScreen);
148
Bool (*CloseFullScreen)(ScreenPtr pScreen);
150
/* wrapped functions */
151
DRIWrappedFuncsRec wrap;
155
char* clientDriverName;
157
int ddxDriverMajorVersion;
158
int ddxDriverMinorVersion;
159
int ddxDriverPatchVersion;
160
pointer frameBufferPhysicalAddress;
161
long frameBufferSize;
162
long frameBufferStride;
164
int maxDrawableTableEntry;
165
int ddxDrawableTableEntry;
167
DRISwapMethod driverSwapMethod;
168
DRIWindowRequests bufferRequests;
172
Bool createDummyCtxPriv;
174
/* New with DRI version 4.1.0 */
175
void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
176
void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
177
} DRIInfoRec, *DRIInfoPtr;
180
extern Bool DRIScreenInit(ScreenPtr pScreen,
184
extern void DRICloseScreen(ScreenPtr pScreen);
186
extern Bool DRIExtensionInit(void);
188
extern void DRIReset(void);
190
extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen,
193
extern Bool DRIOpenConnection(ScreenPtr pScreen,
194
drm_handle_t * hSAREA,
197
extern Bool DRIAuthConnection(ScreenPtr pScreen, drm_magic_t magic);
199
extern Bool DRICloseConnection(ScreenPtr pScreen);
201
extern Bool DRIGetClientDriverName(ScreenPtr pScreen,
202
int* ddxDriverMajorVersion,
203
int* ddxDriverMinorVersion,
204
int* ddxDriverPatchVersion,
205
char** clientDriverName);
207
extern Bool DRICreateContext(ScreenPtr pScreen,
210
drm_context_t * pHWContext);
212
extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context);
214
extern Bool DRIContextPrivDelete(pointer pResource, XID id);
216
extern Bool DRICreateDrawable(ScreenPtr pScreen,
218
DrawablePtr pDrawable,
219
drm_drawable_t * hHWDrawable);
221
extern Bool DRIDestroyDrawable(ScreenPtr pScreen,
223
DrawablePtr pDrawable);
225
extern Bool DRIDrawablePrivDelete(pointer pResource,
228
extern Bool DRIGetDrawableInfo(ScreenPtr pScreen,
229
DrawablePtr pDrawable,
237
drm_clip_rect_t ** pClipRects,
240
int* numBackClipRects,
241
drm_clip_rect_t ** pBackClipRects);
243
extern Bool DRIGetDeviceInfo(ScreenPtr pScreen,
244
drm_handle_t * hFrameBuffer,
251
extern DRIInfoPtr DRICreateInfoRec(void);
253
extern void DRIDestroyInfoRec(DRIInfoPtr DRIInfo);
255
extern Bool DRIFinishScreenInit(ScreenPtr pScreen);
257
extern void DRIWakeupHandler(pointer wakeupData,
261
extern void DRIBlockHandler(pointer blockData,
265
extern void DRIDoWakeupHandler(int screenNum,
267
unsigned long result,
270
extern void DRIDoBlockHandler(int screenNum,
275
extern void DRISwapContext(int drmFD,
279
extern void *DRIGetContextStore(DRIContextPrivPtr context);
281
extern void DRIWindowExposures(WindowPtr pWin,
285
extern void DRICopyWindow(WindowPtr pWin,
286
DDXPointRec ptOldOrg,
289
extern int DRIValidateTree(WindowPtr pParent,
293
extern void DRIPostValidateTree(WindowPtr pParent,
297
extern void DRIClipNotify(WindowPtr pWin,
301
extern CARD32 DRIGetDrawableIndex(WindowPtr pWin);
303
extern void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg);
305
extern void DRILock(ScreenPtr pScreen, int flags);
307
extern void DRIUnlock(ScreenPtr pScreen);
309
extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen);
311
extern void *DRIGetSAREAPrivate(ScreenPtr pScreen);
313
extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen,
314
CARD32 drawable_index);
316
extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen,
317
drm_context_t * pHWContext,
318
DRIContextFlags flags);
320
extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen,
321
drm_context_t hHWContext,
322
DRIContextFlags flags);
324
extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv);
326
extern drm_context_t DRIGetContext(ScreenPtr pScreen);
328
extern void DRIQueryVersion(int *majorVersion,
332
extern void DRIAdjustFrame(int scrnIndex, int x, int y, int flags);
334
extern void DRIMoveBuffersHelper(ScreenPtr pScreen,
341
extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);