2006-03-14 Vesa Jaaskelainen <chaac@nic.fi>

* DISTLIST: Added include/grub/video.h, term/gfxterm.c,
        video/video.c, commands/videotest.c.  Removed term/i386/pc/vesafb.c.

        * conf/i386-pc.rmk (pkgdata_MODULES): Added video.mod,
        gfxterm.mod, videotest.mod.  Removed vga.mod, vesafb.mod.
        (video_mod_SOURCES): Added.
        (video_mod_CFLAGS): Likewise.
        (video_mod_LDFLAGS): Likewise.
        (gfxterm_mod_SOURCES): Likewise.
        (gfxterm_mod_CFLAGS): Likewise.
        (gfxterm_mod_LDFLAGS): Likewise.
        (videotest_mod_SOURCES): Likewise.
        (videotest_mod_CFLAGS): Likewise.
        (videotest_mod_LDFLAGS): Likewise.
        (vesafb_mod_SOURCES): Removed.
        (vesafb_mod_CFLAGS): Likewise.
        (vesafb_mod_LDFLAGS): Likewise.
        (vga_mod_SOURCES): Likewise.
        (vga_mod_CFLAGS): Likewise.
        (vga_mod_LDFLAGS): Likewise.

        * commands/videotest.c: New file.

        * font/manager.c (fill_with_default_glyph): Modified to use
        grub_font_glyph.
        (grub_font_get_glyph): Likewise.
        (fontmanager): Renamed from this...
        (font_manager): ... to this.

        * include/grub/font.h (grub_font_glyph): Added new structure.
        (grub_font_get_glyph): Modified to use grub_font_glyph.

        * include/grub/misc.h (grub_abs): Added as inline function.

        * include/grub/video.h: New file.

        * include/grub/i386/pc/vbe.h (GRUB_VBE_STATUS_OK): New macro.
        (GRUB_VBE_MEMORY_MODEL_PACKED_PIXEL): Likewise.
        (GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR): Likewise.
        (grub_vbe_get_controller_info): Renamed from this...
        (grub_vbe_bios_get_controller_info): ... to this.
        (grub_vbe_get_mode_info): Renamed from this...
        (grub_vbe_bios_get_mode_info): ... to this.
        (grub_vbe_set_mode): Renamed from this...
        (grub_vbe_bios_set_mode): ... to this.
        (grub_vbe_get_mode): Renamed from this...
        (grub_vbe_bios_get_mode): ... to this.
        (grub_vbe_set_memory_window): Renamed from this...
        (grub_vbe_bios_set_memory_window): ... to this.
        (grub_vbe_get_memory_window): Renamed from this...
        (grub_vbe_bios_get_memory_window): ... to this.
        (grub_vbe_set_scanline_length): Renamed from this...
        (grub_vbe_set_scanline_length): ... to this.
        (grub_vbe_get_scanline_length): Renamed from this...
        (grub_vbe_bios_get_scanline_length): ... to this.
        (grub_vbe_set_display_start): Renamed from this...
        (grub_vbe_bios_set_display_start): ... to this.
        (grub_vbe_get_display_start): Renamed from this...
        (grub_vbe_bios_get_display_start): ... to this.
        (grub_vbe_set_palette_data): Renamed from this...
        (grub_vbe_bios_set_palette_data): ... to this.
        (grub_vbe_set_pixel_rgb): Removed.
        (grub_vbe_set_pixel_index): Likewise.

        * kern/i386/pc/startup.S (grub_vbe_get_controller_info): Renamed
        from this...
        (grub_vbe_bios_get_controller_info): ... to this.
        (grub_vbe_get_mode_info): Renamed from this...
        (grub_vbe_bios_get_mode_info): ... to this.
        (grub_vbe_set_mode): Renamed from this...
        (grub_vbe_bios_set_mode): ... to this.
        (grub_vbe_get_mode): Renamed from this...
        (grub_vbe_bios_get_mode): ... to this.
        (grub_vbe_set_memory_window): Renamed from this...
        (grub_vbe_bios_set_memory_window): ... to this.
        (grub_vbe_get_memory_window): Renamed from this...
        (grub_vbe_bios_get_memory_window): ... to this.
        (grub_vbe_set_scanline_length): Renamed from this...
        (grub_vbe_set_scanline_length): ... to this.
        (grub_vbe_get_scanline_length): Renamed from this...
        (grub_vbe_bios_get_scanline_length): ... to this.
        (grub_vbe_set_display_start): Renamed from this...
        (grub_vbe_bios_set_display_start): ... to this.
        (grub_vbe_get_display_start): Renamed from this...
        (grub_vbe_bios_get_display_start): ... to this.
        (grub_vbe_set_palette_data): Renamed from this...
        (grub_vbe_bios_set_palette_data): ... to this.
        (grub_vbe_bios_get_controller_info): Fixed problem with registers
        getting corrupted after calling it.  Added more pushes and pops.
        (grub_vbe_bios_set_mode): Likewise.
        (grub_vbe_bios_get_mode): Likewise.
        (grub_vbe_bios_get_memory_window): Likewise.
        (grub_vbe_bios_set_scanline_length): Likewise.
        (grub_vbe_bios_get_scanline_length): Likewise.
        (grub_vbe_bios_get_display_start): Likewise.
        (grub_vbe_bios_set_palette_data): Likewise.

        * normal/cmdline.c (cl_set_pos): Refresh the screen.
        (cl_insert): Likewise.
        (cl_delete): Likewise.

        * term/gfxterm.c: New file.

        * term/i386/pc/vesafb.c: Removed file.

        * video/video.c: New file.

        * video/i386/pc/vbe.c (real2pm): Added new function.
        (grub_video_vbe_draw_pixel): Likewise.
        (grub_video_vbe_get_video_ptr): Likewise.
        (grub_video_vbe_get_pixel): Likewise
        (grub_video_vbe_init): Likewise.
        (grub_video_vbe_fini): Likewise.
        (grub_video_vbe_setup): Likewise.
        (grub_video_vbe_get_info): Likewise.
        (grub_video_vbe_set_palette): Likewise.
        (grub_video_vbe_get_palette): Likewise.
        (grub_video_vbe_set_viewport): Likewise.
        (grub_video_vbe_get_viewport): Likewise.
        (grub_video_vbe_map_color): Likewise.
        (grub_video_vbe_map_rgb): Likewise.
        (grub_video_vbe_map_rgba): Likewise.
        (grub_video_vbe_unmap_color): Likewise.
        (grub_video_vbe_fill_rect): Likewise.
        (grub_video_vbe_blit_glyph): Likewise.
        (grub_video_vbe_blit_bitmap): Likewise.
        (grub_video_vbe_blit_render_target): Likewise.
        (grub_video_vbe_scroll): Likewise.
        (grub_video_vbe_swap_buffers): Likewise.
        (grub_video_vbe_create_render_target): Likewise.
        (grub_video_vbe_delete_render_target): Likewise.
        (grub_video_vbe_set_active_render_target): Likewise.
        (grub_vbe_set_pixel_rgb): Remove function.
        (grub_vbe_set_pixel_index): Likewise.
        (index_color_mode): Remove static variable.
        (active_mode): Likewise.
        (framebuffer): Likewise.
        (bytes_per_scan_line): Likewise.
        (grub_video_vbe_adapter): Added new static variable.
        (framebuffer): Likewise.
        (render_target): Likewise.
        (initial_mode): Likewise.
        (mode_in_use): Likewise.
        (mode_list): Likewise.
