Implement loading palette on ieee1275_fb.
* grub-core/video/ieee1275.c (stdout_ihandle): New variable. (have_setcolors): Likewise. (grub_video_ieee1275_init): Fill stdout_ihandle and have_setcolors. (grub_video_ieee1275_setup): Use grub_video_ieee1275_set_palette. (grub_video_ieee1275_set_palette): Implement.
This commit is contained in:
parent
25761e13ee
commit
1aa4fe8822
2 changed files with 35 additions and 13 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2010-09-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Implement loading palette on ieee1275_fb.
|
||||||
|
|
||||||
|
* grub-core/video/ieee1275.c (stdout_ihandle): New variable.
|
||||||
|
(have_setcolors): Likewise.
|
||||||
|
(grub_video_ieee1275_init): Fill stdout_ihandle and have_setcolors.
|
||||||
|
(grub_video_ieee1275_setup): Use grub_video_ieee1275_set_palette.
|
||||||
|
(grub_video_ieee1275_set_palette): Implement.
|
||||||
|
|
||||||
2010-09-11 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-09-11 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
2010-09-11 Colin Watson <cjwatson@ubuntu.com>
|
2010-09-11 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
static unsigned old_width, old_height;
|
static unsigned old_width, old_height;
|
||||||
static int restore_needed;
|
static int restore_needed;
|
||||||
static char *display;
|
static char *display;
|
||||||
|
static grub_ieee1275_ihandle_t stdout_ihandle;
|
||||||
|
static int have_setcolors = 0;
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
|
@ -72,7 +74,17 @@ find_display (void)
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_video_ieee1275_init (void)
|
grub_video_ieee1275_init (void)
|
||||||
{
|
{
|
||||||
|
grub_ssize_t actual;
|
||||||
|
|
||||||
grub_memset (&framebuffer, 0, sizeof(framebuffer));
|
grub_memset (&framebuffer, 0, sizeof(framebuffer));
|
||||||
|
|
||||||
|
if (! grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_CANNOT_SET_COLORS)
|
||||||
|
&& !grub_ieee1275_get_integer_property (grub_ieee1275_chosen,
|
||||||
|
"stdout", &stdout_ihandle,
|
||||||
|
sizeof (stdout_ihandle), &actual)
|
||||||
|
&& actual == sizeof (stdout_ihandle))
|
||||||
|
have_setcolors = 1;
|
||||||
|
|
||||||
return grub_video_fb_init ();
|
return grub_video_fb_init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,9 +181,6 @@ grub_video_ieee1275_setup (unsigned int width, unsigned int height,
|
||||||
/* For some reason sparc64 uses 32-bit pointer too. */
|
/* For some reason sparc64 uses 32-bit pointer too. */
|
||||||
framebuffer.ptr = (void *) (grub_addr_t) address;
|
framebuffer.ptr = (void *) (grub_addr_t) address;
|
||||||
|
|
||||||
grub_video_ieee1275_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
|
|
||||||
grub_video_fbstd_colors);
|
|
||||||
|
|
||||||
grub_dprintf ("video", "IEEE1275: initialising FB @ %p %dx%dx%d\n",
|
grub_dprintf ("video", "IEEE1275: initialising FB @ %p %dx%dx%d\n",
|
||||||
framebuffer.ptr, framebuffer.mode_info.width,
|
framebuffer.ptr, framebuffer.mode_info.width,
|
||||||
framebuffer.mode_info.height, framebuffer.mode_info.bpp);
|
framebuffer.mode_info.height, framebuffer.mode_info.bpp);
|
||||||
|
@ -192,15 +201,10 @@ grub_video_ieee1275_setup (unsigned int width, unsigned int height,
|
||||||
grub_dprintf ("video", "IEEE1275: Couldn't set FB target\n");
|
grub_dprintf ("video", "IEEE1275: Couldn't set FB target\n");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
|
|
||||||
grub_video_fbstd_colors);
|
|
||||||
|
|
||||||
if (err)
|
grub_video_ieee1275_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
|
||||||
grub_dprintf ("video", "IEEE1275: Couldn't set palette\n");
|
grub_video_fbstd_colors);
|
||||||
else
|
|
||||||
grub_dprintf ("video", "IEEE1275: Success\n");
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,9 +247,17 @@ grub_video_ieee1275_set_palette (unsigned int start, unsigned int count,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
grub_video_fb_get_palette (0, 256, fb_palette_data);
|
grub_video_fb_get_palette (0, ARRAY_SIZE (fb_palette_data), fb_palette_data);
|
||||||
|
|
||||||
/* TODO. */
|
/* Set colors. */
|
||||||
|
if (have_setcolors)
|
||||||
|
{
|
||||||
|
unsigned col;
|
||||||
|
for (col = 0; col < ARRAY_SIZE (fb_palette_data); col++)
|
||||||
|
grub_ieee1275_set_color (stdout_ihandle, col, fb_palette_data[col].r,
|
||||||
|
fb_palette_data[col].g,
|
||||||
|
fb_palette_data[col].b);
|
||||||
|
}
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue