Gigabeat LCD driver cleanup: Revert the DMA optimisations to the gigabeat LCD driver - they are both buggy (the wrong background colour was often seen, e.g. in the USB screen after using a plugin) and significantly slower than the standard implementations (which use the ARM-optimised mem* functions) in lcd-16bit.c. lcd_clear_update was 4.5 times slower with DMA when a backdrop is in use, and 12 times slower with DMA when no backdrop is in use.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13392 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2007-05-15 14:26:44 +00:00
parent 4bf27eccdd
commit e22b33ec72
3 changed files with 0 additions and 114 deletions

View file

@ -105,24 +105,20 @@ int lcd_get_drawmode(void)
return drawmode; return drawmode;
} }
#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
void lcd_set_foreground(unsigned color) void lcd_set_foreground(unsigned color)
{ {
fg_pattern = color; fg_pattern = color;
} }
#endif
unsigned lcd_get_foreground(void) unsigned lcd_get_foreground(void)
{ {
return fg_pattern; return fg_pattern;
} }
#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
void lcd_set_background(unsigned color) void lcd_set_background(unsigned color)
{ {
bg_pattern = color; bg_pattern = color;
} }
#endif
unsigned lcd_get_background(void) unsigned lcd_get_background(void)
{ {
@ -221,7 +217,6 @@ void lcd_set_backdrop(fb_data* backdrop)
lcd_backdrop_offset = 0; lcd_backdrop_offset = 0;
lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor; lcd_fastpixelfuncs = lcd_fastpixelfuncs_bgcolor;
} }
lcd_device_prepare_backdrop(backdrop);
} }
fb_data* lcd_get_backdrop(void) fb_data* lcd_get_backdrop(void)
@ -232,7 +227,6 @@ fb_data* lcd_get_backdrop(void)
/*** drawing functions ***/ /*** drawing functions ***/
/* Clear the whole display */ /* Clear the whole display */
#if !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR)
void lcd_clear_display(void) void lcd_clear_display(void)
{ {
fb_data *dst = LCDADDR(0, 0); fb_data *dst = LCDADDR(0, 0);
@ -250,7 +244,6 @@ void lcd_clear_display(void)
} }
scrolling_lines = 0; scrolling_lines = 0;
} }
#endif
/* Set a single pixel */ /* Set a single pixel */
void lcd_drawpixel(int x, int y) void lcd_drawpixel(int x, int y)

View file

@ -346,10 +346,8 @@ extern void lcd_set_drawinfo(int mode, unsigned foreground,
unsigned background); unsigned background);
void lcd_set_backdrop(fb_data* backdrop); void lcd_set_backdrop(fb_data* backdrop);
#if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR) #if defined(TOSHIBA_GIGABEAT_F) && !defined(SIMULATOR)
void lcd_device_prepare_backdrop(fb_data* backdrop);
bool lcd_enabled(void); bool lcd_enabled(void);
#else #else
#define lcd_device_prepare_backdrop(x) ;
#define lcd_enabled() true #define lcd_enabled() true
#endif #endif

View file