This commit is contained in:
chaac 2006-03-14 19:08:34 +00:00
parent 5f97350bc7
commit bd0d7896cf
15 changed files with 3234 additions and 313 deletions

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2005 Free Software Foundation, Inc.
* Copyright (C) 2003,2005,2006 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -121,7 +121,7 @@ remove_font (struct font *font)
}
/* Return the offset of the glyph corresponding to the codepoint CODE
in the font FONT. If no found, return zero. */
in the font FONT. If no found, return zero. */
static grub_uint32_t
find_glyph (const struct font *font, grub_uint32_t code)
{
@ -151,26 +151,27 @@ find_glyph (const struct font *font, grub_uint32_t code)
/* Set the glyph to something stupid. */
static void
fill_with_default_glyph (unsigned char bitmap[32], unsigned *width)
fill_with_default_glyph (grub_font_glyph_t glyph)
{
if (bitmap)
{
unsigned i;
unsigned i;
for (i = 0; i < 16; i++)
bitmap[i] = (i & 1) ? 0x55 : 0xaa;
}
*width = 1;
for (i = 0; i < 16; i++)
glyph->bitmap[i] = (i & 1) ? 0x55 : 0xaa;
glyph->char_width = 1;
glyph->width = glyph->char_width * 8;
glyph->height = 16;
glyph->baseline = (16 * 3) / 4;
}
/* Get a glyph corresponding to the codepoint CODE. Always fill BITMAP
and WIDTH with something, even if no glyph is found. */
/* Get a glyph corresponding to the codepoint CODE. Always fill glyph
information with something, even if no glyph is found. */
int
grub_font_get_glyph (grub_uint32_t code,
unsigned char bitmap[32], unsigned *width)
grub_font_glyph_t glyph)
{
struct font *font;
grub_uint8_t bitmap[32];
/* FIXME: It is necessary to cache glyphs! */
@ -183,12 +184,20 @@ grub_font_get_glyph (grub_uint32_t code,
if (offset)
{
grub_uint32_t w;
unsigned int x;
unsigned int y;
int len;
/* Make sure we can find glyphs for error messages. Push active
error message to error stack and reset error message. */
grub_error_push ();
grub_file_seek (font->file, offset);
if (grub_file_read (font->file, (char *) &w, 4) != 4)
if ((len = grub_file_read (font->file, (char *) &w, sizeof (w)))
!= sizeof (w))
{
remove_font (font);
goto restart;
remove_font (font);
goto restart;
}
w = grub_le_to_cpu32 (w);
@ -206,14 +215,26 @@ grub_font_get_glyph (grub_uint32_t code,
remove_font (font);
goto restart;
}
*width = w;
/* Temporary workaround, fix font bitmap. */
for (y = 0; y < 16; y++)
for (x = 0; x < w; x++)
glyph->bitmap[y * w + x] = bitmap[x * 16 + y];
glyph->char_width = w;
glyph->width = glyph->char_width * 8;
glyph->height = 16;
glyph->baseline = (16 * 3) / 4;
/* Restore old error message. */
grub_error_pop ();
return 1;
}
}
/* Uggh... No font was found. */
fill_with_default_glyph (bitmap, width);
/* Uggh... No font was found. */
fill_with_default_glyph (glyph);
return 0;
}
@ -232,15 +253,14 @@ font_command (struct grub_arg_list *state __attribute__ ((unused)),
return 0;
}
GRUB_MOD_INIT(fontmanager)
GRUB_MOD_INIT(font_manager)
{
(void) mod; /* Stop warning. */
grub_register_command ("font", font_command, GRUB_COMMAND_FLAG_BOTH,
"font FILE...",
"Specify one or more font files to display.", 0);
}
GRUB_MOD_FINI(fontmanager)
GRUB_MOD_FINI(font_manager)
{
grub_unregister_command ("font");
}