Author: laurent
Date: 2009-08-04 23:04:32 +0200 (Tue, 04 Aug 2009)
New Revision: 537
Modified:
trunk/openbios-devel/config/examples/cross-ppc_config.xml
trunk/openbios-devel/config/examples/ppc_config.xml
trunk/openbios-devel/drivers/vga_vbe.c
Log:
Allows to configure screen size from the configuration files using
CONFIG_VGA_WIDTH, CONFIG_VGA_HEIGHT, CONFIG_VGA_DEPTH.
For the moment, only enabled for PPC/QEMU and VGA VBE interface.
Modified: trunk/openbios-devel/config/examples/cross-ppc_config.xml
===================================================================
--- trunk/openbios-devel/config/examples/cross-ppc_config.xml 2009-08-04 20:37:36 UTC (rev 536)
+++ trunk/openbios-devel/config/examples/cross-ppc_config.xml 2009-08-04 21:04:32 UTC (rev 537)
@@ -37,6 +37,9 @@
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
<option name="CONFIG_OFMEM" type="boolean" value="true"/>
<option name="CONFIG_OFMEM_MALLOC_ALIGN" type="integer" value="4"/>
+ <option name="CONFIG_VGA_WIDTH" type="integer" value="800"/>
+ <option name="CONFIG_VGA_HEIGHT" type="integer" value="600"/>
+ <option name="CONFIG_VGA_DEPTH" type="integer" value="8"/>
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
Modified: trunk/openbios-devel/config/examples/ppc_config.xml
===================================================================
--- trunk/openbios-devel/config/examples/ppc_config.xml 2009-08-04 20:37:36 UTC (rev 536)
+++ trunk/openbios-devel/config/examples/ppc_config.xml 2009-08-04 21:04:32 UTC (rev 537)
@@ -35,7 +35,11 @@
<option name="CONFIG_DEBLOCKER" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X8" type="boolean" value="true"/>
<option name="CONFIG_FONT_8X16" type="boolean" value="false"/>
+ <option name="CONFIG_VGA_WIDTH" type="integer" value="800"/>
+ <option name="CONFIG_VGA_HEIGHT" type="integer" value="600"/>
+ <option name="CONFIG_VGA_DEPTH" type="integer" value="8"/>
+
<!-- Filesystem Configuration -->
<option name="CONFIG_DISK_LABEL" type="boolean" value="true"/>
<option name="CONFIG_PART_SUPPORT" type="boolean" value="true"/>
Modified: trunk/openbios-devel/drivers/vga_vbe.c
===================================================================
--- trunk/openbios-devel/drivers/vga_vbe.c 2009-08-04 20:37:36 UTC (rev 536)
+++ trunk/openbios-devel/drivers/vga_vbe.c 2009-08-04 21:04:32 UTC (rev 537)
@@ -101,20 +101,41 @@
vga_build_rgb_palette();
}
+#ifdef CONFIG_VGA_WIDTH
+#define VGA_DEFAULT_WIDTH CONFIG_VGA_WIDTH
+#else
+#define VGA_DEFAULT_WIDTH 800
+#endif
+
+#ifdef CONFIG_VGA_HEIGHT
+#define VGA_DEFAULT_HEIGHT CONFIG_VGA_HEIGHT
+#else
+#define VGA_DEFAULT_HEIGHT 600
+#endif
+
+#ifdef CONFIG_VGA_DEPTH
+#define VGA_DEFAULT_DEPTH CONFIG_VGA_DEPTH
+#else
+#define VGA_DEFAULT_DEPTH 8
+#endif
+
+#define VGA_DEFAULT_LINEBYTES (VGA_DEFAULT_WIDTH*((VGA_DEFAULT_DEPTH+7)/8))
+
void vga_vbe_init(const char *path, unsigned long fb, uint32_t fb_size,
unsigned long rom, uint32_t rom_size)
{
phandle_t ph, chosen, aliases, options;
char buf[6];
- vga_vbe_set_mode(800, 600, 8);
+ vga_vbe_set_mode(VGA_DEFAULT_WIDTH, VGA_DEFAULT_HEIGHT,
+ VGA_DEFAULT_DEPTH);
ph = find_dev(path);
- set_int_property(ph, "width", 800);
- set_int_property(ph, "height", 600);
- set_int_property(ph, "depth", 8);
- set_int_property(ph, "linebytes", 800);
+ set_int_property(ph, "width", VGA_DEFAULT_WIDTH);
+ set_int_property(ph, "height", VGA_DEFAULT_HEIGHT);
+ set_int_property(ph, "depth", VGA_DEFAULT_DEPTH);
+ set_int_property(ph, "linebytes", VGA_DEFAULT_LINEBYTES);
set_int_property(ph, "address", fb & ~0x0000000F);
chosen = find_dev("/chosen");
@@ -126,9 +147,9 @@
set_property(aliases, "screen", path, strlen(path) + 1);
options = find_dev("/options");
- snprintf(buf, sizeof(buf), "%d", 800 / FONT_WIDTH);
+ snprintf(buf, sizeof(buf), "%d", VGA_DEFAULT_WIDTH / FONT_WIDTH);
set_property(options, "screen-#columns", buf, strlen(buf) + 1);
- snprintf(buf, sizeof(buf), "%d", 600 / FONT_HEIGHT);
+ snprintf(buf, sizeof(buf), "%d", VGA_DEFAULT_HEIGHT / FONT_HEIGHT);
set_property(options, "screen-#rows", buf, strlen(buf) + 1);
if (rom_size >= 8) {
@@ -143,5 +164,6 @@
}
}
- init_video(fb, 800, 600, 8, 800);
+ init_video(fb, VGA_DEFAULT_WIDTH, VGA_DEFAULT_HEIGHT,
+ VGA_DEFAULT_DEPTH, VGA_DEFAULT_LINEBYTES);
}