From 0c9cbb89a2786468177efa96ebb27b554e4af120 Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 15 May 2009 22:15:21 +0000 Subject: [PATCH] Only clear portion of framebuffer that's actually used (clearing 256MB shared graphics memory took about 10 seconds on one machine). git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@31235 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/i386-pc/drivers/vesa.hidd/hardware.c | 20 ++++++++++++++++++-- arch/i386-pc/drivers/vesa.hidd/hardware.h | 1 + arch/i386-pc/drivers/vesa.hidd/vesagfxclass.c | 8 +++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/arch/i386-pc/drivers/vesa.hidd/hardware.c b/arch/i386-pc/drivers/vesa.hidd/hardware.c index df9a79c31..0f1ec59fb 100755 --- a/arch/i386-pc/drivers/vesa.hidd/hardware.c +++ b/arch/i386-pc/drivers/vesa.hidd/hardware.c @@ -101,8 +101,10 @@ BOOL initVesaGfxHW(struct HWData *data) data->DAC[col*3+i] = cursorPalette[i]; DACLoad(data, col, 3); } - D(bug("[Vesa] HwInit: Clearing framebuffer at 0x%08x size %d KB\n",data->framebuffer, vi->FrameBufferSize)); - memset(data->framebuffer, 0, vi->FrameBufferSize * 1024); + D(bug("[Vesa] HwInit: Clearing %d kB of framebuffer at 0x%08x" + " size %d kB\n", data->height * data->bytesperline >> 10, + data->framebuffer, vi->FrameBufferSize)); + ClearBuffer(data); D(bug("[Vesa] HwInit: Linear framebuffer at 0x%08x\n",data->framebuffer)); D(bug("[Vesa] HwInit: Screenmode %dx%dx%d\n",data->width,data->height,data->depth)); D(bug("[Vesa] HwInit: Masks R %08x<<%2d G %08x<<%2d B %08x<<%2d\n", @@ -251,3 +253,17 @@ void DACLoad(struct HWData *restore, unsigned char first, int num) outb(restore->DAC[n++], 0x3C9); } } + +/* +** ClearBuffer -- +** clear the screen buffer +*/ +void ClearBuffer(const struct HWData *data) +{ + IPTR *p, *limit; + + p = (IPTR *)data->framebuffer; + limit = (IPTR *)((IPTR)p + data->height * data->bytesperline); + while (p < limit) + *p++ = 0; +} diff --git a/arch/i386-pc/drivers/vesa.hidd/hardware.h b/arch/i386-pc/drivers/vesa.hidd/hardware.h index ad1ce4e6d..8194e7d3f 100755 --- a/arch/i386-pc/drivers/vesa.hidd/hardware.h +++ b/arch/i386-pc/drivers/vesa.hidd/hardware.h @@ -31,6 +31,7 @@ extern OOP_AttrBase HiddPCIDeviceAttrBase; BOOL initVesaGfxHW(struct HWData *); void DACLoad(struct HWData *, unsigned char, int); +void ClearBuffer(const struct HWData *data); #if BUFFERED_VRAM diff --git a/arch/i386-pc/drivers/vesa.hidd/vesagfxclass.c b/arch/i386-pc/drivers/vesa.hidd/vesagfxclass.c index b4c0be56a..744acbea8 100755 --- a/arch/i386-pc/drivers/vesa.hidd/vesagfxclass.c +++ b/arch/i386-pc/drivers/vesa.hidd/vesagfxclass.c @@ -1,5 +1,5 @@ /* - Copyright © 1995-2006, The AROS Development Team. All rights reserved. + Copyright © 1995-2009, The AROS Development Team. All rights reserved. $Id$ Desc: Class for Vesa. @@ -153,7 +153,7 @@ VOID PCVesa__Root__Get(OOP_Class *cl, OOP_Object *o, struct pRoot_Get *msg) { switch (idx) { - /* Our only gettable attribute is wether we support HW cursor or not. + /* Our only gettable attribute is whether we support HW cursor or not. * We do not have any such support, since we are a simple VESA fb driver */ case aoHidd_Gfx_SupportsHWCursor: *msg->storage = (IPTR)FALSE; @@ -328,9 +328,7 @@ VOID PCVesa__Hidd_Gfx__CopyBox(OOP_Class *cl, OOP_Object *o, struct pHidd_Gfx_Co VOID PCVesa__Hidd_Gfx__ShowImminentReset(OOP_Class *cl, OOP_Object *o, OOP_Msg msg) { - memset(XSD(cl)->data.framebuffer, - 0, - XSD(cl)->data.height * XSD(cl)->data.bytesperline); + ClearBuffer(&(XSD(cl)->data)); } -- 2.11.4.GIT