Blame SOURCES/seabios-vgabios-Fix-cirrus-memory-clear-on-mode-switch.patch

6a2d3c
From 52f633e72965e711be4d92928615f63b4cf9f429 Mon Sep 17 00:00:00 2001
6a2d3c
From: Miki Mishael <mmishael@redhat.com>
6a2d3c
Date: Tue, 7 Jan 2014 16:10:44 +0100
6a2d3c
Subject: [PATCH] vgabios: Fix cirrus memory clear on mode switch.
6a2d3c
6a2d3c
RH-Author: Miki Mishael <mmishael@redhat.com>
6a2d3c
Message-id: <1389111044-9237-1-git-send-email-mmishael@redhat.com>
6a2d3c
Patchwork-id: 56530
6a2d3c
O-Subject: [RHEL7.0 seabios PATCH] vgabios: Fix cirrus memory clear on mode switch.
6a2d3c
Bugzilla: 979898
6a2d3c
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
6a2d3c
RH-Acked-by: Yan Vugenfirer <yvugenfi@redhat.com>
6a2d3c
RH-Acked-by: Gal Hammer <ghammer@redhat.com>
6a2d3c
6a2d3c
From: Kevin O'Connor <kevin@koconnor.net>
6a2d3c
6a2d3c
The cirrus_clear_vram() code wasn't actually doing anything because of
6a2d3c
a u8 overflow.  Fix that.
6a2d3c
6a2d3c
Fill with 0xff when performing a legacy cirrus mode switch (WinXP has
6a2d3c
been observed to incorrectly render dialog boxes if the memory is
6a2d3c
filled to 0).  This was the behavior of the original LGPL vgabios
6a2d3c
code.  To support this, add mechanism (MF_LEGACY) to allow vga drivers
6a2d3c
to detect if the mode switch is from vesa or int10.
6a2d3c
6a2d3c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
6a2d3c
6a2d3c
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=979898
6a2d3c
Upstream-status: b7b92935df0e309149c042d587e4764548f10608
6a2d3c
Brew: https://brewweb.devel.redhat.com/taskinfo?taskID=6818682
6a2d3c
Signed-off-by: Miki Mishael <mmishael@redhat.com>
6a2d3c
Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
6a2d3c
---
6a2d3c
 vgasrc/clext.c   | 11 ++++++-----
6a2d3c
 vgasrc/vgabios.c |  2 +-
6a2d3c
 vgasrc/vgabios.h |  1 +
6a2d3c
 3 files changed, 8 insertions(+), 6 deletions(-)
6a2d3c
6a2d3c
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
6a2d3c
---
6a2d3c
 vgasrc/clext.c   |   11 ++++++-----
6a2d3c
 vgasrc/vgabios.c |    2 +-
6a2d3c
 vgasrc/vgabios.h |    1 +
6a2d3c
 3 files changed, 8 insertions(+), 6 deletions(-)
6a2d3c
6a2d3c
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
6a2d3c
index fc5459a..30da499 100644
6a2d3c
--- a/vgasrc/clext.c
6a2d3c
+++ b/vgasrc/clext.c
6a2d3c
@@ -442,14 +442,14 @@ cirrus_enable_16k_granularity(void)
6a2d3c
 }
6a2d3c
 
6a2d3c
 static void
6a2d3c
-cirrus_clear_vram(void)
6a2d3c
+cirrus_clear_vram(u16 fill)
6a2d3c
 {
6a2d3c
     cirrus_enable_16k_granularity();
6a2d3c
-    u8 count = GET_GLOBAL(VBE_total_memory) / (16 * 1024);
6a2d3c
-    u8 i;
6a2d3c
+    int count = GET_GLOBAL(VBE_total_memory) / (16 * 1024);
6a2d3c
+    int i;
6a2d3c
     for (i=0; i
6a2d3c
         stdvga_grdc_write(0x09, i);
6a2d3c
-        memset16_far(SEG_GRAPH, 0, 0, 16 * 1024);
6a2d3c
+        memset16_far(SEG_GRAPH, 0, fill, 16 * 1024);
6a2d3c
     }
6a2d3c
     stdvga_grdc_write(0x09, 0x00);
6a2d3c
 }
6a2d3c
@@ -468,7 +468,8 @@ clext_set_mode(struct vgamode_s *vmode_g, int flags)
6a2d3c
     if (!(flags & MF_LINEARFB))
6a2d3c
         cirrus_enable_16k_granularity();
6a2d3c
     if (!(flags & MF_NOCLEARMEM))
6a2d3c
-        cirrus_clear_vram();
6a2d3c
+        // fill with 0xff to keep win 2K happy
6a2d3c
+        cirrus_clear_vram(flags & MF_LEGACY ? 0xffff : 0x0000);
6a2d3c
     return 0;
6a2d3c
 }
6a2d3c
 
6a2d3c
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
6a2d3c
index afaf018..0ed8874 100644
6a2d3c
--- a/vgasrc/vgabios.c
6a2d3c
+++ b/vgasrc/vgabios.c
6a2d3c
@@ -420,7 +420,7 @@ handle_1000(struct bregs *regs)
6a2d3c
     else
6a2d3c
         regs->al = 0x30;
6a2d3c
 
6a2d3c
-    int flags = GET_BDA(modeset_ctl) & (MF_NOPALETTE|MF_GRAYSUM);
6a2d3c
+    int flags = MF_LEGACY | (GET_BDA(modeset_ctl) & (MF_NOPALETTE|MF_GRAYSUM));
6a2d3c
     if (regs->al & 0x80)
6a2d3c
         flags |= MF_NOCLEARMEM;
6a2d3c
 
6a2d3c
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h
6a2d3c
index ff5ec45..5adbf4b 100644
6a2d3c
--- a/vgasrc/vgabios.h
6a2d3c
+++ b/vgasrc/vgabios.h
6a2d3c
@@ -39,6 +39,7 @@ struct saveBDAstate {
6a2d3c
 };
6a2d3c
 
6a2d3c
 // Mode flags
6a2d3c
+#define MF_LEGACY     0x0001
6a2d3c
 #define MF_GRAYSUM    0x0002
6a2d3c
 #define MF_NOPALETTE  0x0008
6a2d3c
 #define MF_CUSTOMCRTC 0x0800
6a2d3c
-- 
6a2d3c
1.7.1
6a2d3c