summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2009-06-20 22:49:04 +0000
committerRafaël Carré <rafael.carre@gmail.com>2009-06-20 22:49:04 +0000
commitcb2c947b1b7fef96892f474144e61b8bbd87a615 (patch)
treee23821733e573490e346282d9cb40ddc63b46747
parent1f07151110ed32bf3f443b9c509bec463c50412d (diff)
downloadrockbox-cb2c947b1b7fef96892f474144e61b8bbd87a615.zip
rockbox-cb2c947b1b7fef96892f474144e61b8bbd87a615.tar.gz
rockbox-cb2c947b1b7fef96892f474144e61b8bbd87a615.tar.bz2
rockbox-cb2c947b1b7fef96892f474144e61b8bbd87a615.tar.xz
Sansa c200v1 & c200v2 LCD: higher performance when writing pixels
c200v1: use a loop similar to r21320 and before to get almost the same performance (49.x fps while r21320 had 50.7 fps) c200v2: better use of the DBOP fifo (taken from r21190) : 30% more fps rename lcd_send_data to lcd_write_data now that it has the same prototype git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21427 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/lcd-c200_c200v2.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/firmware/target/arm/lcd-c200_c200v2.c b/firmware/target/arm/lcd-c200_c200v2.c
index b3e8f0e..619a03b 100644
--- a/firmware/target/arm/lcd-c200_c200v2.c
+++ b/firmware/target/arm/lcd-c200_c200v2.c
@@ -78,15 +78,19 @@ static inline void lcd_wait_write(void)
}
/* send LCD data */
-static void lcd_send_data(const fb_data *data, int width)
+static void lcd_send_pixel(const fb_data data)
{
- while(width--)
- {
- lcd_wait_write();
- LCD1_DATA = *data >> 8;
- lcd_wait_write();
- LCD1_DATA = *data++ & 0xff;
- }
+ lcd_wait_write();
+ LCD1_DATA = data >> 8;
+ lcd_wait_write();
+ LCD1_DATA = data & 0xff;
+}
+
+inline void lcd_write_data(const fb_data *data, int width)
+{
+ do {
+ lcd_send_pixel(*data++);
+ } while(--width);
}
/* send LCD command */
@@ -129,14 +133,18 @@ static inline void lcd_delay(int delay)
}
/* send LCD data */
-static void lcd_send_data(const fb_data *data, int width)
+void lcd_write_data(const fb_data *data, int width)
{
- while(width--)
- {
+ do {
DBOP_DOUT = *data << 8 | *data >> 8;
data++;
- while ((DBOP_STAT & (1<<10)) == 0);
- }
+
+ /* Wait if push fifo is full */
+ while ((DBOP_STAT & (1<<6)) != 0);
+ } while(--width);
+
+ /* While push fifo is not empty */
+ while ((DBOP_STAT & (1<<10)) == 0);
}
/* send LCD command */
@@ -184,7 +192,7 @@ bool lcd_button_support(void)
lcd_send_command(R_Y_ADDR_AREA, 0);
lcd_send_command(1, 0);
- lcd_send_data(&data, 1);
+ lcd_write_data(&data, 1);
return true;
}
@@ -445,7 +453,7 @@ void lcd_update_rect(int x, int y, int width, int height)
lcd_send_command(y + height - 1 + 0x1a, 0);
do {
- lcd_send_data(addr, width);
+ lcd_write_data(addr, width);
addr += LCD_WIDTH;
} while (--height > 0);