Merge branch 'xa_branch'
[mesa.git] / include / GL / glfbdev.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 *
5 * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26 #ifndef GLFBDEV_H
27 #define GLFBDEV_H
28
29
30 /* for size_t */
31 #include <stdlib.h>
32
33 /* avoid including linux/fb.h */
34 struct fb_fix_screeninfo;
35 struct fb_var_screeninfo;
36
37
38 /* public types */
39 typedef struct GLFBDevVisualRec *GLFBDevVisualPtr;
40 typedef struct GLFBDevBufferRec *GLFBDevBufferPtr;
41 typedef struct GLFBDevContextRec *GLFBDevContextPtr;
42
43
44 /* API version */
45 #define GLFBDEV_VERSION_1_0 1
46
47
48 /* For glFBDevCreateVisual */
49 #define GLFBDEV_DOUBLE_BUFFER 100
50 #define GLFBDEV_COLOR_INDEX 101
51 #define GLFBDEV_DEPTH_SIZE 102
52 #define GLFBDEV_STENCIL_SIZE 103
53 #define GLFBDEV_ACCUM_SIZE 104
54 #define GLFBDEV_LEVEL 105
55 #define GLFBDEV_MULTISAMPLE 106
56 #define GLFBDEV_NONE 0
57
58 /* For glFBDevGetString */
59 #define GLFBDEV_VERSION 200
60 #define GLFBDEV_VENDOR 201
61
62
63 /* Misc functions */
64
65 extern const char *
66 glFBDevGetString( int str );
67
68
69 typedef void (*GLFBDevProc)();
70
71
72 extern GLFBDevProc
73 glFBDevGetProcAddress( const char *procName );
74
75
76
77 /**
78 * Create a GLFBDevVisual.
79 * \param fixInfo - needed to get the visual types, etc.
80 * \param varInfo - needed to get the bits_per_pixel, etc.
81 * \param attribs - for requesting depth, stencil, accum buffers, etc.
82 */
83 extern GLFBDevVisualPtr
84 glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
85 const struct fb_var_screeninfo *varInfo,
86 const int *attribs );
87
88 extern void
89 glFBDevDestroyVisual( GLFBDevVisualPtr visual );
90
91 extern int
92 glFBDevGetVisualAttrib( const GLFBDevVisualPtr visual, int attrib);
93
94
95
96 /**
97 * Create a GLFBDevBuffer.
98 * \param fixInfo, varInfo - needed in order to get the screen size
99 * (resolution), etc.
100 * \param visual - as returned by glFBDevCreateVisual()
101 * \param frontBuffer - address of front color buffer
102 * \param backBuffer - address of back color buffer (may be NULL)
103 * \param size - size of the color buffer(s) in bytes.
104 */
105 extern GLFBDevBufferPtr
106 glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
107 const struct fb_var_screeninfo *varInfo,
108 const GLFBDevVisualPtr visual,
109 void *frontBuffer, void *backBuffer, size_t size );
110
111 extern void
112 glFBDevDestroyBuffer( GLFBDevBufferPtr buffer );
113
114 extern int
115 glFBDevGetBufferAttrib( const GLFBDevBufferPtr buffer, int attrib);
116
117 extern GLFBDevBufferPtr
118 glFBDevGetCurrentDrawBuffer( void );
119
120 extern GLFBDevBufferPtr
121 glFBDevGetCurrentReadBuffer( void );
122
123 extern void
124 glFBDevSwapBuffers( GLFBDevBufferPtr buffer );
125
126
127
128 /**
129 * Create a GLFBDevContext.
130 * \param visual - as created by glFBDevCreateVisual.
131 * \param share - specifies another context with which to share textures,
132 * display lists, etc. (may be NULL).
133 */
134 extern GLFBDevContextPtr
135 glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share );
136
137 extern void
138 glFBDevDestroyContext( GLFBDevContextPtr context );
139
140 extern int
141 glFBDevGetContextAttrib( const GLFBDevContextPtr context, int attrib);
142
143 extern GLFBDevContextPtr
144 glFBDevGetCurrentContext( void );
145
146 extern int
147 glFBDevMakeCurrent( GLFBDevContextPtr context,
148 GLFBDevBufferPtr drawBuffer,
149 GLFBDevBufferPtr readBuffer );
150
151
152 #endif /* GLFBDEV_H */