1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
|
/**
* \file miniglxP.h
* \brief Define replacements for some X datatypes and define the DRI-related
* data structures.
*
* \note Cut down version of glxclient.h.
*
*/
#ifndef _mini_GLX_client_h_
#define _mini_GLX_client_h_
#include <signal.h>
#include <linux/fb.h>
#include <GL/miniglx.h>
#include "glheader.h"
#include "mtypes.h"
typedef unsigned long XID;
/**
* \brief GLX-specific attributes.
*/
typedef struct __GLXvisualConfigRec {
VisualID vid;
int class;
Bool rgba;
int redSize, greenSize, blueSize, alphaSize;
unsigned long redMask, greenMask, blueMask, alphaMask;
int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize;
Bool doubleBuffer;
Bool stereo;
int bufferSize;
int depthSize;
int stencilSize;
int auxBuffers;
int level;
/**
* \name Extended Visual Properties
*/
/*@{*/
int visualRating; /**< \brief visual_rating extension */
int transparentPixel; /**< \brief visual_info extension */
/** \brief colors are floats scaled to ints */
int transparentRed, transparentGreen, transparentBlue, transparentAlpha;
int transparentIndex;
/*@}*/
} __GLXvisualConfig;
typedef struct __DRIscreenRec __DRIscreen;
typedef struct __DRIcontextRec __DRIcontext;
typedef struct __DRIdrawableRec __DRIdrawable;
typedef void *(*CreateScreenFunc)(Display *dpy, int scrn, __DRIscreen *psc,
int numConfigs, __GLXvisualConfig *config);
typedef void *(*InitFBDevFunc)( Display *dpy );
typedef void *(*HaltFBDevFunc)( Display *dpy );
/**
* \brief Screen dependent methods.
*
* \internal
* This structure is initialized during the MiniGLXDisplayRec::createScreen
* call.
*/
struct __DRIscreenRec {
/**
* \brief Method to destroy the private DRI screen data.
*/
void (*destroyScreen)(Display *dpy, int scrn, void *screenPrivate);
/**
* \brief Method to create the private DRI context data and initialize the
* context dependent methods.
*/
void *(*createContext)(Display *dpy, XVisualInfo *vis, void *sharedPrivate,
__DRIcontext *pctx);
/**
* \brief Method to create the private DRI drawable data and initialize the
* drawable dependent methods.
*/
void *(*createDrawable)(Display *dpy, int scrn, GLXDrawable draw,
VisualID vid, __DRIdrawable *pdraw);
/**
* \brief Method to return a pointer to the DRI drawable data.
*/
__DRIdrawable *(*getDrawable)(Display *dpy, GLXDrawable draw,
void *drawablePrivate);
/*
* XXX in the future, implement this:
void *(*createPBuffer)(Display *dpy, int scrn, GLXPbuffer pbuffer,
GLXFBConfig config, __DRIdrawable *pdraw);
*/
/**
* \brief Opaque pointer to private per screen direct rendering data.
*
* \c NULL if direct rendering is not supported on this screen. Never
* dereferenced in libGL.
*/
void *private;
};
/**
* \brief Context dependent methods.
*
* \internal
* This structure is initialized during the __DRIscreenRec::createContext call.
*/
struct __DRIcontextRec {
/**
* \brief Method to destroy the private DRI context data.
*/
void (*destroyContext)(Display *dpy, int scrn, void *contextPrivate);
/**
* \brief Method to bind a DRI drawable to a DRI graphics context.
*
* \todo XXX in the future, also pass a 'read' GLXDrawable for
* glXMakeCurrentReadSGI() and GLX 1.3's glXMakeContextCurrent().
*/
Bool (*bindContext)(Display *dpy, int scrn, GLXDrawable draw,
GLXContext gc);
/**
* \brief Method to unbind a DRI drawable to a DRI graphics context.
*/
Bool (*unbindContext)(Display *dpy, int scrn, GLXDrawable draw,
GLXContext gc, int will_rebind);
/**
* \brief Opaque pointer to private per context direct rendering data.
*
* NULL if direct rendering is not supported on the display or
* screen used to create this context. Never dereferenced in libGL.
*/
void *private;
};
/**
* \brief Drawable dependent methods.
*
* \internal
* This structure is initialized during the __DRIscreenRec::createDrawable call.
*
* __DRIscreenRec::createDrawable is not called by libGL at this time. It's
* currently used via the dri_util.c utility code instead.
*/
struct __DRIdrawableRec {
/**
* \brief Method to destroy the private DRI drawable data.
*/
void (*destroyDrawable)(Display *dpy, void *drawablePrivate);
/**
* \brief Method to swap the front and back buffers.
*/
void (*swapBuffers)(Display *dpy, void *drawablePrivate);
/**
* \brief Opaque pointer to private per drawable direct rendering data.
*
* \c NULL if direct rendering is not supported on the display or
* screen used to create this drawable. Never dereferenced in libGL.
*/
void *private;
};
/**
* \brief Supported pixel formats.
* \enum pixelFormat
*/
enum PixelFormat {
PF_B8G8R8, /**< 24-bit BGR */
PF_B8G8R8A8, /**< 32-bit BGRA */
PF_B5G6R5, /**< 16-bit BGR */
PF_B5G5R5, /**< 15-bit BGR */
PF_CI8 /**< 8-bit color index */
};
/**
* \brief X Visual type.
*
* \sa ::Visual, \ref datatypes.
*/
struct MiniGLXVisualRec {
const __GLXvisualConfig *glxConfig;
XVisualInfo *visInfo; /**< \brief pointer back to corresponding ::XVisualInfo */
Display *dpy;
enum PixelFormat pixelFormat;
};
/**
* \brief X Window type.
*
* \sa ::Window, \ref datatypes.
*/
struct MiniGLXWindowRec {
Visual *visual;
/** \brief position (always 0,0) */
int x, y;
/** \brief size */
unsigned int w, h;
void *frontStart; /**< \brief start of front color buffer */
void *backStart; /**< \brief start of back color buffer */
size_t size; /**< \brief color buffer size, in bytes */
GLuint bytesPerPixel;
GLuint rowStride; /**< \brief in bytes */
GLubyte *frontBottom; /**< \brief pointer to last row */
GLubyte *backBottom; /**< \brief pointer to last row */
GLubyte *curBottom; /**< = frontBottom or backBottom */
__DRIdrawable driDrawable;
};
/**
* \brief GLXContext type.
*
* \sa ::GLXContext, \ref datatypes.
*/
struct MiniGLXContextRec {
Window drawBuffer;
Window curBuffer;
VisualID vid;
__DRIcontext driContext;
};
/**
* \brief X Display type
*
* \sa ::Display, \ref datatypes.
*/
struct MiniGLXDisplayRec {
struct fb_fix_screeninfo FixedInfo;
struct fb_var_screeninfo OrigVarInfo, VarInfo;
struct sigaction OrigSigUsr1;
int DesiredDepth;
int OriginalVT;
int ConsoleFD;
int FrameBufferFD;
caddr_t FrameBuffer; /**< \brief start of mmap'd framebuffer */
int FrameBufferSize; /**< in bytes */
caddr_t MMIOAddress; /**< \brief start of mmap'd MMIO region */
int MMIOSize; /**< in bytes */
int NumWindows;
Window TheWindow; /**< only allow one window for now */
int cpp;
/**
* \name Visual configurations
*/
/*@{*/
int numConfigs; /**< \brief number of visuals */
__GLXvisualConfig *configs; /**< \brief list of visuals */
/*@}*/
/**
* \name From __GLXdisplayPrivate
*/
/*@{*/
CreateScreenFunc createScreen;
__DRIscreen driScreen;
void *dlHandle; /**<
* \brief handle to the client dynamic
* library
*/
/*@}*/
/**
* \name New driver hooks
*/
/*@{*/
InitFBDevFunc driverInitFBDev;
HaltFBDevFunc driverHaltFBDev;
/*@}*/
/**
* \name Configuration details
*
* \todo Will come from a file, hardcoded for now
* \todo Can we get chipset from fbdev? -- kindof, see fbdevhw.c
*/
/*@{*/
const char *fbdevDevice;
const char *clientDriverName;
const char *drmModuleName;
const char *pciBusID;
int pciBus;
int pciDevice;
int pciFunc;
int chipset;
/*@}*/
/**
* \name From DRIInfoRec
*/
/*@{*/
int drmFD;
unsigned long hSAREA;
unsigned long hFrameBuffer;
unsigned int serverContext; /* temporary drm context -- make an auto var? */
int SAREASize;
void *pSAREA;
/*@}*/
/**
* \name Driver private
*
* Populated by __driInitFBDev()
*/
/*@{*/
void *driverInfo;
void *driverClientMsg;
int driverClientMsgSize;
/*@}*/
};
/**
* \warning Do not change ::_XF86DRIClipRect without changing the kernel
* structure!
*/
typedef struct _XF86DRIClipRect {
unsigned short x1; /**< \brief Upper: inclusive */
unsigned short y1; /**< \brief Left: inclusive */
unsigned short x2; /**< \brief Lower: exclusive */
unsigned short y2; /**< \brief Right: exclusive */
} XF86DRIClipRectRec, *XF86DRIClipRectPtr;
extern __DRIscreen *__glXFindDRIScreen(Display *dpy, int scrn);
extern Bool __glXWindowExists(Display *dpy, GLXDrawable draw);
#endif /* !_mini_GLX_client_h_ */
|