From 49450b8fff331fbe0970b430aa33c0654d251403 Mon Sep 17 00:00:00 2001 From: dborth Date: Sun, 20 Jun 2010 00:26:44 +0000 Subject: [PATCH] static xfb to reduce mem frag --- source/video.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/source/video.cpp b/source/video.cpp index 856630b..f44f48e 100644 --- a/source/video.cpp +++ b/source/video.cpp @@ -372,12 +372,6 @@ static void SetupVideoMode(GXRModeObj * mode) VIDEO_Configure (mode); VIDEO_Flush(); - // Allocate the video buffers - if(xfb[0]) free(MEM_K1_TO_K0(xfb[0])); - if(xfb[1]) free(MEM_K1_TO_K0(xfb[1])); - xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (mode)); - xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (mode)); - // Clear framebuffers etc. VIDEO_ClearFrameBuffer (mode, xfb[0], COLOR_BLACK); VIDEO_ClearFrameBuffer (mode, xfb[1], COLOR_BLACK); @@ -408,6 +402,11 @@ void InitializeVideo () { VIDEO_Init(); + + // Allocate the video buffers + xfb[0] = (u32 *) MEM_K0_TO_K1 (memalign(32, 640*574*2)); + xfb[1] = (u32 *) MEM_K0_TO_K1 (memalign(32, 640*574*2)); + GXRModeObj *rmode = FindVideoMode(); SetupVideoMode(rmode);