[SeaBIOS] [PATCH] cbvga_set_mode: refine clear display logic

Gerd Hoffmann kraxel at redhat.com
Tue Jun 26 09:21:52 CEST 2018


There is no need to skip text mode clearing.
Clearing the framebuffer should be safe on legacy calls too.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 vgasrc/cbvga.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index f6ebe71242..859524cb23 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -201,18 +201,20 @@ cbvga_set_mode(struct vgamode_s *vmode_g, int flags)
      */
     u8 extra_stack = GET_BDA_EXT(flags) & BF_EXTRA_STACK;
     MASK_BDA_EXT(flags, BF_EMULATE_TEXT, emul ? BF_EMULATE_TEXT : 0);
-    if (!(flags & MF_NOCLEARMEM) && extra_stack) {
+    if (!(flags & MF_NOCLEARMEM)) {
         if (GET_GLOBAL(CBmodeinfo.memmodel) == MM_TEXT) {
             memset16_far(SEG_CTEXT, (void*)0, 0x0720, 80*25*2);
             return 0;
         }
-        struct gfx_op op;
-        init_gfx_op(&op, &CBmodeinfo);
-        op.x = op.y = 0;
-        op.xlen = GET_GLOBAL(CBmodeinfo.width);
-        op.ylen = GET_GLOBAL(CBmodeinfo.height);
-        op.op = GO_MEMSET;
-        handle_gfx_op(&op);
+        if (extra_stack || flags & MF_LEGACY) {
+            struct gfx_op op;
+            init_gfx_op(&op, &CBmodeinfo);
+            op.x = op.y = 0;
+            op.xlen = GET_GLOBAL(CBmodeinfo.width);
+            op.ylen = GET_GLOBAL(CBmodeinfo.height);
+            op.op = GO_MEMSET;
+            handle_gfx_op(&op);
+        }
     }
     return 0;
 }
-- 
2.9.3




More information about the SeaBIOS mailing list