@ -13,11 +13,6 @@
#include "bidi.h" #include "bidi.h"
#define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) #define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)])
/*
** We prepare foreground and background fills ahead of time - DMA fills in 16 byte groups
*/
unsigned long fg_pattern_blit[4];
unsigned long bg_pattern_blit[4];
volatile bool use_dma_blit = false; volatile bool use_dma_blit = false;
static volatile bool lcd_on = true; static volatile bool lcd_on = true;
@ -77,11 +72,6 @@ void lcd_init_device(void)
LCDCON5 |= 1 << 11; /* Switch from 555I mode to 565 mode */ LCDCON5 |= 1 << 11; /* Switch from 555I mode to 565 mode */
#if !defined(BOOTLOADER) #if !defined(BOOTLOADER)
memset16(fg_pattern_blit, fg_pattern, sizeof(fg_pattern_blit)/2);
memset16(bg_pattern_blit, bg_pattern, sizeof(bg_pattern_blit)/2);
clean_dcache_range((void *)fg_pattern_blit, sizeof(fg_pattern_blit));
clean_dcache_range((void *)bg_pattern_blit, sizeof(bg_pattern_blit));
use_dma_blit = true;
lcd_poweroff = false; lcd_poweroff = false;
#endif #endif
} }
@ -155,101 +145,6 @@ void lcd_enable(bool state)
} }
} }
void lcd_set_foreground(unsigned color)
{
fg_pattern = color;
memset16(fg_pattern_blit, fg_pattern, sizeof(fg_pattern_blit)/2);
invalidate_dcache_range((void *)fg_pattern_blit, sizeof(fg_pattern_blit));
}
void lcd_set_background(unsigned color)
{
bg_pattern = color;
memset16(bg_pattern_blit, bg_pattern, sizeof(bg_pattern_blit)/2);
invalidate_dcache_range((void *)bg_pattern_blit, sizeof(bg_pattern_blit));
}
void lcd_device_prepare_backdrop(fb_data* backdrop)
{
if(backdrop)
invalidate_dcache_range((void *)backdrop, (LCD_HEIGHT * sizeof(fb_data) * LCD_WIDTH));
}
void lcd_clear_display_dma(void)
{
void *src;
bool inc = false;
if(!lcd_on) {
sleep(200);
}
if (lcd_get_drawmode() & DRMODE_INVERSEVID)
src = fg_pattern_blit;
else
{
fb_data* lcd_backdrop = lcd_get_backdrop();
if (!lcd_backdrop)
src = bg_pattern_blit;
else
{
src = lcd_backdrop;
inc = true;
}
}
/* Wait for any pending transfer to complete */
while((DSTAT3 & 0x000fffff))
CLKCON |= (1 << 2); /* set IDLE bit */
DMASKTRIG3 |= 0x4; /* Stop controller */
DIDST3 = ((int) &lcd_framebuffer[0][0]) + 0x30000000; /* set DMA dest, physical address */
DIDSTC3 = 0; /* Dest on AHB, increment */
DISRC3 = ((int) src) + 0x30000000; /* Set source, in physical space */
DISRCC3 = inc ? 0x00 : 0x01; /* memory is on AHB bus, increment addresses based on backdrop */
/* Handshake on AHB, Burst mode, whole service mode, no reload, move 32-bits */
DCON3 = ((1<<30) | (1<<28) | (1<<27) | (1<<22) | (2<<20)) | ((LCD_WIDTH*LCD_HEIGHT*sizeof(fb_data)) >> 4);
/* Dump DCache for dest, we are about to overwrite it with DMA */
invalidate_dcache_range((void *)lcd_framebuffer, sizeof(lcd_framebuffer));
/* Activate the channel */
DMASKTRIG3 = 2;
/* Start DMA */
DMASKTRIG3 |= 1;
/* Wait for transfer to complete */
while((DSTAT3 & 0x000fffff))
CLKCON |= (1 << 2); /* set IDLE bit */
}
void lcd_clear_display(void)
{
lcd_stop_scroll();
if(use_dma_blit)
{
lcd_clear_display_dma();
return;
}
fb_data *dst = &lcd_framebuffer[0][0];
if (lcd_get_drawmode() & DRMODE_INVERSEVID)
{
memset16(dst, fg_pattern, LCD_WIDTH*LCD_HEIGHT);
}
else
{
fb_data* lcd_backdrop = lcd_get_backdrop();
if (!lcd_backdrop)
memset16(dst, bg_pattern, LCD_WIDTH*LCD_HEIGHT);
else
memcpy(dst, lcd_backdrop, sizeof(lcd_framebuffer));
}
}
/* Update the display. /* Update the display.
This must be called after all other LCD functions that change the display. */ This must be called after all other LCD functions that change the display. */
void lcd_update(void) void lcd_update(void)