From 93fccc763b97323cb3112bf9afee819cd03ba195 Mon Sep 17 00:00:00 2001 From: Karl Kurbjun Date: Thu, 9 Apr 2009 04:22:14 +0000 Subject: M:Robe 500: More LCD initialization, QVGA (vs. VGA) is now enabled by default for performance, 256 color palette mode added, include some linker cleanups and reorganization. Doom and MPEGPlayer now run reaonably well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20664 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/doom/i_video.c | 95 +++++++++++++++++++++++++++++---------------- apps/plugins/plugin.lds | 20 +++++----- 2 files changed, 70 insertions(+), 45 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c index c148d17077..418fcd4404 100644 --- a/apps/plugins/doom/i_video.c +++ b/apps/plugins/doom/i_video.c @@ -140,6 +140,12 @@ static fb_data *paldata=NULL; // void I_ShutdownGraphics(void) { +#if defined(HAVE_LCD_MODES) +#if (HAVE_LCD_MODES & LCD_MODE_PAL256) + rb->lcd_set_mode(LCD_MODE_RGB565); +#endif +#endif + #ifndef HAVE_LCD_COLOR grey_release(); #endif @@ -597,13 +603,19 @@ static void I_UploadNewPalette(int pal) } #ifdef RANGECHECK - if ((size_t)pal >= num_pals) - I_Error("I_UploadNewPalette: Palette number out of range (%d>=%d)", - pal, num_pals); + if ((size_t)pal >= num_pals) + I_Error("I_UploadNewPalette: Palette number out of range (%d>=%d)", + pal, num_pals); #endif - memcpy(palette,paldata+256*pal,256*sizeof(fb_data)); -} + memcpy(palette,paldata+256*pal,256*sizeof(fb_data)); + +#if defined(HAVE_LCD_MODES) +#if (HAVE_LCD_MODES & LCD_MODE_PAL256) + rb->lcd_pal256_update_pal(paldata+256*pal); +#endif +#endif +} // // I_FinishUpdate @@ -613,36 +625,37 @@ void I_FinishUpdate (void) { int count; byte *src = d_screens[0]; + #if (CONFIG_LCD == LCD_H300) && !defined(SIMULATOR) count = SCREENWIDTH*SCREENHEIGHT; /* ASM screen update (drops ~300 tics) */ asm volatile ( - "move.w #33, (%[LCD]) \n" /* Setup the LCD controller */ - "nop \n" - "clr.w (%[LCD2]) \n" - "nop \n" - "move.w #34, (%[LCD]) \n" /* End LCD controller setup */ - "clr.l %%d1 \n" - ".loop: \n" - "move.l (%[scrp])+, %%d0 \n" - "swap.w %%d0 \n" - "move.w %%d0, %%d1 \n" - "lsr.l #8,%%d1 \n" - "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" - "move.b %%d0,%%d1 \n" - "swap.w %%d0 \n" - "nop \n" - "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" - "move.w %%d0, %%d1 \n" - "lsr.l #8,%%d1 \n" - "nop \n" - "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" - "move.b %%d0,%%d1 \n" - "nop \n" - "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" - "subq.l #4,%[cnt] \n" - "bne.b .loop \n" + "move.w #33, (%[LCD]) \n" /* Setup the LCD controller */ + "nop \n" + "clr.w (%[LCD2]) \n" + "nop \n" + "move.w #34, (%[LCD]) \n" /* End LCD controller setup */ + "clr.l %%d1 \n" + ".loop: \n" + "move.l (%[scrp])+, %%d0 \n" + "swap.w %%d0 \n" + "move.w %%d0, %%d1 \n" + "lsr.l #8,%%d1 \n" + "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" + "move.b %%d0,%%d1 \n" + "swap.w %%d0 \n" + "nop \n" + "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" + "move.w %%d0, %%d1 \n" + "lsr.l #8,%%d1 \n" + "nop \n" + "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" + "move.b %%d0,%%d1 \n" + "nop \n" + "move.w (%[pal], %%d1.l:2), (%[LCD2]) \n" + "subq.l #4,%[cnt] \n" + "bne.b .loop \n" : /* outputs */ [scrp]"+a"(src), [cnt] "+d"(count) @@ -713,7 +726,14 @@ void I_FinishUpdate (void) "d0", "d1", "d2", "d3" ); #else -#ifdef HAVE_LCD_COLOR + +/* If the hardware has support for a paletted mode it takes precidence */ +#if defined(HAVE_LCD_MODES) +#if (HAVE_LCD_MODES & LCD_MODE_PAL256) + (void) count; + rb->lcd_blit_pal256(src, 0, 0, 0, 0, LCD_WIDTH, LCD_HEIGHT); +#endif +#elif defined(HAVE_LCD_COLOR) #if(LCD_HEIGHT>LCD_WIDTH) if(rotate_screen) { @@ -742,8 +762,9 @@ void I_FinishUpdate (void) *dst++ = palette[*src++]; while (--count); } - rb->lcd_update(); + rb->lcd_update(); #else /* !HAVE_LCD_COLOR */ + unsigned char *dst; int y; @@ -758,8 +779,8 @@ void I_FinishUpdate (void) grey_ub_gray_bitmap(greybuffer, 0, y, SCREENWIDTH, 1); } -#endif /* !HAVE_LCD_COLOR */ -#endif +#endif +#endif } // @@ -786,6 +807,12 @@ void I_InitGraphics(void) printf("Starting Graphics engine\n"); noprintf=1; + +#if defined(HAVE_LCD_MODES) +#if (HAVE_LCD_MODES & LCD_MODE_PAL256) + rb->lcd_set_mode(LCD_MODE_PAL256); +#endif +#endif /* Note: The other screens are allocated as needed */ diff --git a/apps/plugins/plugin.lds b/apps/plugins/plugin.lds index 9c65f31779..d6f62341ce 100644 --- a/apps/plugins/plugin.lds +++ b/apps/plugins/plugin.lds @@ -35,18 +35,20 @@ OUTPUT_FORMAT(elf32-littlemips) #define NOCACHE_BASE 0x00000000 #endif -#if CONFIG_CPU==DM320 || CONFIG_CPU==S3C2440 -#define LCD_BUFFER_SIZE (LCD_WIDTH*LCD_HEIGHT*2) +#if CONFIG_CPU==DM320 || CONFIG_CPU==IMX31L +/* Give this 1 meg to allow it to align to the MMU boundary */ +#define LCD_TTB_AREA 0x100000 +#define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_TTB_AREA +#elif CONFIG_CPU==S3C2440 +#define LCD_BUFFER_SIZE (LCD_WIDTH*LCD_HEIGHT*2) /* must be 16Kb (0x4000) aligned */ #define TTB_SIZE (0x4000) #define DRAMSIZE (MEMORYSIZE * 0x100000) - STUBOFFSET - PLUGIN_BUFFER_SIZE - CODEC_SIZE - LCD_BUFFER_SIZE - TTB_SIZE -#elif CONFIG_CPU==IMX31L -#include "imx31l.h" -/* Reserve 1mb for LCD buffer/TTB as in app.lds */ -#define DRAMSIZE (MEMORYSIZE * 0x100000 - 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE + #elif CONFIG_CPU==AS3525 && MEMORYSIZE <= 2 #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET + #else #define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGIN_BUFFER_SIZE - STUBOFFSET - CODEC_SIZE #endif @@ -77,11 +79,7 @@ OUTPUT_FORMAT(elf32-littlemips) #define DRAMORIG 0xc00000 + STUBOFFSET #define IRAMORIG 0x407000 #define IRAMSIZE 0x9000 -#elif CONFIG_CPU == S3C2440 -#define DRAMORIG 0x0 + STUBOFFSET -#define IRAM DRAM -#define IRAMSIZE 0 -#elif CONFIG_CPU == IMX31L +#elif CONFIG_CPU == IMX31L || CONFIG_CPU == S3C2440 #define DRAMORIG 0x0 + STUBOFFSET #define IRAM DRAM #define IRAMSIZE 0 -- cgit v1.2.3