summaryrefslogtreecommitdiff
path: root/firmware/target/arm/iriver
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-09-04 23:10:27 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-09-04 23:10:27 +0000
commit9b1dd444b005c9f99318c7a31c9f81a846d5e5af (patch)
tree1dc2f9fb2e1577f6e6ca9ae7e5096c8bf8321d82 /firmware/target/arm/iriver
parent7c587a25e595ea9495af2fa9e3272b9c901ddded (diff)
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
Diffstat (limited to 'firmware/target/arm/iriver')
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10.c66
1 files changed, 55 insertions, 11 deletions
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);