Add an install target
[mesa.git] / include / GL / glfbdev.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 5.1
4 *
5 * Copyright (C) 1999-2003 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 /* avoid including linux/fb.h */
31 struct fb_fix_screeninfo;
32 struct fb_var_screeninfo;
33
34
35 /* public types */
36 typedef struct GLFBDevVisualRec *GLFBDevVisualPtr;
37 typedef struct GLFBDevBufferRec *GLFBDevBufferPtr;
38 typedef struct GLFBDevContextRec *GLFBDevContextPtr;
39
40
41 /* API version */
42 #define GLFBDEV_VERSION_1_0 1
43
44
45 /* For glFBDevCreateVisual */
46 #define GLFBDEV_DOUBLE_BUFFER 100
47 #define GLFBDEV_COLOR_INDEX 101
48 #define GLFBDEV_DEPTH_SIZE 102
49 #define GLFBDEV_STENCIL_SIZE 103
50 #define GLFBDEV_ACCUM_SIZE 104
51 #define GLFBDEV_LEVEL 105
52 #define GLFBDEV_NONE 0
53
54 /* For glFBDevGetString */
55 #define GLFBDEV_VERSION 200
56 #define GLFBDEV_VENDOR 201
57
58
59 /* Misc functions */
60
61 extern const char *
62 glFBDevGetString( int str );
63
64
65 extern const void *
66 glFBDevGetProcAddress( const char *procName );
67
68
69
70 /**
71 * Create a GLFBDevVisual.
72 * \param fixInfo - needed to get the visual types, etc.
73 * \param varInfo - needed to get the bits_per_pixel, etc.
74 * \param attribs - for requesting depth, stencil, accum buffers, etc.
75 */
76 extern GLFBDevVisualPtr
77 glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
78 const struct fb_var_screeninfo *varInfo,
79 const int *attribs );
80
81 extern void
82 glFBDevDestroyVisual( GLFBDevVisualPtr visual );
83
84 extern int
85 glFBDevGetVisualAttrib( const GLFBDevVisualPtr visual, int attrib);
86
87
88
89 /**
90 * Create a GLFBDevBuffer.
91 * \param fixInfo, varInfo - needed in order to get the screen size
92 * (resolution), etc.
93 * \param visual - as returned by glFBDevCreateVisual()
94 * \param frontBuffer - address of front color buffer
95 * \param backBuffer - address of back color buffer (may be NULL)
96 * \param size - size of the color buffer(s) in bytes.
97 */
98 extern GLFBDevBufferPtr
99 glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
100 const struct fb_var_screeninfo *varInfo,
101 const GLFBDevVisualPtr visual,
102 void *frontBuffer, void *backBuffer, size_t size );
103
104 extern void
105 glFBDevDestroyBuffer( GLFBDevBufferPtr buffer );
106
107 extern int
108 glFBDevGetBufferAttrib( const GLFBDevBufferPtr buffer, int attrib);
109
110 extern GLFBDevBufferPtr
111 glFBDevGetCurrentDrawBuffer( void );
112
113 extern GLFBDevBufferPtr
114 glFBDevGetCurrentReadBuffer( void );
115
116 extern void
117 glFBDevSwapBuffers( GLFBDevBufferPtr buffer );
118
119
120
121 /**
122 * Create a GLFBDevContext.
123 * \param visual - as created by glFBDevCreateVisual.
124 * \param share - specifies another context with which to share textures,
125 * display lists, etc. (may be NULL).
126 */
127 extern GLFBDevContextPtr
128 glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share );
129
130 extern void
131 glFBDevDestroyContext( GLFBDevContextPtr context );
132
133 extern int
134 glFBDevGetContextAttrib( const GLFBDevContextPtr context, int attrib);
135
136 extern GLFBDevContextPtr
137 glFBDevGetCurrentContext( void );
138
139 extern int
140 glFBDevMakeCurrent( GLFBDevContextPtr context,
141 GLFBDevBufferPtr drawBuffer,
142 GLFBDevBufferPtr readBuffer );
143
144
145 #endif /* GLFBDEV_H */