From e420686f133d2e1d56d9ae3936b6cddddc5727a5 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Sat, 5 Dec 2009 11:29:47 +0100 Subject: [PATCH 1/5] Ignore some VBE info --- video/i386/pc/vbe.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/video/i386/pc/vbe.c b/video/i386/pc/vbe.c index a285b26ba..c5c4e64ca 100644 --- a/video/i386/pc/vbe.c +++ b/video/i386/pc/vbe.c @@ -158,8 +158,10 @@ grub_vbe_set_video_mode (grub_uint32_t vbe_mode, /* Try to set video mode. */ status = grub_vbe_bios_set_mode (vbe_mode, 0); +#if 0 if (status != GRUB_VBE_STATUS_OK) return grub_error (GRUB_ERR_BAD_DEVICE, "cannot set VBE mode %x", vbe_mode); +#endif /* Save information for later usage. */ framebuffer.active_vbe_mode = vbe_mode; @@ -387,6 +389,7 @@ grub_video_vbe_setup (unsigned int width, unsigned int height, break; } +#if 0 if ((vbe_mode_info.mode_attributes & 0x001) == 0) /* If not available, skip it. */ continue; @@ -411,6 +414,7 @@ grub_video_vbe_setup (unsigned int width, unsigned int height, && (vbe_mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)) /* Not compatible memory model. */ continue; +#endif if ((vbe_mode_info.x_resolution != width) || (vbe_mode_info.y_resolution != height)) From 7ca3f5c2d9c2262c5ddb86980eb084b794154def Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Mon, 14 Dec 2009 18:16:32 +0100 Subject: [PATCH 2/5] one more possible fix --- video/i386/pc/vbe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/video/i386/pc/vbe.c b/video/i386/pc/vbe.c index c5c4e64ca..ad87aa441 100644 --- a/video/i386/pc/vbe.c +++ b/video/i386/pc/vbe.c @@ -258,8 +258,10 @@ grub_vbe_get_video_mode (grub_uint32_t *mode) /* Try to query current mode from VESA BIOS. */ status = grub_vbe_bios_get_mode (mode); +#if 0 if (status != GRUB_VBE_STATUS_OK) return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get current VBE mode"); +#endif return GRUB_ERR_NONE; } From db846aed9abd03abaa4db84cad88e68a2ce0b76e Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Wed, 16 Dec 2009 16:53:01 +0100 Subject: [PATCH 3/5] minimalising ATI impact --- video/i386/pc/vbe.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/video/i386/pc/vbe.c b/video/i386/pc/vbe.c index ad87aa441..714f7397e 100644 --- a/video/i386/pc/vbe.c +++ b/video/i386/pc/vbe.c @@ -158,10 +158,8 @@ grub_vbe_set_video_mode (grub_uint32_t vbe_mode, /* Try to set video mode. */ status = grub_vbe_bios_set_mode (vbe_mode, 0); -#if 0 if (status != GRUB_VBE_STATUS_OK) return grub_error (GRUB_ERR_BAD_DEVICE, "cannot set VBE mode %x", vbe_mode); -#endif /* Save information for later usage. */ framebuffer.active_vbe_mode = vbe_mode; @@ -258,10 +256,10 @@ grub_vbe_get_video_mode (grub_uint32_t *mode) /* Try to query current mode from VESA BIOS. */ status = grub_vbe_bios_get_mode (mode); -#if 0 + /* XXX: ATI don't support get_mode. */ if (status != GRUB_VBE_STATUS_OK) - return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get current VBE mode"); -#endif + *mode = 3; + // return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get current VBE mode"); return GRUB_ERR_NONE; } @@ -391,14 +389,15 @@ grub_video_vbe_setup (unsigned int width, unsigned int height, break; } -#if 0 if ((vbe_mode_info.mode_attributes & 0x001) == 0) /* If not available, skip it. */ continue; +#if 0 if ((vbe_mode_info.mode_attributes & 0x002) == 0) /* Not enough information. */ continue; +#endif if ((vbe_mode_info.mode_attributes & 0x008) == 0) /* Monochrome is unusable. */ @@ -416,7 +415,6 @@ grub_video_vbe_setup (unsigned int width, unsigned int height, && (vbe_mode_info.memory_model != GRUB_VBE_MEMORY_MODEL_DIRECT_COLOR)) /* Not compatible memory model. */ continue; -#endif if ((vbe_mode_info.x_resolution != width) || (vbe_mode_info.y_resolution != height)) From 5b4f655bad3618c7734406c46d671e032ed43646 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 18 Dec 2009 02:11:26 +0100 Subject: [PATCH 4/5] cleaned ATI fixes --- video/i386/pc/vbe.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/video/i386/pc/vbe.c b/video/i386/pc/vbe.c index 714f7397e..be1b519c5 100644 --- a/video/i386/pc/vbe.c +++ b/video/i386/pc/vbe.c @@ -33,6 +33,9 @@ static int vbe_detected = -1; static struct grub_vbe_info_block controller_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 { 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); if (status != GRUB_VBE_STATUS_OK) return grub_error (GRUB_ERR_BAD_DEVICE, "cannot set VBE mode %x", vbe_mode); + last_set_mode = vbe_mode; /* Save information for later usage. */ 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; default: grub_vbe_bios_set_mode (old_vbe_mode, 0); + last_set_mode = old_vbe_mode; return grub_error (GRUB_ERR_BAD_DEVICE, "cannot set VBE mode %x", vbe_mode); @@ -256,10 +261,9 @@ grub_vbe_get_video_mode (grub_uint32_t *mode) /* Try to query current mode from VESA BIOS. */ status = grub_vbe_bios_get_mode (mode); - /* XXX: ATI don't support get_mode. */ + /* XXX: ATI cards don't support get_mode. */ if (status != GRUB_VBE_STATUS_OK) - *mode = 3; - // return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get current VBE mode"); + *mode = last_set_mode; return GRUB_ERR_NONE; } @@ -393,12 +397,6 @@ grub_video_vbe_setup (unsigned int width, unsigned int height, /* If not available, skip it. */ continue; -#if 0 - if ((vbe_mode_info.mode_attributes & 0x002) == 0) - /* Not enough information. */ - continue; -#endif - if ((vbe_mode_info.mode_attributes & 0x008) == 0) /* Monochrome is unusable. */ continue; From 0945f1816d92e2bfdeca24bb67211fe477d11721 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 18 Dec 2009 02:21:37 +0100 Subject: [PATCH 5/5] Changelog --- ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 22d085fa4..d7d6ed847 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-12-18 Vladimir Serbinenko + + 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 * gendistlist.sh: Use POSIX compliant `!' instead of `-not' in