patch to import Jon Smirl's work from Bitkeeper
[mesa.git] / src / glx / mini / dri.h
1 /**
2 * \file miniglxP.h
3 * \brief Define replacements for some X data types and define the DRI-related
4 * data structures.
5 *
6 * \note Cut down version of glxclient.h.
7 *
8 */
9
10 #ifndef _dri_h_
11 #define _dri_h_
12
13 #include "driver.h"
14
15 typedef struct __DRIscreenRec __DRIscreen; /**< \copydoc __DRIscreenRec */
16 typedef struct __DRIcontextRec __DRIcontext; /**< \copydoc __DRIcontextRec */
17 typedef struct __DRIdrawableRec __DRIdrawable; /**< \copydoc __DRIdrawableRec */
18
19 /**
20 * \brief Screen dependent methods.
21 *
22 * This structure is initialized during the MiniGLXDisplayRec::createScreen
23 * call.
24 */
25 struct __DRIscreenRec {
26 /**
27 * \brief Method to destroy the private DRI screen data.
28 */
29 void (*destroyScreen)(__DRIscreen *screen);
30
31 /**
32 * \brief Method to create the private DRI context data and initialize the
33 * context dependent methods.
34 */
35 void *(*createContext)(__DRIscreen *screen, const __GLcontextModes *glVisual,
36 void *sharedPrivate);
37 /**
38 * \brief Method to create the private DRI drawable data and initialize the
39 * drawable dependent methods.
40 */
41 void *(*createDrawable)(__DRIscreen *screen,
42 int width, int height, int index,
43 const __GLcontextModes *glVisual);
44
45 /*
46 * XXX in the future, implement this:
47 void *(*createPBuffer)(Display *dpy, int scrn, GLXPbuffer pbuffer,
48 GLXFBConfig config, __DRIdrawable *pdraw);
49 */
50
51 /**
52 * \brief Opaque pointer to private per screen direct rendering data.
53 *
54 * \c NULL if direct rendering is not supported on this screen. Never
55 * dereferenced in libGL.
56 */
57 };
58
59 /**
60 * \brief Context dependent methods.
61 *
62 * This structure is initialized during the __DRIscreenRec::createContext call.
63 */
64 struct __DRIcontextRec {
65 /**
66 * \brief Method to destroy the private DRI context data.
67 */
68 void (*destroyContext)(__DRIcontext *context);
69
70 /**
71 * \brief Method to bind a DRI drawable to a DRI graphics context.
72 *
73 * \todo XXX in the future, also pass a 'read' GLXDrawable for
74 * glXMakeCurrentReadSGI() and GLX 1.3's glXMakeContextCurrent().
75 */
76 GLboolean (*bindContext)(__DRIscreen *screen, __DRIdrawable *drawable, __DRIcontext *context);
77
78 /**
79 * \brief Method to unbind a DRI drawable to a DRI graphics context.
80 */
81 GLboolean (*unbindContext)(__DRIdrawable *drawable, __DRIcontext *context);
82 /**
83 * \brief Opaque pointer to private per context direct rendering data.
84 *
85 * NULL if direct rendering is not supported on the display or
86 * screen used to create this context. Never dereferenced in libGL.
87 */
88 };
89
90 /**
91 * \brief Drawable dependent methods.
92 *
93 * This structure is initialized during the __DRIscreenRec::createDrawable call.
94 *
95 * __DRIscreenRec::createDrawable is not called by libGL at this time. It's
96 * currently used via the dri_util.c utility code instead.
97 */
98 struct __DRIdrawableRec {
99 /**
100 * \brief Method to destroy the private DRI drawable data.
101 */
102 void (*destroyDrawable)(__DRIdrawable *drawable);
103
104
105 /**
106 * \brief Method to swap the front and back buffers.
107 */
108 void (*swapBuffers)(__DRIdrawable *drawable);
109
110 /**
111 * \brief Opaque pointer to private per drawable direct rendering data.
112 *
113 * \c NULL if direct rendering is not supported on the display or
114 * screen used to create this drawable. Never dereferenced in libGL.
115 */
116 };
117
118 typedef void *(driCreateScreenFunc)(struct DRIDriverRec *driver,
119 struct DRIDriverContextRec *driverContext);
120
121 /** This must be implemented in each driver */
122 extern driCreateScreenFunc __driCreateScreen;
123
124 #endif /* _dri_h_ */