From c2678666756d8875cdb647dd8de9560c7f547fc2 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Tue, 15 Nov 2005 15:37:00 +0000 Subject: Small optimisation to the lcd_update_rect function - read the framebuffer data as a 32-bit word git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7895 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-ipod.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/lcd-ipod.c b/firmware/drivers/lcd-ipod.c index 30cd4555ae..69272ccccf 100644 --- a/firmware/drivers/lcd-ipod.c +++ b/firmware/drivers/lcd-ipod.c @@ -221,8 +221,11 @@ void lcd_update_rect(int x, int y, int width, int height) { int rect1, rect2, rect3, rect4; - unsigned short *addr = (unsigned short *)lcd_framebuffer; + unsigned long *addr = (unsigned long *)lcd_framebuffer; + /* TODO: Ensure x is even - so we read 32-bit aligned data from + lcd_framebuffer */ + /* calculate the drawing region */ #if CONFIG_LCD == LCD_IPODCOLOR rect1 = x; /* start vert */ @@ -277,7 +280,7 @@ void lcd_update_rect(int x, int y, int width, int height) lcd_send_lo(0x22); } - addr += x * LCD_WIDTH + y; + addr += x * LCD_WIDTH + y/2; while (height > 0) { int c, r; @@ -300,18 +303,13 @@ void lcd_update_rect(int x, int y, int width, int height) for (r = 0; r < h; r++) { /* for each column */ for (c = 0; c < width; c += 2) { - unsigned two_pixels; - - two_pixels = addr[0] | (addr[1] << 16); - addr += 2; - while ((inl(0x70008a20) & 0x1000000) == 0); /* output 2 pixels */ - outl(two_pixels, 0x70008b00); + outl(*(addr++), 0x70008b00); } - addr += LCD_WIDTH - width; + addr += (LCD_WIDTH - width)/2; } while ((inl(0x70008a20) & 0x4000000) == 0); -- cgit v1.2.3