vga: Clear the screen when relinquishing VGA to dom0.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 5 Dec 2008 11:37:20 +0000 (11:37 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 5 Dec 2008 11:37:20 +0000 (11:37 +0000)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/drivers/video/vesa.c
xen/drivers/video/vga.c

index e36e358789d601e4df6048b6a1546803199af91a..bace5c625d776a3f122d36a9957b619129c88932 100644 (file)
@@ -146,10 +146,20 @@ void __init vesa_init(void)
     xfree(text_buf);
 }
 
-void __init vesa_endboot(void)
+void __init vesa_endboot(bool_t keep)
 {
-    xpos = 0;
-    vga_puts = vesa_scroll_puts;
+    if ( keep )
+    {
+        xpos = 0;
+        vga_puts = vesa_scroll_puts;
+    }
+    else
+    {
+        unsigned int i, bpp = (vlfb_info.bits_per_pixel + 7) >> 3;
+        for ( i = 0; i < vlfb_info.height; i++ )
+            memset(lfb + i * vlfb_info.bytes_per_line, 0,
+                   vlfb_info.width * bpp);
+    }
 }
 
 #if defined(CONFIG_X86)
index ef21178a011640220329622af7c3009cbd1e5660..45823823756382e1589b01249f47bb77e58a6648 100644 (file)
@@ -57,10 +57,10 @@ static unsigned int columns, lines;
 
 #ifdef CONFIG_X86_64
 void vesa_early_init(void);
-void vesa_endboot(void);
+void vesa_endboot(bool_t keep);
 #else
 #define vesa_early_init() ((void)0)
-#define vesa_endboot(   ((void)0)
+#define vesa_endboot(x)   ((void)0)
 #endif
 
 void __init vga_init(void)
@@ -99,16 +99,27 @@ void __init vga_init(void)
 
 void __init vga_endboot(void)
 {
-    if ( vga_puts == vga_noop_puts )
+    if ( !vga_console_info.video_type )
         return;
 
     printk("Xen is %s VGA console.\n",
            vgacon_keep ? "keeping" : "relinquishing");
 
-    vesa_endboot();
-
     if ( !vgacon_keep )
         vga_puts = vga_noop_puts;
+
+    switch ( vga_console_info.video_type )
+    {
+    case XEN_VGATYPE_TEXT_MODE_3:
+        vesa_endboot(vgacon_keep);
+        break;
+    case XEN_VGATYPE_VESA_LFB:
+        if ( !vgacon_keep )
+            memset(video, 0, columns * lines * 2);
+        break;
+    default:
+        BUG();
+    }
 }
 
 static void vga_text_puts(const char *s)