From d192bdf11e06e50645ecb5726658d4b691480a9a Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sun, 12 Dec 2010 15:01:36 +0000 Subject: FS#11708 - Major speedup of iPod nano 2G. Part 1: Loop unrolling and reduction of FIFO register polling. +50% for RGB, +34% for YUV. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28809 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c') diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index 195953979e..5bda9e7387 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c @@ -417,10 +417,8 @@ void lcd_init_device(void) static inline void lcd_write_pixel(fb_data pixel) { - while (LCD_STATUS & 0x10); - LCD_WDATA = (pixel & 0xff00) >> 8; - while (LCD_STATUS & 0x10); - LCD_WDATA = pixel & 0xff; + LCD_WDATA = pixel >> 8; + LCD_WDATA = pixel; /* no need to &0xff here, only lower 8 bit used */ } /* Update the display. @@ -435,9 +433,10 @@ void lcd_update(void) void lcd_update_rect(int, int, int, int) ICODE_ATTR; void lcd_update_rect(int x, int y, int width, int height) { - int xx,yy; int y0, x0, y1, x1; fb_data* p; + + width = (width + 1) & ~1; /* ensure width is even */ x0 = x; /* start horiz */ y0 = y; /* start vert */ @@ -467,15 +466,29 @@ void lcd_update_rect(int x, int y, int width, int height) s5l_lcd_write_cmd(R_MEMORY_WRITE); } - /* Copy display bitmap to hardware */ p = &lcd_framebuffer[y0][x0]; - yy = height; - for (yy = y0; yy <= y1; yy++) { - for (xx = x0; xx <= x1; xx++) { + if (LCD_WIDTH == width) + { + x1 = height*LCD_WIDTH/4; + do { + while (LCD_STATUS & 0x08); /* wait while FIFO is half full */ lcd_write_pixel(*(p++)); - } - p += LCD_WIDTH - width; + lcd_write_pixel(*(p++)); + lcd_write_pixel(*(p++)); + lcd_write_pixel(*(p++)); + } while (--x1 > 0); + } else { + y1 = height; + do { + x1 = width/2; /* width is forced to even to allow speed up */ + do { + while (LCD_STATUS & 0x08); /* wait while FIFO is half full */ + lcd_write_pixel(*(p++)); + lcd_write_pixel(*(p++)); + } while (--x1 > 0 ); + p += LCD_WIDTH - width; + } while (--y1 > 0 ); } } @@ -616,6 +629,7 @@ void lcd_blit_yuv(unsigned char * const src[3], } /* output 2 pixels */ + while (LCD_STATUS & 0x08); /* wait while FIFO is half full */ lcd_write_pixel((red1 << 11) | (green1 << 5) | blue1); lcd_write_pixel((red2 << 11) | (green2 << 5) | blue2); } -- cgit v1.2.3