From 9b1dd444b005c9f99318c7a31c9f81a846d5e5af Mon Sep 17 00:00:00 2001 From: Barry Wardell Date: Mon, 4 Sep 2006 23:10:27 +0000 Subject: Fix display bugs with H10 LCDs (both 20GB and 5/6GB models). The 20GB LCD is actually a 128x160 LCD rotated 90 degrees, so we need to take account of this. The 5/6GB LCD is not rotated by 90 degrees but was treated as if it was (FS #5925, patch thanks to Thilo-Alexander Ginkel) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10886 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/iriver/h10/lcd-h10.c | 66 ++++++++++++++++++++++++++------ 1 file changed, 55 insertions(+), 11 deletions(-) (limited to 'firmware/target/arm/iriver/h10') diff --git a/firmware/target/arm/iriver/h10/lcd-h10.c b/firmware/target/arm/iriver/h10/lcd-h10.c index a791009b33..64e8f5d8b9 100644 --- a/firmware/target/arm/iriver/h10/lcd-h10.c +++ b/firmware/target/arm/iriver/h10/lcd-h10.c @@ -104,8 +104,8 @@ static inline bool timer_check(int clock_start, int usecs) #define R_GATE_SCAN_START_POS 0x40 #define R_1ST_SCR_DRV_POS 0x42 #define R_2ND_SCR_DRV_POS 0x43 -#define R_VERT_RAM_ADDR_POS 0x44 -#define R_HORIZ_RAM_ADDR_POS 0x45 +#define R_HORIZ_RAM_ADDR_POS 0x44 +#define R_VERT_RAM_ADDR_POS 0x45 #endif @@ -219,18 +219,40 @@ void lcd_yuv_blit(unsigned char * const src[3], y0 = y; y1 = y + height - 1; - /* max horiz << 8 | start horiz */ +#if CONFIG_LCD == LCD_H10_5GB + /* start horiz << 8 | max horiz */ lcd_send_cmd(R_HORIZ_RAM_ADDR_POS); + lcd_send_data((x0 << 8) | x1); + + /* start vert << 8 | max vert */ + lcd_send_cmd(R_VERT_RAM_ADDR_POS); lcd_send_data((y0 << 8) | y1); - /* max vert << 8 | start vert */ + + /* start horiz << 8 | start vert */ + lcd_send_cmd(R_RAM_ADDR_SET); + lcd_send_data(((x0 << 8) | y0)); + +#elif CONFIG_LCD == LCD_H10_20GB + /* The 20GB LCD is actually 128x160 but rotated 90 degrees so the origin + * is actually the bottom left and horizontal and vertical are swapped. + * Rockbox expects the origin to be the top left so we need to use + * 127 - y instead of just y */ + + /* start horiz << 8 | max horiz */ + lcd_send_cmd(R_HORIZ_RAM_ADDR_POS); + lcd_send_data(((127-y1) << 8) | (127-y0)); + + /* start vert << 8 | max vert */ lcd_send_cmd(R_VERT_RAM_ADDR_POS); lcd_send_data((x0 << 8) | x1); /* position cursor (set AD0-AD15) */ - /* start vert << 8 | start horiz */ + /* start horiz << 8 | start vert */ lcd_send_cmd(R_RAM_ADDR_SET); - lcd_send_data(((y0 << 8) | x0)); - + lcd_send_data((((127-y0) << 8) | x0)); + +#endif /* CONFIG_LCD */ + /* start drawing */ lcd_send_cmd(R_WRITE_DATA_2_GRAM); @@ -390,17 +412,39 @@ void lcd_update_rect(int x0, int y0, int width, int height) x1 = t; } - /* max horiz << 8 | start horiz */ +#if CONFIG_LCD == LCD_H10_5GB + /* start horiz << 8 | max horiz */ lcd_send_cmd(R_HORIZ_RAM_ADDR_POS); + lcd_send_data((x0 << 8) | x1); + + /* start vert << 8 | max vert */ + lcd_send_cmd(R_VERT_RAM_ADDR_POS); lcd_send_data((y0 << 8) | y1); - /* max vert << 8 | start vert */ + + /* start horiz << 8 | start vert */ + lcd_send_cmd(R_RAM_ADDR_SET); + lcd_send_data(((x0 << 8) | y0)); + +#elif CONFIG_LCD == LCD_H10_20GB + /* The 20GB LCD is actually 128x160 but rotated 90 degrees so the origin + * is actually the bottom left and horizontal and vertical are swapped. + * Rockbox expects the origin to be the top left so we need to use + * 127 - y instead of just y */ + + /* start horiz << 8 | max horiz */ + lcd_send_cmd(R_HORIZ_RAM_ADDR_POS); + lcd_send_data(((127-y1) << 8) | (127-y0)); + + /* start vert << 8 | max vert */ lcd_send_cmd(R_VERT_RAM_ADDR_POS); lcd_send_data((x0 << 8) | x1); /* position cursor (set AD0-AD15) */ - /* start vert << 8 | start horiz */ + /* start horiz << 8 | start vert */ lcd_send_cmd(R_RAM_ADDR_SET); - lcd_send_data(((y0 << 8) | x0)); + lcd_send_data((((127-y0) << 8) | x0)); + +#endif /* CONFIG_LCD */ /* start drawing */ lcd_send_cmd(R_WRITE_DATA_2_GRAM); -- cgit v1.2.3