r200: fix multitexturing in dri2 path
[mesa.git] / src / glut / fbdev / internal.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 * Copyright (C) 1995-2006 Brian Paul
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 /*
22 * Library for glut using mesa fbdev driver
23 *
24 * Written by Sean D'Epagnier (c) 2006
25 */
26
27 #include <sys/time.h>
28 #include <linux/fb.h>
29 #include <GL/glfbdev.h>
30
31 #define MULTIHEAD /* enable multihead hacks,
32 it allows the program to continue drawing
33 without reading input when a second fbdev
34 has keyboard focus it can cause
35 screen corruption that requires C-l to fix */
36 #define HAVE_GPM
37
38 #define MAX_VSYNC 200
39
40 /* this causes these symbols to not be exported */
41 #pragma GCC visibility push(hidden)
42
43
44 /* --------- fbdev ------------ */
45 extern int Redisplay;
46 extern int Visible;
47 extern int VisibleSwitch;
48 extern int Active;
49 extern int VisiblePoll;
50 extern int Swapping, VTSwitch;
51
52 void TestVisible(void);
53 int ParseFBModes(int, int, int, int, int, int);
54 void SetVideoMode(void);
55 void CreateBuffer(void);
56 void CreateVisual(void);
57
58 extern int FrameBufferFD;
59 extern unsigned char *FrameBuffer;
60 extern unsigned char *BackBuffer;
61 extern int DisplayMode;
62
63 extern char exiterror[256];
64
65 extern struct fb_fix_screeninfo FixedInfo;
66 extern struct fb_var_screeninfo VarInfo;
67
68 extern GLFBDevContextPtr Context;
69 extern GLFBDevBufferPtr Buffer;
70 extern GLFBDevVisualPtr Visual;
71
72 /* --- colormap --- */
73 #define REVERSECMAPSIZELOG 3
74 #define REVERSECMAPSIZE (1<<REVERSECMAPSIZELOG)
75
76 extern unsigned short RedColorMap[256],
77 GreenColorMap[256],
78 BlueColorMap[256];
79 extern unsigned char ReverseColorMap[REVERSECMAPSIZE]
80 [REVERSECMAPSIZE]
81 [REVERSECMAPSIZE];
82
83 void LoadColorMap(void);
84 void RestoreColorMap(void);
85
86 /* --- mouse --- */
87 extern int MouseX, MouseY;
88 extern int CurrentCursor;
89 extern int MouseVisible;
90 extern int LastMouseTime;
91 extern int NumMouseButtons;
92
93 void InitializeCursor(void);
94 void EraseCursor(void);
95 void DrawCursor(void);
96 void SwapCursor(void);
97
98 /* --- menus --- */
99 struct GlutMenu {
100 int NumItems;
101 int x, y;
102 int width;
103 int selected;
104 struct {
105 int value;
106 int submenu;
107 char *name;
108 } *Items;
109 void (*func)(int);
110 };
111
112 extern struct GlutMenu *Menus;
113
114 extern int ActiveMenu;
115 extern int CurrentMenu;
116
117 void InitializeMenus(void);
118 void FreeMenus(void);
119 void DrawMenus(void);
120
121 int TryMenu(int, int);
122 void OpenMenu(void);
123 void CloseMenu(void);
124
125 /* --- state --- */
126 extern int AccumSize, DepthSize, StencilSize, NumSamples;
127 extern struct timeval StartTime;
128 extern int KeyboardModifiers;
129
130 /* --- input --- */
131 #ifdef HAVE_GPM
132 extern int GpmMouse;
133 #endif
134
135 extern int CurrentVT;
136 extern int ConsoleFD;
137
138 extern double MouseSpeed;
139
140 extern int KeyRepeatMode;
141
142 void InitializeVT(int);
143 void RestoreVT(void);
144 void CloseMouse(void);
145 void InitializeMouse(void);
146
147 void ReceiveInput(void);
148
149 /* --- callback --- */
150 extern void (*DisplayFunc)(void);
151 extern void (*ReshapeFunc)(int width, int height);
152 extern void (*KeyboardFunc)(unsigned char key, int x, int y);
153 extern void (*KeyboardUpFunc)(unsigned char key, int x, int y);
154 extern void (*MouseFunc)(int key, int state, int x, int y);
155 extern void (*MotionFunc)(int x, int y);
156 extern void (*PassiveMotionFunc)(int x, int y);
157 extern void (*VisibilityFunc)(int state);
158 extern void (*SpecialFunc)(int key, int x, int y);
159 extern void (*SpecialUpFunc)(int key, int x, int y);
160 extern void (*IdleFunc)(void);
161 extern void (*MenuStatusFunc)(int state, int x, int y);
162 extern void (*MenuStateFunc)(int state);
163
164 /* --- timers --- */
165 struct GlutTimer {
166 int time;
167 void (*func)(int);
168 int value;
169 struct GlutTimer *next;
170 };
171
172 extern struct GlutTimer *GlutTimers;
173
174 /* ------- Game Mode -------- */
175 extern int GameMode;
176
177 #pragma GCC visibility pop