2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>

Workaround for broken ATI VBE.

	* video/i386/pc/vbe.c (last_set_mode): New variable.
	(grub_vbe_set_video_mode): Set 'last_set_mode'.
	(grub_vbe_get_video_mode): Use 'last_set_mode' if get_mode fails.
	(grub_video_vbe_setup): Don't check for reserved flag.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-18 02:35:15 +01:00
commit 86cd6ff556
2 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2009-12-18 Vladimir Serbinenko <phcoder@gmail.com>
Workaround for broken ATI VBE.
* video/i386/pc/vbe.c (last_set_mode): New variable.
(grub_vbe_set_video_mode): Set 'last_set_mode'.
(grub_vbe_get_video_mode): Use 'last_set_mode' if get_mode fails.
(grub_video_vbe_setup): Don't check for reserved flag.
2009-12-17 Felix Zielcke <fzielcke@z-51.de> 2009-12-17 Felix Zielcke <fzielcke@z-51.de>
* gendistlist.sh: Use POSIX compliant `!' instead of `-not' in * gendistlist.sh: Use POSIX compliant `!' instead of `-not' in

View file

@ -33,6 +33,9 @@ static int vbe_detected = -1;
static struct grub_vbe_info_block controller_info; static struct grub_vbe_info_block controller_info;
static struct grub_vbe_mode_info_block active_vbe_mode_info; static struct grub_vbe_mode_info_block active_vbe_mode_info;
/* Track last mode to support cards which fail on get_mode. */
static grub_uint32_t last_set_mode = 3;
static struct static struct
{ {
struct grub_video_mode_info mode_info; struct grub_video_mode_info mode_info;
@ -160,6 +163,7 @@ grub_vbe_set_video_mode (grub_uint32_t vbe_mode,
status = grub_vbe_bios_set_mode (vbe_mode, 0); status = grub_vbe_bios_set_mode (vbe_mode, 0);
if (status != GRUB_VBE_STATUS_OK) if (status != GRUB_VBE_STATUS_OK)
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot set VBE mode %x", vbe_mode); return grub_error (GRUB_ERR_BAD_DEVICE, "cannot set VBE mode %x", vbe_mode);
last_set_mode = vbe_mode;
/* Save information for later usage. */ /* Save information for later usage. */
framebuffer.active_vbe_mode = vbe_mode; framebuffer.active_vbe_mode = vbe_mode;
@ -203,6 +207,7 @@ grub_vbe_set_video_mode (grub_uint32_t vbe_mode,
case 8: framebuffer.bytes_per_pixel = 1; break; case 8: framebuffer.bytes_per_pixel = 1; break;
default: default:
grub_vbe_bios_set_mode (old_vbe_mode, 0); grub_vbe_bios_set_mode (old_vbe_mode, 0);
last_set_mode = old_vbe_mode;
return grub_error (GRUB_ERR_BAD_DEVICE, return grub_error (GRUB_ERR_BAD_DEVICE,
"cannot set VBE mode %x", "cannot set VBE mode %x",
vbe_mode); vbe_mode);
@ -256,8 +261,9 @@ grub_vbe_get_video_mode (grub_uint32_t *mode)
/* Try to query current mode from VESA BIOS. */ /* Try to query current mode from VESA BIOS. */
status = grub_vbe_bios_get_mode (mode); status = grub_vbe_bios_get_mode (mode);
/* XXX: ATI cards don't support get_mode. */
if (status != GRUB_VBE_STATUS_OK) if (status != GRUB_VBE_STATUS_OK)
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get current VBE mode"); *mode = last_set_mode;
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }
@ -391,10 +397,6 @@ grub_video_vbe_setup (unsigned int width, unsigned int height,
/* If not available, skip it. */ /* If not available, skip it. */
continue; continue;
if ((vbe_mode_info.mode_attributes & 0x002) == 0)
/* Not enough information. */
continue;
if ((vbe_mode_info.mode_attributes & 0x008) == 0) if ((vbe_mode_info.mode_attributes & 0x008) == 0)
/* Monochrome is unusable. */ /* Monochrome is unusable. */
continue; continue;