1
0
Fork 0
forked from len0rd/rockbox

Patch #4829 from Fredrik Öhrn - Coldfire assembler blit_display() function for H300 and move the palette data into IRAM. Each of these gives about a 1fps speed improvement.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9038 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2006-03-15 01:27:13 +00:00
parent 789e01bd06
commit b3358bd1a2
3 changed files with 166 additions and 5 deletions

View file

@ -4,6 +4,8 @@ hardware.c
z80.c z80.c
#if (CONFIG_CPU == PP5020) && (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224) #if (CONFIG_CPU == PP5020) && (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224)
pacbox_arm.S pacbox_arm.S
#elif defined(IRIVER_H300_SERIES) && !defined(SIMULATOR)
pacbox_cf.S
#else #else
pacbox_lcd.c pacbox_lcd.c
#endif #endif

View file

@ -87,9 +87,15 @@ enum {
FlipXY = 0x03 FlipXY = 0x03
}; };
fb_data palette[256]; /* Color palette */ /* Putting this in IRAM actually slows down the iPods, but is good for
int vchar_to_x_[1024]; the Coldfire
int vchar_to_y_[1024]; */
#ifdef CPU_COLDFIRE
fb_data palette[256] IBSS_ATTR; /* Color palette */
#else
fb_data palette[256]; /* Color palette */
#endif
void init_PacmanMachine(int dip) void init_PacmanMachine(int dip)
{ {
@ -129,8 +135,6 @@ void init_PacmanMachine(int dip)
x = 27 - ((i-0x40) >> 5); x = 27 - ((i-0x40) >> 5);
y = 2 + ((i-0x40) & 0x1F); y = 2 + ((i-0x40) & 0x1F);
} }
vchar_to_x_[i] = x;
vchar_to_y_[i] = y;
if( (y >= 0) && (y < 36) && (x >= 0) && (x < 28) ) if( (y >= 0) && (y < 36) && (x >= 0) && (x < 28) )
vchar_to_i_[i] = y*28 + x; vchar_to_i_[i] = y*28 + x;
else else

View file

@ -0,0 +1,155 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (c) 2006 Fredrik Ohrn
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include "pacbox.h"
.section .text
.align 2
.global blit_display
/*
0.75 scaling - display 3 out of 4 pixels = 216x168
Skipping pixel #2 out of 4 seems to give the most legible display
void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
{
next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+((ScreenHeight*3)/4)-1];
for (y=ScreenHeight-1;y >= 0; y--) {
if ((y & 3) != 1) {
dst = (next_dst--);
for (x=0;x<ScreenWidth;x++) {
if ((x & 3) == 1) { vbuf++; }
else {
*dst = palette[*(vbuf++)];
dst+=LCD_WIDTH;
}
}
} else {
vbuf+=ScreenWidth;
}
}
}
*/
/* FIXME: ScreenWidth & ScreenHeight are defined in arcade.h, but all
hell breaks loose if you include it... */
#define ScreenWidth 224
#define ScreenHeight 288
#define SHRUNK_WIDTH ((ScreenWidth/4)*3)
#define SHRUNK_HEIGHT ((ScreenHeight/4)*3)
blit_display:
lea -28(%sp), %sp
movem.l %d2-%d6/%a2, (%sp)
move.l 32(%sp), %a0 // lcd_framebuffer
move.l 36(%sp), %a2 // vbuf
lea palette, %a1
lea.l ((YOFS * LCD_WIDTH + XOFS + SHRUNK_HEIGHT) * 2)(%a0), %a0
move.l #(ScreenHeight / 4), %d0
move.l #(ScreenWidth / 4), %d1
moveq.l #0, %d2
y_loop:
move.l %d1, %d5
x_loop1:
move.l (%a2)+, %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, (2 * LCD_WIDTH * 2)(%a0)
lsr.l #8, %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, (1 * LCD_WIDTH * 2)(%a0)
swap.w %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), (%a0)
lea.l 3 * LCD_WIDTH * 2(%a0), %a0
subq.l #1, %d5
bne.s x_loop1
suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0
lea.l ScreenWidth(%a2), %a2 // Skip 1 line
move.l %d1, %d5
x_loop2:
move.l (%a2)+, %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, 2 * LCD_WIDTH * 2(%a0)
lsr.l #8, %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, 1 * LCD_WIDTH * 2(%a0)
swap.w %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), (%a0)
lea.l 3 * LCD_WIDTH * 2(%a0), %a0
subq.l #1, %d5
bne.s x_loop2
suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0
move.l %d1, %d5
x_loop3:
move.l (%a2)+, %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, 2 * LCD_WIDTH * 2(%a0)
lsr.l #8, %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, 1 * LCD_WIDTH * 2(%a0)
swap.w %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), (%a0)
lea.l 3 * LCD_WIDTH * 2(%a0), %a0
subq.l #1, %d5
bne.s x_loop3
suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0
subq.l #1, %d0
bne y_loop
movem.l (%sp), %d2-%d6/%a2
lea.l 28(%sp), %sp
rts