Detach optional parts of gfxterm and integrate in with coreboot init.
This commit is contained in:
parent
6570b2050e
commit
fc4c4fddf6
26 changed files with 410 additions and 317 deletions
|
@ -210,26 +210,6 @@ grub_video_bitmap_load (struct grub_video_bitmap **bitmap,
|
|||
" unsupported format"), filename);
|
||||
}
|
||||
|
||||
/* Return bitmap width. */
|
||||
unsigned int
|
||||
grub_video_bitmap_get_width (struct grub_video_bitmap *bitmap)
|
||||
{
|
||||
if (!bitmap)
|
||||
return 0;
|
||||
|
||||
return bitmap->mode_info.width;
|
||||
}
|
||||
|
||||
/* Return bitmap height. */
|
||||
unsigned int
|
||||
grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap)
|
||||
{
|
||||
if (!bitmap)
|
||||
return 0;
|
||||
|
||||
return bitmap->mode_info.height;
|
||||
}
|
||||
|
||||
/* Return mode info for bitmap. */
|
||||
void grub_video_bitmap_get_mode_info (struct grub_video_bitmap *bitmap,
|
||||
struct grub_video_mode_info *mode_info)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/color.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
|
|
@ -31,41 +31,6 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/video.h>
|
||||
|
||||
void *
|
||||
grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y)
|
||||
{
|
||||
grub_uint8_t *ptr = 0;
|
||||
|
||||
switch (source->mode_info->bpp)
|
||||
{
|
||||
case 32:
|
||||
ptr = source->data + y * source->mode_info->pitch + x * 4;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
ptr = source->data + y * source->mode_info->pitch + x * 3;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
ptr = source->data + y * source->mode_info->pitch + x * 2;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
ptr = source->data + y * source->mode_info->pitch + x;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* For 1-bit bitmaps, addressing needs to be done at the bit level
|
||||
and it doesn't make sense, in general, to ask for a pointer
|
||||
to a particular pixel's data. */
|
||||
break;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
grub_video_color_t
|
||||
get_pixel (struct grub_video_fbblit_info *source,
|
||||
unsigned int x, unsigned int y)
|
||||
|
|
|
@ -26,10 +26,9 @@
|
|||
#include <grub/video.h>
|
||||
#include <grub/video_fb.h>
|
||||
#include <grub/machine/lbio.h>
|
||||
#include <grub/machine/console.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static struct grub_linuxbios_table_framebuffer *cbfb;
|
||||
struct grub_linuxbios_table_framebuffer *grub_video_coreboot_fbtable;
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@ -50,22 +49,22 @@ grub_video_cbfb_fill_mode_info (struct grub_video_mode_info *out)
|
|||
{
|
||||
grub_memset (out, 0, sizeof (*out));
|
||||
|
||||
out->width = cbfb->width;
|
||||
out->height = cbfb->height;
|
||||
out->pitch = cbfb->pitch;
|
||||
out->width = grub_video_coreboot_fbtable->width;
|
||||
out->height = grub_video_coreboot_fbtable->height;
|
||||
out->pitch = grub_video_coreboot_fbtable->pitch;
|
||||
|
||||
out->red_field_pos = cbfb->red_field_pos;
|
||||
out->red_mask_size = cbfb->red_mask_size;
|
||||
out->green_field_pos = cbfb->green_field_pos;
|
||||
out->green_mask_size = cbfb->green_mask_size;
|
||||
out->blue_field_pos = cbfb->blue_field_pos;
|
||||
out->blue_mask_size = cbfb->blue_mask_size;
|
||||
out->reserved_field_pos = cbfb->reserved_field_pos;
|
||||
out->reserved_mask_size = cbfb->reserved_mask_size;
|
||||
out->red_field_pos = grub_video_coreboot_fbtable->red_field_pos;
|
||||
out->red_mask_size = grub_video_coreboot_fbtable->red_mask_size;
|
||||
out->green_field_pos = grub_video_coreboot_fbtable->green_field_pos;
|
||||
out->green_mask_size = grub_video_coreboot_fbtable->green_mask_size;
|
||||
out->blue_field_pos = grub_video_coreboot_fbtable->blue_field_pos;
|
||||
out->blue_mask_size = grub_video_coreboot_fbtable->blue_mask_size;
|
||||
out->reserved_field_pos = grub_video_coreboot_fbtable->reserved_field_pos;
|
||||
out->reserved_mask_size = grub_video_coreboot_fbtable->reserved_mask_size;
|
||||
|
||||
out->mode_type = GRUB_VIDEO_MODE_TYPE_RGB;
|
||||
out->bpp = cbfb->bpp;
|
||||
out->bytes_per_pixel = (cbfb->bpp + 7) / 8;
|
||||
out->bpp = grub_video_coreboot_fbtable->bpp;
|
||||
out->bytes_per_pixel = (grub_video_coreboot_fbtable->bpp + 7) / 8;
|
||||
out->number_of_colors = 256;
|
||||
|
||||
out->blit_format = grub_video_get_blit_format (out);
|
||||
|
@ -79,10 +78,10 @@ grub_video_cbfb_setup (unsigned int width, unsigned int height,
|
|||
{
|
||||
grub_err_t err;
|
||||
|
||||
if (!cbfb)
|
||||
if (!grub_video_coreboot_fbtable)
|
||||
return grub_error (GRUB_ERR_IO, "Couldn't find display device.");
|
||||
|
||||
if (!((width == cbfb->width && height == cbfb->height)
|
||||
if (!((width == grub_video_coreboot_fbtable->width && height == grub_video_coreboot_fbtable->height)
|
||||
|| (width == 0 && height == 0)))
|
||||
return grub_error (GRUB_ERR_IO, "can't set mode %dx%d", width, height);
|
||||
|
||||
|
@ -93,7 +92,7 @@ grub_video_cbfb_setup (unsigned int width, unsigned int height,
|
|||
return err;
|
||||
}
|
||||
|
||||
framebuffer.ptr = (void *) (grub_addr_t) cbfb->lfb;
|
||||
framebuffer.ptr = (void *) (grub_addr_t) grub_video_coreboot_fbtable->lfb;
|
||||
|
||||
grub_dprintf ("video", "CBFB: initialising FB @ %p %dx%dx%d\n",
|
||||
framebuffer.ptr, framebuffer.mode_info.width,
|
||||
|
@ -162,20 +161,26 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item,
|
|||
{
|
||||
if (table_item->tag != GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER)
|
||||
return 0;
|
||||
cbfb = (struct grub_linuxbios_table_framebuffer *) (table_item + 1);
|
||||
grub_video_coreboot_fbtable = (struct grub_linuxbios_table_framebuffer *) (table_item + 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(coreboot_fb)
|
||||
void
|
||||
grub_video_coreboot_fb_early_init (void)
|
||||
{
|
||||
grub_linuxbios_table_iterate (iterate_linuxbios_table, 0);
|
||||
}
|
||||
|
||||
if (cbfb)
|
||||
void
|
||||
grub_video_coreboot_fb_late_init (void)
|
||||
{
|
||||
if (grub_video_coreboot_fbtable)
|
||||
grub_video_register (&grub_video_cbfb_adapter);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(coreboot_fb)
|
||||
void
|
||||
grub_video_coreboot_fb_fini (void)
|
||||
{
|
||||
if (cbfb)
|
||||
if (grub_video_coreboot_fbtable)
|
||||
grub_video_unregister (&grub_video_cbfb_adapter);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue