annotate TVout/fbset/fbset.c @ 2380:c1f71b8190d1

fix error reporting bug
author szabi
date Mon, 22 Oct 2001 20:22:25 +0000
parents 3b5f5d1c5041
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 * Linux Frame Buffer Device Configuration
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
3 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
4 * © Copyright 1995-1999 by Geert Uytterhoeven
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 * (Geert.Uytterhoeven@cs.kuleuven.ac.be)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 * --------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 * This file is subject to the terms and conditions of the GNU General Public
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 * License. See the file COPYING in the main directory of the Linux
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 * distribution for more details.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 * Petr Vandrovec <vandrove@vc.cvut.cz>:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 * -grayscale, -rgba, -nonstd, VGA modes reporting
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 * Brad Midgley <brad@exodus.pht.com>:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 * -match
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 *
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
22 #include <stdarg.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
23 #include <stdlib.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
24 #include <unistd.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
25 #include <string.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
26 #include <fcntl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
27 #include <errno.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
28 #include <sys/ioctl.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
29 #include <ctype.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
30 #include <sys/stat.h>
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
31
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
32 struct file;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
33 struct inode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
35 #include "fb.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
36
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
37 #include "fbset.h"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
38
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
39
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 * Default Frame Buffer Special Device Node
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 #define DEFAULT_FRAMEBUFFER "/dev/fb0"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 * Default Video Mode Database File
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 #define DEFAULT_MODEDBFILE "/etc/fb.modes"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 * Command Line Options
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 static const char *ProgramName;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 static int Opt_test = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 static int Opt_show = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 static int Opt_info = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 static int Opt_version = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 static int Opt_verbose = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 static int Opt_xfree86 = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 static int Opt_change = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 static int Opt_all = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 static const char *Opt_fb = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 const char *Opt_modedb = DEFAULT_MODEDBFILE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 static const char *Opt_xres = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 static const char *Opt_yres = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 static const char *Opt_vxres = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 static const char *Opt_vyres = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 static const char *Opt_depth = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 static const char *Opt_pixclock = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 static const char *Opt_left = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78 static const char *Opt_right = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 static const char *Opt_upper = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 static const char *Opt_lower = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
81 static const char *Opt_hslen = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
82 static const char *Opt_vslen = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
83 static const char *Opt_accel = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 static const char *Opt_hsync = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 static const char *Opt_vsync = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 static const char *Opt_csync = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 static const char *Opt_gsync = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 static const char *Opt_extsync = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89 static const char *Opt_bcast = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90 static const char *Opt_laced = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 static const char *Opt_double = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
92 static const char *Opt_move = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
93 static const char *Opt_step = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94 static const char *Opt_modename = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 static const char *Opt_rgba = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 static const char *Opt_nonstd = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 static const char *Opt_grayscale = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
98 static const char *Opt_matchyres = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 static struct {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
101 const char *name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 const char **value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
103 const int change;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
104 } Options[] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
105 { "-fb", &Opt_fb, 0 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
106 { "-db", &Opt_modedb, 0 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
107 { "-xres", &Opt_xres, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
108 { "-yres", &Opt_yres, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
109 { "-vxres", &Opt_vxres, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 { "-vyres", &Opt_vyres, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111 { "-depth", &Opt_depth, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 { "-nonstd", &Opt_nonstd, 1},
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 { "-pixclock", &Opt_pixclock, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 { "-left", &Opt_left, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 { "-right", &Opt_right, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
116 { "-upper", &Opt_upper, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
117 { "-lower", &Opt_lower, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
118 { "-hslen", &Opt_hslen, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
119 { "-vslen", &Opt_vslen, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
120 { "-accel", &Opt_accel, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
121 { "-hsync", &Opt_hsync, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
122 { "-vsync", &Opt_vsync, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
123 { "-csync", &Opt_csync, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
124 { "-gsync", &Opt_gsync, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
125 { "-extsync", &Opt_extsync, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
126 { "-bcast", &Opt_bcast, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
127 { "-laced", &Opt_laced, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
128 { "-double", &Opt_double, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
129 { "-move", &Opt_move, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
130 { "-step", &Opt_step, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
131 { "-rgba", &Opt_rgba, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
132 { "-grayscale", &Opt_grayscale, 1 },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
133 { NULL, NULL, 0 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
134 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
135
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
136
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
137 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
138 * Video Mode Database
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
139 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
140
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
141 struct VideoMode *VideoModes = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
142
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
143
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
144 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
145 * Hardware Text Modes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
146 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
147
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
148 static struct textentry {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
149 __u32 id;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
150 const char *name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
151 } Textmodes[] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
152 { FB_AUX_TEXT_MDA, "Monochrome text" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
153 { FB_AUX_TEXT_CGA, "CGA/EGA/VGA Color text" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
154 { FB_AUX_TEXT_S3_MMIO, "S3 MMIO fasttext" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
155 { FB_AUX_TEXT_MGA_STEP16, "MGA Millennium I step 16 text" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
156 { FB_AUX_TEXT_MGA_STEP8, "MGA step 8 text" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
157 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
158
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
159 static struct textentry VGAModes[] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
160 { FB_AUX_VGA_PLANES_VGA4, "VGA 16 colors in 4 planes" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
161 { FB_AUX_VGA_PLANES_CFB4, "VGA 16 colors in 1 plane" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
162 { FB_AUX_VGA_PLANES_CFB8, "VGA 256 colors in 4 planes" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
163 /* last entry has name == NULL */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
164 { 0, NULL}
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
165 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
166
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
167 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
168 * Hardware Accelerators
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
169 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
170
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
171 static struct accelentry {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
172 __u32 id;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
173 const char *name;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
174 } Accelerators[] = {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
175 { FB_ACCEL_NONE, "No" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
176 { FB_ACCEL_ATARIBLITT, "Atari Blitter" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
177 { FB_ACCEL_AMIGABLITT, "Amiga Blitter" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
178 { FB_ACCEL_S3_TRIO64, "S3 Trio64" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
179 { FB_ACCEL_NCR_77C32BLT, "NCR 77C32BLT" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
180 { FB_ACCEL_S3_VIRGE, "S3 ViRGE" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
181 { FB_ACCEL_ATI_MACH64GX, "ATI Mach64GX" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
182 { FB_ACCEL_DEC_TGA, "DEC 21030 TGA" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
183 { FB_ACCEL_ATI_MACH64CT, "ATI Mach64CT" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
184 { FB_ACCEL_ATI_MACH64VT, "ATI Mach64VT" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
185 { FB_ACCEL_ATI_MACH64GT, "ATI Mach64GT" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
186 { FB_ACCEL_SUN_CREATOR, "Sun Creator/Creator3D" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
187 { FB_ACCEL_SUN_CGSIX, "Sun cg6" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
188 { FB_ACCEL_SUN_LEO, "Sun leo/zx" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
189 { FB_ACCEL_IMS_TWINTURBO, "IMS Twin Turbo" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
190 { FB_ACCEL_3DLABS_PERMEDIA2, "3Dlabs Permedia 2" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
191 { FB_ACCEL_MATROX_MGA2064W, "Matrox MGA2064W (Millennium)" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
192 { FB_ACCEL_MATROX_MGA1064SG, "Matrox MGA1064SG (Mystique)" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
193 { FB_ACCEL_MATROX_MGA2164W, "Matrox MGA2164W (Millennium II)" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
194 { FB_ACCEL_MATROX_MGA2164W_AGP, "Matrox MGA2164W (Millennium II AGP)" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
195 { FB_ACCEL_MATROX_MGAG100, "Matrox G100 (Productiva G100)" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
196 { FB_ACCEL_MATROX_MGAG200, "Matrox G200 (Millennium, Mystique)" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
197 { FB_ACCEL_SUN_CG14, "Sun cg14" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
198 { FB_ACCEL_SUN_BWTWO, "Sun bw2" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
199 { FB_ACCEL_SUN_CGTHREE, "Sun cg3" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
200 { FB_ACCEL_SUN_TCX, "Sun tcx" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
201 { FB_ACCEL_MATROX_MGAG400, "Matrox G400" },
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
202 };
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
203
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
204
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
205 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
206 * Current Video Mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
207 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
208
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
209 struct VideoMode Current;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
210
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
211
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
212 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
213 * Function Prototypes
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
214 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
215
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
216 int OpenFrameBuffer(const char *name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
217 void CloseFrameBuffer(int fh);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
218 void GetVarScreenInfo(int fh, struct fb_var_screeninfo *var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
219 void SetVarScreenInfo(int fh, struct fb_var_screeninfo *var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
220 void GetFixScreenInfo(int fh, struct fb_fix_screeninfo *fix);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
221 static void ConvertFromVideoMode(const struct VideoMode *vmode,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
222 struct fb_var_screeninfo *var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
223 static void ConvertToVideoMode(const struct fb_var_screeninfo *var,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
224 struct VideoMode *vmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
225 static int atoboolean(const char *var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
226 static void ReadModeDB(void);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
227 static struct VideoMode *FindVideoMode(const char *name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
228 static void ModifyVideoMode(struct VideoMode *vmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
229 static void DisplayVModeInfo(struct VideoMode *vmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
230 static void DisplayFBInfo(struct fb_fix_screeninfo *fix);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
231 static int FillScanRates(struct VideoMode *vmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
232 static void Usage(void) __attribute__ ((noreturn));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
233 int main(int argc, char *argv[]);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
234
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
235
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
236 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
237 * Print an Error Message and Exit
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
238 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
239
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
240 void Die(const char *fmt, ...)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
241 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
242 va_list ap;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
243
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
244 fflush(stdout);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
245 va_start(ap, fmt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
246 vfprintf(stderr, fmt, ap);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
247 va_end(ap);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
248 exit(1);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
249 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
250
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
251
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
252 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
253 * Open the Frame Buffer Device
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
254 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
255
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
256 int OpenFrameBuffer(const char *name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
257 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
258 int fh;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
259
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
260 if (Opt_verbose)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
261 printf("Opening frame buffer device `%s'\n", name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
262
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
263 if ((fh = open(name, O_RDONLY)) == -1)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
264 Die("open %s: %s\n", name, strerror(errno));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
265 return fh;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
266 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
267
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
268
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
269 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
270 * Close the Frame Buffer Device
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
271 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
272
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
273 void CloseFrameBuffer(int fh)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
274 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
275 close(fh);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
276 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
277
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
278 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
279 * Get the Variable Part of the Screen Info
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
280 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
281
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
282 void GetVarScreenInfo(int fh, struct fb_var_screeninfo *var)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
283 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
284 if (ioctl(fh, FBIOGET_VSCREENINFO, var))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
285 Die("ioctl FBIOGET_VSCREENINFO: %s\n", strerror(errno));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
286 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
287
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
288
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
289 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
290 * Set (and Get) the Variable Part of the Screen Info
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
291 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
292
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
293 void SetVarScreenInfo(int fh, struct fb_var_screeninfo *var)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
294 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
295 if (ioctl(fh, FBIOPUT_VSCREENINFO, var))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
296 Die("ioctl FBIOPUT_VSCREENINFO: %s\n", strerror(errno));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
297 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
298
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
299
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
300 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
301 * Get the Fixed Part of the Screen Info
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
302 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
303
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
304 void GetFixScreenInfo(int fh, struct fb_fix_screeninfo *fix)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
305 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
306 if (ioctl(fh, FBIOGET_FSCREENINFO, fix))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
307 Die("ioctl FBIOGET_FSCREENINFO: %s\n", strerror(errno));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
308 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
309
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
310
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
311 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
312 * Conversion Routines
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
313 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
314
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
315 static void ConvertFromVideoMode(const struct VideoMode *vmode,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
316 struct fb_var_screeninfo *var)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
317 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
318 memset(var, 0, sizeof(struct fb_var_screeninfo));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
319 var->xres = vmode->xres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
320 var->yres = vmode->yres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
321 var->xres_virtual = vmode->vxres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
322 var->yres_virtual = vmode->vyres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
323 var->bits_per_pixel = vmode->depth;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
324 var->nonstd = vmode->nonstd;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
325 if (Opt_test)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
326 var->activate = FB_ACTIVATE_TEST;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
327 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
328 var->activate = FB_ACTIVATE_NOW;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
329 if (Opt_all)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
330 var->activate = FB_ACTIVATE_ALL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
331 var->accel_flags = vmode->accel_flags;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
332 var->pixclock = vmode->pixclock;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
333 var->left_margin = vmode->left;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
334 var->right_margin = vmode->right;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
335 var->upper_margin = vmode->upper;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
336 var->lower_margin = vmode->lower;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
337 var->hsync_len = vmode->hslen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
338 var->vsync_len = vmode->vslen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
339 if (vmode->hsync == HIGH)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
340 var->sync |= FB_SYNC_HOR_HIGH_ACT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
341 if (vmode->vsync == HIGH)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
342 var->sync |= FB_SYNC_VERT_HIGH_ACT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
343 if (vmode->csync == HIGH)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
344 var->sync |= FB_SYNC_COMP_HIGH_ACT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
345 if (vmode->gsync == HIGH)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
346 var->sync |= FB_SYNC_ON_GREEN;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
347 if (vmode->extsync == TRUE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
348 var->sync |= FB_SYNC_EXT;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
349 if (vmode->bcast == TRUE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
350 var->sync |= FB_SYNC_BROADCAST;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
351 if (vmode->laced == TRUE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
352 var->vmode = FB_VMODE_INTERLACED;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
353 else if (vmode->dblscan == TRUE)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
354 var->vmode = FB_VMODE_DOUBLE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
355 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
356 var->vmode = FB_VMODE_NONINTERLACED;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
357 var->vmode |= FB_VMODE_CONUPDATE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
358 var->red.length = vmode->red.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
359 var->red.offset = vmode->red.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
360 var->green.length = vmode->green.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
361 var->green.offset = vmode->green.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
362 var->blue.length = vmode->blue.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
363 var->blue.offset = vmode->blue.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
364 var->transp.length = vmode->transp.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
365 var->transp.offset = vmode->transp.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
366 var->grayscale = vmode->grayscale;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
367 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
368
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
369
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
370 static void ConvertToVideoMode(const struct fb_var_screeninfo *var,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
371 struct VideoMode *vmode)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
372 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
373 vmode->name = NULL;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
374 vmode->xres = var->xres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
375 vmode->yres = var->yres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
376 vmode->vxres = var->xres_virtual;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
377 vmode->vyres = var->yres_virtual;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
378 vmode->depth = var->bits_per_pixel;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
379 vmode->nonstd = var->nonstd;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
380 vmode->accel_flags = var->accel_flags;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
381 vmode->pixclock = var->pixclock;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
382 vmode->left = var->left_margin;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
383 vmode->right = var->right_margin;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
384 vmode->upper = var->upper_margin;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
385 vmode->lower = var->lower_margin;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
386 vmode->hslen = var->hsync_len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
387 vmode->vslen = var->vsync_len;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
388 vmode->hsync = var->sync & FB_SYNC_HOR_HIGH_ACT ? HIGH : LOW;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
389 vmode->vsync = var->sync & FB_SYNC_VERT_HIGH_ACT ? HIGH : LOW;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
390 vmode->csync = var->sync & FB_SYNC_COMP_HIGH_ACT ? HIGH : LOW;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
391 vmode->gsync = var->sync & FB_SYNC_ON_GREEN ? TRUE : FALSE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
392 vmode->extsync = var->sync & FB_SYNC_EXT ? TRUE : FALSE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
393 vmode->bcast = var->sync & FB_SYNC_BROADCAST ? TRUE : FALSE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
394 vmode->grayscale = var->grayscale;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
395 vmode->laced = FALSE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
396 vmode->dblscan = FALSE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
397 switch (var->vmode & FB_VMODE_MASK) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
398 case FB_VMODE_INTERLACED:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
399 vmode->laced = TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
400 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
401 case FB_VMODE_DOUBLE:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
402 vmode->dblscan = TRUE;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
403 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
404 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
405 vmode->red.length = var->red.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
406 vmode->red.offset = var->red.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
407 vmode->green.length = var->green.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
408 vmode->green.offset = var->green.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
409 vmode->blue.length = var->blue.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
410 vmode->blue.offset = var->blue.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
411 vmode->transp.length = var->transp.length;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
412 vmode->transp.offset = var->transp.offset;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
413 FillScanRates(vmode);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
414 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
415
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
416
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
417 static int atoboolean(const char *var)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
418 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
419 int value = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
420
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
421 if (!strcasecmp(var, "false") || !strcasecmp(var, "low") ||
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
422 !strcasecmp(var, "no") || !strcasecmp(var, "off") ||
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
423 !strcmp(var, "0"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
424 value = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
425 else if (!strcasecmp(var, "true") || !strcasecmp(var, "high") ||
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
426 !strcasecmp(var, "yes") || !strcasecmp(var, "on") ||
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
427 !strcmp(var, "1"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
428 value = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
429 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
430 Die("Invalid value `%s'\n", var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
431
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
432 return value;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
433 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
434
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
435
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
436 void AddVideoMode(const struct VideoMode *vmode)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
437 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
438 struct VideoMode *vmode2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
439
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
440 if (FindVideoMode(vmode->name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
441 Die("%s:%d: Duplicate mode name `%s'\n", Opt_modedb, line,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
442 vmode->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
443 vmode2 = malloc(sizeof(struct VideoMode));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
444 *vmode2 = *vmode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
445 if (!FillScanRates(vmode2))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
446 Die("%s:%d: Bad video mode `%s'\n", Opt_modedb, line, vmode2->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
447 vmode2->next = VideoModes;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
448 VideoModes = vmode2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
449 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
450
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
451
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
452 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
453 * Read the Video Mode Database
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
454 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
455
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
456 static void ReadModeDB(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
457 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
458 if (Opt_verbose)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
459 printf("Reading mode database from file `%s'\n", Opt_modedb);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
460
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
461 if (!(yyin = fopen(Opt_modedb, "r")))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
462 Die("fopen %s: %s\n", Opt_modedb, strerror(errno));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
463 yyparse();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
464 fclose(yyin);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
465 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
466
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
467
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
468 static void getColor(struct color *color, const char** opt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
469 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
470 char* ptr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
471
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
472 color->length = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
473 color->offset = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
474 ptr = (char*)(*opt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
475 if (!ptr)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
476 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
477 color->length = strtoul(ptr, &ptr, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
478 if (!ptr)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
479 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
480 if (*ptr == '/')
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
481 color->offset = strtoul(ptr+1, &ptr, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
482 if (ptr) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
483 while (*ptr && isspace(*ptr))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
484 ptr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
485 if (*ptr == ',') {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
486 ptr++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
487 } else if (*ptr)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
488 Die("Bad RGBA syntax, rL/rO,gL/gO,bL/bO,tL/tO or rL,gL,bL,tL\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
489 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
490 *opt = ptr;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
491 return;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
492 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
493
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
494 void makeRGBA(struct VideoMode *vmode, const char* opt)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
495 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
496 getColor(&vmode->red, &opt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
497 getColor(&vmode->green, &opt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
498 getColor(&vmode->blue, &opt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
499 getColor(&vmode->transp, &opt);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
500 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
501
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
502 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
503 * Find a Video Mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
504 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
505
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
506 static struct VideoMode *FindVideoMode(const char *name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
507 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
508 struct VideoMode *vmode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
509
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
510 for (vmode = VideoModes; vmode; vmode = vmode->next)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
511 if (!strcmp(name, vmode->name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
512 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
513
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
514 return vmode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
515 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
516
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
517
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
518 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
519 * Modify a Video Mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
520 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
521
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
522 static void ModifyVideoMode(struct VideoMode *vmode)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
523 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
524 u_int hstep = 8, vstep = 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
525
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
526 if (Opt_xres)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
527 vmode->xres = strtoul(Opt_xres, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
528 if (Opt_yres)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
529 vmode->yres = strtoul(Opt_yres, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
530 if (Opt_vxres)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
531 vmode->vxres = strtoul(Opt_vxres, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
532 if (Opt_vyres)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
533 vmode->vyres = strtoul(Opt_vyres, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
534 if (Opt_depth)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
535 vmode->depth = strtoul(Opt_depth, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
536 if (Opt_nonstd)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
537 vmode->nonstd = strtoul(Opt_nonstd, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
538 if (Opt_accel)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
539 vmode->accel_flags = atoboolean(Opt_accel) ? FB_ACCELF_TEXT : 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
540 if (Opt_pixclock)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
541 vmode->pixclock = strtoul(Opt_pixclock, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
542 if (Opt_left)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
543 vmode->left = strtoul(Opt_left, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
544 if (Opt_right)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
545 vmode->right = strtoul(Opt_right, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
546 if (Opt_upper)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
547 vmode->upper = strtoul(Opt_upper, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
548 if (Opt_lower)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
549 vmode->lower = strtoul(Opt_lower, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
550 if (Opt_hslen)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
551 vmode->hslen = strtoul(Opt_hslen, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
552 if (Opt_vslen)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
553 vmode->vslen = strtoul(Opt_vslen, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
554 if (Opt_hsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
555 vmode->hsync = atoboolean(Opt_hsync);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
556 if (Opt_vsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
557 vmode->vsync = atoboolean(Opt_vsync);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
558 if (Opt_csync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
559 vmode->csync = atoboolean(Opt_csync);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
560 if (Opt_gsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
561 vmode->gsync = atoboolean(Opt_gsync);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
562 if (Opt_extsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
563 vmode->extsync = atoboolean(Opt_extsync);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
564 if (Opt_bcast)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
565 vmode->bcast = atoboolean(Opt_bcast);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
566 if (Opt_laced)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
567 vmode->laced = atoboolean(Opt_laced);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
568 if (Opt_double)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
569 vmode->dblscan = atoboolean(Opt_double);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
570 if (Opt_grayscale)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
571 vmode->grayscale = atoboolean(Opt_grayscale);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
572 if (Opt_step)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
573 hstep = vstep = strtoul(Opt_step, NULL, 0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
574 if (Opt_matchyres)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
575 vmode->vyres = vmode->yres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
576 if (Opt_move) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
577 if (!strcasecmp(Opt_move, "left")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
578 if (hstep > vmode->left)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
579 Die("The left margin cannot be negative\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
580 vmode->left -= hstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
581 vmode->right += hstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
582 } else if (!strcasecmp(Opt_move, "right")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
583 if (hstep > vmode->right)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
584 Die("The right margin cannot be negative\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
585 vmode->left += hstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
586 vmode->right -= hstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
587 } else if (!strcasecmp(Opt_move, "up")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
588 if (vstep > vmode->upper)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
589 Die("The upper margin cannot be negative\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
590 vmode->upper -= vstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
591 vmode->lower += vstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
592 } else if (!strcasecmp(Opt_move, "down")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
593 if (vstep > vmode->lower)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
594 Die("The lower margin cannot be negative\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
595 vmode->upper += vstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
596 vmode->lower -= vstep;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
597 } else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
598 Die("Invalid direction `%s'\n", Opt_move);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
599 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
600 if (Opt_rgba) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
601 makeRGBA(vmode, Opt_rgba);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
602 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
603 if (!FillScanRates(vmode))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
604 Die("Bad video mode\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
605 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
606
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
607
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
608 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
609 * Display the Video Mode Information
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
610 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
611
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
612 static void DisplayVModeInfo(struct VideoMode *vmode)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
613 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
614 u_int res, sstart, send, total;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
615
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
616 puts("");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
617 if (!Opt_xfree86) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
618 printf("mode \"%dx%d", vmode->xres, vmode->yres);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
619 if (vmode->pixclock) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
620 printf("-%d\"\n", (int)(vmode->vrate+0.5));
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
621 printf(" # D: %5.3f MHz, H: %5.3f kHz, V: %5.3f Hz\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
622 vmode->drate/1E6, vmode->hrate/1E3, vmode->vrate);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
623 } else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
624 puts("\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
625 printf(" geometry %d %d %d %d %d\n", vmode->xres, vmode->yres,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
626 vmode->vxres, vmode->vyres, vmode->depth);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
627 printf(" timings %d %d %d %d %d %d %d\n", vmode->pixclock,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
628 vmode->left, vmode->right, vmode->upper, vmode->lower,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
629 vmode->hslen, vmode->vslen);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
630 if (vmode->hsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
631 puts(" hsync high");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
632 if (vmode->vsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
633 puts(" vsync high");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
634 if (vmode->csync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
635 puts(" csync high");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
636 if (vmode->gsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
637 puts(" gsync true");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
638 if (vmode->extsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
639 puts(" extsync true");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
640 if (vmode->bcast)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
641 puts(" bcast true");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
642 if (vmode->laced)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
643 puts(" laced true");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
644 if (vmode->dblscan)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
645 puts(" double true");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
646 if (vmode->nonstd)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
647 printf(" nonstd %u\n", vmode->nonstd);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
648 if (vmode->accel_flags)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
649 puts(" accel true");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
650 if (vmode->grayscale)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
651 puts(" grayscale true");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
652 printf(" rgba %u/%u,%u/%u,%u/%u,%u/%u\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
653 vmode->red.length, vmode->red.offset, vmode->green.length,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
654 vmode->green.offset, vmode->blue.length, vmode->blue.offset,
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
655 vmode->transp.length, vmode->transp.offset);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
656 puts("endmode\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
657 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
658 printf("Mode \"%dx%d\"\n", vmode->xres, vmode->yres);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
659 if (vmode->pixclock) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
660 printf(" # D: %5.3f MHz, H: %5.3f kHz, V: %5.3f Hz\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
661 vmode->drate/1E6, vmode->hrate/1E3, vmode->vrate);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
662 printf(" DotClock %5.3f\n", vmode->drate/1E6+0.001);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
663 } else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
664 puts(" DotClock Unknown");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
665 res = vmode->xres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
666 sstart = res+vmode->right;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
667 send = sstart+vmode->hslen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
668 total = send+vmode->left;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
669 printf(" HTimings %d %d %d %d\n", res, sstart, send, total);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
670 res = vmode->yres;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
671 sstart = res+vmode->lower;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
672 send = sstart+vmode->vslen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
673 total = send+vmode->upper;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
674 printf(" VTimings %d %d %d %d\n", res, sstart, send, total);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
675 printf(" Flags ");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
676 if (vmode->laced)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
677 printf(" \"Interlace\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
678 if (vmode->dblscan)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
679 printf(" \"DoubleScan\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
680 if (vmode->hsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
681 printf(" \"+HSync\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
682 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
683 printf(" \"-HSync\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
684 if (vmode->vsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
685 printf(" \"+VSync\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
686 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
687 printf(" \"-VSync\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
688 if (vmode->csync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
689 printf(" \"Composite\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
690 if (vmode->extsync)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
691 puts(" # Warning: XFree86 doesn't support extsync\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
692 if (vmode->bcast)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
693 printf(" \"bcast\"");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
694 if (vmode->accel_flags)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
695 puts(" # Warning: XFree86 doesn't support accel\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
696 if (vmode->grayscale)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
697 puts(" # Warning: XFree86 doesn't support grayscale\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
698 puts("\nEndMode\n");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
699 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
700 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
701
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
702
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
703 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
704 * Display the Frame Buffer Device Information
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
705 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
706
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
707 static void DisplayFBInfo(struct fb_fix_screeninfo *fix)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
708 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
709 int i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
710
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
711 puts("Frame buffer device information:");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
712 printf(" Name : %s\n", fix->id);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
713 printf(" Address : %p\n", fix->smem_start);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
714 printf(" Size : %d\n", fix->smem_len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
715 printf(" Type : ");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
716 switch (fix->type) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
717 case FB_TYPE_PACKED_PIXELS:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
718 puts("PACKED PIXELS");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
719 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
720 case FB_TYPE_PLANES:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
721 puts("PLANES");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
722 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
723 case FB_TYPE_INTERLEAVED_PLANES:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
724 printf("INTERLEAVED PLANES (%d bytes interleave)\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
725 fix->type_aux);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
726 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
727 case FB_TYPE_TEXT:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
728 for (i = 0; i < sizeof(Textmodes)/sizeof(*Textmodes); i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
729 if (fix->type_aux == Textmodes[i].id)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
730 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
731 if (i < sizeof(Textmodes)/sizeof(*Textmodes))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
732 puts(Textmodes[i].name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
733 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
734 printf("Unknown text (%d)\n", fix->type_aux);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
735 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
736 case FB_TYPE_VGA_PLANES:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
737 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
738 struct textentry *t;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
739
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
740 for (t = VGAModes; t->name; t++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
741 if (fix->type_aux == t->id)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
742 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
743 if (t->name)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
744 puts(t->name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
745 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
746 printf("Unknown VGA mode (%d)\n", fix->type_aux);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
747 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
748 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
749 default:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
750 printf("%d (UNKNOWN)\n", fix->type);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
751 printf(" Type_aux : %d\n", fix->type_aux);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
752 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
753 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
754 printf(" Visual : ");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
755 switch (fix->visual) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
756 case FB_VISUAL_MONO01:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
757 puts("MONO01");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
758 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
759 case FB_VISUAL_MONO10:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
760 puts("MONO10");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
761 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
762 case FB_VISUAL_TRUECOLOR:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
763 puts("TRUECOLOR");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
764 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
765 case FB_VISUAL_PSEUDOCOLOR:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
766 puts("PSEUDOCOLOR");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
767 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
768 case FB_VISUAL_DIRECTCOLOR:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
769 puts("DIRECTCOLOR");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
770 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
771 case FB_VISUAL_STATIC_PSEUDOCOLOR:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
772 puts("STATIC PSEUDOCOLOR");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
773 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
774 default:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
775 printf("%d (UNKNOWN)\n", fix->visual);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
776 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
777 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
778 printf(" XPanStep : %d\n", fix->xpanstep);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
779 printf(" YPanStep : %d\n", fix->ypanstep);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
780 printf(" YWrapStep : %d\n", fix->ywrapstep);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
781 printf(" LineLength : %d\n", fix->line_length);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
782 if (fix->mmio_len) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
783 printf(" MMIO Address: %p\n", fix->mmio_start);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
784 printf(" MMIO Size : %d\n", fix->mmio_len);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
785 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
786 printf(" Accelerator : ");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
787 for (i = 0; i < sizeof(Accelerators)/sizeof(*Accelerators); i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
788 if (fix->accel == Accelerators[i].id)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
789 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
790 if (i < sizeof(Accelerators)/sizeof(*Accelerators))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
791 puts(Accelerators[i].name);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
792 else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
793 printf("Unknown (%d)\n", fix->accel);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
794 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
795
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
796
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
797 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
798 * Calculate the Scan Rates for a Video Mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
799 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
800
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
801 static int FillScanRates(struct VideoMode *vmode)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
802 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
803 u_int htotal = vmode->left+vmode->xres+vmode->right+vmode->hslen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
804 u_int vtotal = vmode->upper+vmode->yres+vmode->lower+vmode->vslen;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
805
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
806 if (vmode->dblscan)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
807 vtotal <<= 2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
808 else if (!vmode->laced)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
809 vtotal <<= 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
810
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
811 if (!htotal || !vtotal)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
812 return 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
813
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
814 if (vmode->pixclock) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
815 vmode->drate = 1E12/vmode->pixclock;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
816 vmode->hrate = vmode->drate/htotal;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
817 vmode->vrate = vmode->hrate/vtotal*2;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
818 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
819 vmode->drate = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
820 vmode->hrate = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
821 vmode->vrate = 0;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
822 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
823
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
824 return 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
825 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
826
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
827
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
828 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
829 * Print the Usage Template and Exit
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
830 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
831
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
832 static void Usage(void)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
833 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
834 puts(VERSION);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
835 Die("\nUsage: %s [options] [mode]\n\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
836 "Valid options:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
837 " General options:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
838 " -h, --help : display this usage information\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
839 " --test : don't change, just test whether the mode is "
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
840 "valid\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
841 " -s, --show : display video mode settings\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
842 " -i, --info : display all frame buffer information\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
843 " -v, --verbose : verbose mode\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
844 " -V, --version : print version information\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
845 " -x, --xfree86 : XFree86 compatibility mode\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
846 " -a, --all : change all virtual consoles on this device\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
847 " Frame buffer special device nodes:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
848 " -fb <device> : processed frame buffer device\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
849 " (default is " DEFAULT_FRAMEBUFFER ")\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
850 " Video mode database:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
851 " -db <file> : video mode database file\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
852 " (default is " DEFAULT_MODEDBFILE ")\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
853 " Display geometry:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
854 " -xres <value> : horizontal resolution (in pixels)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
855 " -yres <value> : vertical resolution (in pixels)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
856 " -vxres <value> : virtual horizontal resolution (in pixels)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
857 " -vyres <value> : virtual vertical resolution (in pixels)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
858 " -depth <value> : display depth (in bits per pixel)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
859 " -nonstd <value> : select nonstandard video mode\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
860 " -g, --geometry ... : set all geometry parameters at once\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
861 " -match : set virtual vertical resolution by virtual resolution\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
862 " Display timings:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
863 " -pixclock <value> : pixel clock (in picoseconds)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
864 " -left <value> : left margin (in pixels)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
865 " -right <value> : right margin (in pixels)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
866 " -upper <value> : upper margin (in pixel lines)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
867 " -lower <value> : lower margin (in pixel lines)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
868 " -hslen <value> : horizontal sync length (in pixels)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
869 " -vslen <value> : vertical sync length (in pixel lines)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
870 " -t, --timings ... : set all timing parameters at once\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
871 " Display flags:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
872 " -accel <value> : hardware text acceleration enable (false or "
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
873 "true)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
874 " -hsync <value> : horizontal sync polarity (low or high)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
875 " -vsync <value> : vertical sync polarity (low or high)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
876 " -csync <value> : composite sync polarity (low or high)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
877 " -gsync <value> : synch on green (false or true)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
878 " -extsync <value> : external sync enable (false or true)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
879 " -bcast <value> : broadcast enable (false or true)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
880 " -laced <value> : interlace enable (false or true)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
881 " -double <value> : doublescan enable (false or true)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
882 " -rgba <r,g,b,a> : recommended length of color entries\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
883 " -grayscale <value> : grayscale enable (false or true)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
884 " Display positioning:\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
885 " -move <direction> : move the visible part (left, right, up or "
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
886 "down)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
887 " -step <value> : step increment (in pixels or pixel lines)\n"
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
888 " (default is 8 horizontal, 2 vertical)\n",
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
889 ProgramName);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
890 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
891
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
892
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
893 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
894 * Main Routine
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
895 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
896
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
897 int main(int argc, char *argv[])
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
898 {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
899 struct VideoMode *vmode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
900 struct fb_var_screeninfo var;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
901 struct fb_fix_screeninfo fix;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
902 int fh = -1, i;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
903
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
904 ProgramName = argv[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
905
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
906 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
907 * Parse the Options
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
908 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
909
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
910 while (--argc > 0) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
911 argv++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
912 if (!strcmp(argv[0], "-h") || !strcmp(argv[0], "--help"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
913 Usage();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
914 else if (!strcmp(argv[0], "-v") || !strcmp(argv[0], "--verbose"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
915 Opt_verbose = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
916 else if (!strcmp(argv[0], "-V") || !strcmp(argv[0], "--version"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
917 Opt_version = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
918 else if (!strcmp(argv[0], "--test"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
919 Opt_test = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
920 else if (!strcmp(argv[0], "-s") || !strcmp(argv[0], "--show"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
921 Opt_show = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
922 else if (!strcmp(argv[0], "-i") || !strcmp(argv[0], "--info")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
923 Opt_show = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
924 Opt_info = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
925 } else if (!strcmp(argv[0], "-x") || !strcmp(argv[0], "--xfree86"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
926 Opt_xfree86 = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
927 else if (!strcmp(argv[0], "-a") || !strcmp(argv[0], "--all"))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
928 Opt_all = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
929 else if (!strcmp(argv[0], "-g") || !strcmp(argv[0], "--geometry")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
930 if (argc > 5) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
931 Opt_xres = argv[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
932 Opt_yres = argv[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
933 Opt_vxres = argv[3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
934 Opt_vyres = argv[4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
935 Opt_depth = argv[5];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
936 Opt_change = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
937 argc -= 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
938 argv += 5;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
939 } else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
940 Usage();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
941 } else if (!strcmp(argv[0], "-t") || !strcmp(argv[0], "--timings")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
942 if (argc > 7) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
943 Opt_pixclock = argv[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
944 Opt_left = argv[2];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
945 Opt_right = argv[3];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
946 Opt_upper = argv[4];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
947 Opt_lower = argv[5];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
948 Opt_hslen = argv[6];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
949 Opt_vslen = argv[7];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
950 Opt_change = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
951 argc -= 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
952 argv += 7;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
953 } else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
954 Usage();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
955 } else if (!strcmp(argv[0], "-match")) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
956 Opt_matchyres = argv[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
957 Opt_change = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
958 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
959 for (i = 0; Options[i].name; i++)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
960 if (!strcmp(argv[0], Options[i].name))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
961 break;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
962 if (Options[i].name) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
963 if (argc-- > 1) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
964 *Options[i].value = argv[1];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
965 Opt_change |= Options[i].change;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
966 argv++;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
967 } else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
968 Usage();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
969 } else if (!Opt_modename) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
970 Opt_modename = argv[0];
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
971 Opt_change = 1;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
972 } else
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
973 Usage();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
974 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
975 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
976
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
977 if (Opt_version || Opt_verbose)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
978 puts(VERSION);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
979
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
980 if (!Opt_fb)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
981 Opt_fb = DEFAULT_FRAMEBUFFER;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
982
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
983 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
984 * Open the Frame Buffer Device
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
985 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
986
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
987 fh = OpenFrameBuffer(Opt_fb);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
988
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
989 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
990 * Get the Video Mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
991 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
992
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
993 if (Opt_modename) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
994
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
995 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
996 * Read the Video Mode Database
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
997 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
998
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
999 ReadModeDB();
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1000
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1001 if (!(vmode = FindVideoMode(Opt_modename)))
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1002 Die("Unknown video mode `%s'\n", Opt_modename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1003
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1004 Current = *vmode;
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1005 if (Opt_verbose)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1006 printf("Using video mode `%s'\n", Opt_modename);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1007 } else {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1008 GetVarScreenInfo(fh, &var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1009 ConvertToVideoMode(&var, &Current);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1010 if (Opt_verbose)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1011 printf("Using current video mode from `%s'\n", Opt_fb);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1012 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1013
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1014 if (Opt_change) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1015
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1016 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1017 * Optionally Modify the Video Mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1018 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1019
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1020 ModifyVideoMode(&Current);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1021
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1022 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1023 * Set the Video Mode
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1024 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1025
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1026 ConvertFromVideoMode(&Current, &var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1027 if (Opt_verbose)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1028 printf("Setting video mode to `%s'\n", Opt_fb);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1029 SetVarScreenInfo(fh, &var);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1030 ConvertToVideoMode(&var, &Current);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1031 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1032
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1033 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1034 * Display some Video Mode Information
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1035 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1036
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1037 if (Opt_show || !Opt_change)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1038 DisplayVModeInfo(&Current);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1039
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1040 if (Opt_info) {
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1041 if (Opt_verbose)
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1042 puts("Getting further frame buffer information");
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1043 GetFixScreenInfo(fh, &fix);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1044 DisplayFBInfo(&fix);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1045 }
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1046
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1047 /*
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1048 * Close the Frame Buffer Device
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1049 */
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1050
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1051 CloseFrameBuffer(fh);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1052
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1053 exit(0);
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1054 }