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

Gerd Hoffmann posted 1 patch 5 years, 10 months ago
Failed in applying to current master (apply log)
vgasrc/cbvga.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
[SeaBIOS] [PATCH] cbvga_set_mode: refine clear display logic
Posted by Gerd Hoffmann 5 years, 10 months ago
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@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


_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH] cbvga_set_mode: refine clear display logic
Posted by Paul Menzel 5 years, 10 months ago
Dear Gerd,


Am 26.06.2018 um 09:21 schrieb Gerd Hoffmann:
> There is no need to skip text mode clearing.
> Clearing the framebuffer should be safe on legacy calls too.

How did you test this?


Kind regards,

Paul

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH] cbvga_set_mode: refine clear display logic
Posted by Gerd Hoffmann 5 years, 10 months ago
On Tue, Jun 26, 2018 at 09:27:03AM +0200, Paul Menzel wrote:
> Dear Gerd,
> 
> 
> Am 26.06.2018 um 09:21 schrieb Gerd Hoffmann:
> > There is no need to skip text mode clearing.
> > Clearing the framebuffer should be safe on legacy calls too.
> 
> How did you test this?

CONFIG_DISPLAY_BOCHS=y

Then qemu from master branch, configure display this way:

   -vga none -device bochs-display,romfile=/path/to/vgabios.bin

And boot a windows 10 install iso, see if it boots up properly with
working display.

cheers,
  Gerd


_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH] cbvga_set_mode: refine clear display logic
Posted by Kevin O'Connor 5 years, 10 months ago
On Tue, Jun 26, 2018 at 09:21:52AM +0200, Gerd Hoffmann wrote:
> There is no need to skip text mode clearing.
> Clearing the framebuffer should be safe on legacy calls too.

Thanks.  Looks good to me.

-Kevin

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios
Re: [SeaBIOS] [PATCH] cbvga_set_mode: refine clear display logic
Posted by Gerd Hoffmann 5 years, 10 months ago
On Tue, Jun 26, 2018 at 09:07:41PM -0400, Kevin O'Connor wrote:
> On Tue, Jun 26, 2018 at 09:21:52AM +0200, Gerd Hoffmann wrote:
> > There is no need to skip text mode clearing.
> > Clearing the framebuffer should be safe on legacy calls too.
> 
> Thanks.  Looks good to me.

Pushed.

cheers,
  Gerd

_______________________________________________
SeaBIOS mailing list
SeaBIOS@seabios.org
https://mail.coreboot.org/mailman/listinfo/seabios