From 3823d229a553afd2353946e09323a9bcbf1256ed Mon Sep 17 00:00:00 2001 From: notaz Date: Sat, 27 Dec 2008 17:14:15 +0000 Subject: [PATCH] got rid of fb border integration, using defines instead git-svn-id: file:///home/notaz/opt/svn/PicoDrive@620 be3aeb3a-fb24-0410-a615-afba39da0efa --- platform/uiq3/engine/blit.s | 60 +++++++++++++++++++++++------------- platform/uiq3/engine/vid.cpp | 25 ++++++++------- platform/uiq3/port_config.h | 3 ++ platform/uiq3/port_config.s | 3 ++ 4 files changed, 57 insertions(+), 34 deletions(-) diff --git a/platform/uiq3/engine/blit.s b/platform/uiq3/engine/blit.s index c377a76..f10a3cc 100644 --- a/platform/uiq3/engine/blit.s +++ b/platform/uiq3/engine/blit.s @@ -4,6 +4,8 @@ @ (c) Copyright 2006, notaz @ All Rights Reserved +.include "port_config.s" + @ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0 @ to 00000000 rrr00000 ggg00000 bbb00000 ... @@ -342,13 +344,13 @@ vidConvCpy_90: mov r6, #0 stmia r0!, {r3-r6} stmia r0!, {r3-r6} - add r7, r0, #256*4-8*4 + add r7, r0, #(240+BORDER_R)*4-8*4 stmia r7!, {r3-r6} stmia r7!, {r3-r6} - add r7, r7, #256*4-8*4 + add r7, r7, #(240+BORDER_R)*4-8*4 stmia r7!, {r3-r6} stmia r7!, {r3-r6} - add r7, r7, #256*4-8*4 + add r7, r7, #(240+BORDER_R)*4-8*4 stmia r7!, {r3-r6} stmia r7!, {r3-r6} @@ -373,7 +375,7 @@ vidConvCpy_90: mode2_4pix 0 .endif stmia r0, {r7,r8,r10,lr} - add r0, r0, #256*4 + add r0, r0, #(240+BORDER_R)*4 .if \is270 mode2_4pix 16 @@ -381,7 +383,7 @@ vidConvCpy_90: mode2_4pix 8 .endif stmia r0, {r7,r8,r10,lr} - add r0, r0, #256*4 + add r0, r0, #(240+BORDER_R)*4 .if \is270 mode2_4pix 8 @@ -389,7 +391,7 @@ vidConvCpy_90: mode2_4pix 16 .endif stmia r0, {r7,r8,r10,lr} - add r0, r0, #256*4 + add r0, r0, #(240+BORDER_R)*4 .if \is270 mode2_4pix 0 @@ -397,7 +399,7 @@ vidConvCpy_90: mode2_4pix 24 .endif stmia r0!,{r7,r8,r10,lr} - sub r0, r0, #256*4*3 + sub r0, r0, #(240+BORDER_R)*4*3 bpl 0b @ .loopM2RGB32_270 @@ -407,13 +409,13 @@ vidConvCpy_90: mov r6, #0 stmia r0!, {r3-r6} stmia r0!, {r3-r6} - add r0, r0, #256*4-8*4 + add r0, r0, #(240+BORDER_R)*4-8*4 stmia r0!, {r3-r6} stmia r0!, {r3-r6} - add r0, r0, #256*4-8*4 + add r0, r0, #(240+BORDER_R)*4-8*4 stmia r0!, {r3-r6} stmia r0!, {r3-r6} - add r0, r0, #256*4-8*4 + add r0, r0, #(240+BORDER_R)*4-8*4 stmia r0!, {r3-r6} nop @ phone crashes if this is commented out. Do I stress it too much? stmia r0!, {r3-r6} @@ -422,7 +424,9 @@ vidConvCpy_90: subs r12, r12, #1 ldmeqfd sp!, {r4-r11,pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif .if \is270 sub r9, r9, #4 @ fix src pointer .else @@ -432,13 +436,13 @@ vidConvCpy_90: stmia r0!, {r3-r6} @ top border stmia r0!, {r3-r6} - add r7, r0, #256*4-8*4 + add r7, r0, #(240+BORDER_R)*4-8*4 stmia r7!, {r3-r6} stmia r7!, {r3-r6} - add r7, r7, #256*4-8*4 + add r7, r7, #(240+BORDER_R)*4-8*4 stmia r7!, {r3-r6} stmia r7!, {r3-r6} - add r7, r7, #256*4-8*4 + add r7, r7, #(240+BORDER_R)*4-8*4 stmia r7!, {r3-r6} stmia r7!, {r3-r6} @@ -481,7 +485,9 @@ vidConvCpy_center_0: sub r12, r12, #1 adds r12, r12, #1<<16 ldmeqfd sp!, {r4-r6,r11,pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif add r1, r1, #88 orr r12, #(240/4-1)<<16 b .loopRGB32_c0 @@ -510,7 +516,9 @@ vidConvCpy_center_180: sub r12, r12, #1 adds r12, r12, #1<<16 ldmeqfd sp!, {r4-r6,r11,pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif sub r1, r1, #88 orr r12, #(240/4-1)<<16 b .loopRGB32_c180 @@ -544,7 +552,9 @@ vidConvCpy_center2_40c_0: sub r12, r12, #1 adds r12, r12, #1<<16 ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif add r1, r1, #8 orr r12, #(240/3-1)<<16 b .loopRGB32_c2_40c_0 @@ -580,7 +590,9 @@ vidConvCpy_center2_40c_180: sub r12, r12, #1 adds r12, r12, #1<<16 ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif sub r1, r1, #8 orr r12, #(240/3-1)<<16 b .loop_c2_40c_180 @@ -617,7 +629,9 @@ vidConvCpy_center2_32c_0: sub r12, r12, #1 adds r12, r12, #1<<16 ldmeqfd sp!, {r4-r11,pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif add r1, r1, #64+8 orr r12, #(240/15-1)<<16 b .loop_c2_32c_0 @@ -658,7 +672,9 @@ vidConvCpy_center2_32c_180: sub r12, r12, #1 adds r12, r12, #1<<16 ldmeqfd sp!, {r4-r11,pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif sub r1, r1, #64+8 orr r12, #(240/15-1)<<16 b .loop_c2_32c_180 @@ -690,7 +706,9 @@ vidClear: sub r12, r12, #1 adds r12, r12, #1<<16 ldmeqfd sp!, {pc} @ return - add r0, r0, #16*4 +.if BORDER_R + add r0, r0, #BORDER_R*4 +.endif orr r12, #(240/16-1)<<16 b .loopVidClear diff --git a/platform/uiq3/engine/vid.cpp b/platform/uiq3/engine/vid.cpp index b07e4a4..b23a531 100644 --- a/platform/uiq3/engine/vid.cpp +++ b/platform/uiq3/engine/vid.cpp @@ -19,7 +19,7 @@ extern const char *actionNames[]; static void *screenbuff = 0; // pointer to real device video memory //static extern "C" { unsigned char *PicoDraw2FB = 0; } // temporary buffer -const int framebuffsize = (8+320)*(8+240+8)*2+8*2; // actual framebuffer size (in bytes+to support new rendering mode) +const int framebuffsize = (8+320)*(8+240+8)*2+8*2; // PicoDraw2FB size (in bytes+to support new rendering mode) // drawer function pointers static void (*drawTextFps)(const char *text) = 0; @@ -272,9 +272,9 @@ static void vidBlit_90(int full) vidConvCpy_90(pd, ps, localPal, 320/8); else { if(full) vidClear(pd, 32); - pd += 256*32; + pd += (240+VID_BORDER_R)*32; vidConvCpy_90(pd, ps, localPal, 256/8); - if(full) vidClear(pd + 256*256, 32); + if(full) vidClear(pd + (240+VID_BORDER_R)*256, 32); } } @@ -288,10 +288,10 @@ static void vidBlit_270(int full) vidConvCpy_270(pd, ps, localPal, 320/8); else { if(full) vidClear(pd, 32); - pd += 256*32; + pd += (240+VID_BORDER_R)*32; ps -= 64; // the blitter starts copying from the right border, so we need to adjust vidConvCpy_270(pd, ps, localPal, 256/8); - if(full) vidClear(pd + 256*256, 32); + if(full) vidClear(pd + (240+VID_BORDER_R)*256, 32); } } @@ -303,7 +303,7 @@ static void vidBlitCenter_0(int full) if(Pico.video.reg[12]&1) ps += 32; vidConvCpy_center_0(pd, ps, localPal); - if(full) vidClear(pd + 224*256, 96); + if(full) vidClear(pd + (240+VID_BORDER_R)*224, 96); } @@ -314,7 +314,7 @@ static void vidBlitCenter_180(int full) if(Pico.video.reg[12]&1) ps += 32; vidConvCpy_center_180(pd, ps, localPal); - if(full) vidClear(pd + 224*256, 96); + if(full) vidClear(pd + (240+VID_BORDER_R)*224, 96); } @@ -323,7 +323,7 @@ static void vidBlitFit_0(int full) if(Pico.video.reg[12]&1) vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168); else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 168); - if(full) vidClear((unsigned long *)screenbuff + 168*256, 320-168); + if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*168, 320-168); } @@ -332,7 +332,7 @@ static void vidBlitFit_180(int full) if(Pico.video.reg[12]&1) vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 168); else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 168); - if(full) vidClear((unsigned long *)screenbuff + 168*256, 320-168); + if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*168, 320-168); } @@ -341,7 +341,7 @@ static void vidBlitFit2_0(int full) if(Pico.video.reg[12]&1) vidConvCpy_center2_40c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224); else vidConvCpy_center2_32c_0(screenbuff, PicoDraw2FB+328*8, localPal, 224); - if(full) vidClear((unsigned long *)screenbuff + 224*256, 96); + if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*224, 96); } @@ -350,10 +350,9 @@ static void vidBlitFit2_180(int full) if(Pico.video.reg[12]&1) vidConvCpy_center2_40c_180(screenbuff, PicoDraw2FB+328*8, localPal, 224); else vidConvCpy_center2_32c_180(screenbuff, PicoDraw2FB+328*8-64, localPal, 224); - if(full) vidClear((unsigned long *)screenbuff + 224*256, 96); + if(full) vidClear((unsigned long *)screenbuff + (240+VID_BORDER_R)*224, 96); } - static void vidBlitCfg(void) { unsigned short *ps = (unsigned short *) PicoDraw2FB; @@ -364,7 +363,7 @@ static void vidBlitCfg(void) //for (int i = 1; i < 320; i++, ps += 240, pd += 256) // vidConvCpyRGB32(pd, ps, 240); - for (i = 0; i < 320; i++, pd += 16) + for (i = 0; i < 320; i++, pd += VID_BORDER_R) for (int u = 0; u < 240; u++, ps++, pd++) *pd = ((*ps & 0xf) << 20) | ((*ps & 0xf0) << 8) | ((*ps & 0xf00) >> 4); } diff --git a/platform/uiq3/port_config.h b/platform/uiq3/port_config.h index 5d0f977..e5016dc 100644 --- a/platform/uiq3/port_config.h +++ b/platform/uiq3/port_config.h @@ -31,4 +31,7 @@ #define PATH_SEP "\\" #define PATH_SEP_C '\\' +// engine/vid.cpp, also update BORDER_R in port_config.s +#define VID_BORDER_R 16 + #endif // PORT_CONFIG_H diff --git a/platform/uiq3/port_config.s b/platform/uiq3/port_config.s index 3361f1a..59fd9aa 100644 --- a/platform/uiq3/port_config.s +++ b/platform/uiq3/port_config.s @@ -11,3 +11,6 @@ @ this should be set to one only for GP2X port .equiv EXTERNAL_YM2612, 0 + +@ also update VID_BORDER_R in port_config.h +.equiv BORDER_R, 16 -- 2.39.2