summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-06-18 07:15:00 +0200
committerThomas Martitz <kugel@rockbox.org>2014-06-21 00:15:53 +0200
commita1842c04f9cb73210d4cacde61a9e4b115050765 (patch)
treea37af61ef9285b763a42cd33797e2f3d634fbf9f /apps/plugins/rockboy
parent0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff)
downloadrockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.tar.gz
rockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.zip
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
Diffstat (limited to 'apps/plugins/rockboy')
-rw-r--r--apps/plugins/rockboy/lcd-gb.h6
-rw-r--r--apps/plugins/rockboy/lcd.c14
-rw-r--r--apps/plugins/rockboy/sys_rockbox.c9
3 files changed, 17 insertions, 12 deletions
diff --git a/apps/plugins/rockboy/lcd-gb.h b/apps/plugins/rockboy/lcd-gb.h
index 36b971a88b..239ccbec74 100644
--- a/apps/plugins/rockboy/lcd-gb.h
+++ b/apps/plugins/rockboy/lcd-gb.h
@@ -3,6 +3,7 @@
3#ifndef __LCD_GB_H__ 3#ifndef __LCD_GB_H__
4#define __LCD_GB_H__ 4#define __LCD_GB_H__
5 5
6#include "lcd.h"
6#include "defs.h" 7#include "defs.h"
7 8
8struct vissprite 9struct vissprite
@@ -23,7 +24,7 @@ struct scan
23#elif LCD_DEPTH > 4 24#elif LCD_DEPTH > 4
24 byte buf[256]; 25 byte buf[256];
25#endif 26#endif
26 un16 pal[64]; 27 fb_data pal[64];
27 byte pri[256]; 28 byte pri[256];
28 struct vissprite vs[16]; 29 struct vissprite vs[16];
29 int ns, l, x, y, s, t, u, v, wx, wy, wt, wv; 30 int ns, l, x, y, s, t, u, v, wx, wy, wt, wv;
@@ -61,6 +62,3 @@ void pal_dirty(void) ICODE_ATTR;
61void lcd_reset(void); 62void lcd_reset(void);
62 63
63#endif 64#endif
64
65
66
diff --git a/apps/plugins/rockboy/lcd.c b/apps/plugins/rockboy/lcd.c
index 2dc983f812..e8d43f772a 100644
--- a/apps/plugins/rockboy/lcd.c
+++ b/apps/plugins/rockboy/lcd.c
@@ -19,7 +19,7 @@ struct scan scan IBSS_ATTR;
19#define BG (scan.bg) 19#define BG (scan.bg)
20#define WND (scan.wnd) 20#define WND (scan.wnd)
21 21
22#if LCD_DEPTH ==16 22#if LCD_DEPTH >= 16
23#define BUF (scan.buf) 23#define BUF (scan.buf)
24#else 24#else
25#define BUF (scan.buf[scanline_ind]) 25#define BUF (scan.buf[scanline_ind])
@@ -1154,6 +1154,7 @@ void set_pal(void)
1154static void updatepalette(int i) 1154static void updatepalette(int i)
1155{ 1155{
1156 int c, r, g, b; 1156 int c, r, g, b;
1157 fb_data px;
1157 1158
1158 c = (lcd.pal[i<<1] | ((int)lcd.pal[(i<<1)|1] << 8)) & 0x7FFF; 1159 c = (lcd.pal[i<<1] | ((int)lcd.pal[(i<<1)|1] << 8)) & 0x7FFF;
1159 r = (c & 0x001F) << 3; 1160 r = (c & 0x001F) << 3;
@@ -1167,18 +1168,16 @@ static void updatepalette(int i)
1167 g = (g >> fb.cc[1].r) << fb.cc[1].l; 1168 g = (g >> fb.cc[1].r) << fb.cc[1].l;
1168 b = (b >> fb.cc[2].r) << fb.cc[2].l; 1169 b = (b >> fb.cc[2].r) << fb.cc[2].l;
1169 1170
1170#if LCD_PIXELFORMAT == RGB565
1171 c = r|g|b; 1171 c = r|g|b;
1172#elif LCD_PIXELFORMAT == RGB565SWAPPED 1172
1173 c = swap16(r|g|b); 1173 px = FB_SCALARPACK_LCD(c);
1174#endif
1175 1174
1176 /* updatepalette might get called, but the pallete does not necessarily 1175 /* updatepalette might get called, but the pallete does not necessarily
1177 * need to be updated. 1176 * need to be updated.
1178 */ 1177 */
1179 if(PAL[i]!=c) 1178 if(memcmp(&PAL[i], &px, sizeof(fb_data)))
1180 { 1179 {
1181 PAL[i] = c; 1180 PAL[i] = px;
1182#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) 1181#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
1183 rb->lcd_pal256_update_pal(PAL); 1182 rb->lcd_pal256_update_pal(PAL);
1184#endif 1183#endif
@@ -1256,4 +1255,3 @@ void lcd_reset(void)
1256 lcd_begin(); 1255 lcd_begin();
1257 vram_dirty(); 1256 vram_dirty();
1258} 1257}
1259
diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c
index 1bf63b7a74..a758f73da3 100644
--- a/apps/plugins/rockboy/sys_rockbox.c
+++ b/apps/plugins/rockboy/sys_rockbox.c
@@ -261,12 +261,21 @@ void vid_init(void)
261 fb.enabled=1; 261 fb.enabled=1;
262 262
263#if defined(HAVE_LCD_COLOR) 263#if defined(HAVE_LCD_COLOR)
264#if LCD_DEPTH == 24
265 fb.cc[0].r = 0; /* 8-8 (wasted bits on red) */
266 fb.cc[0].l = 16; /* this is the offset to the R bits (24-8) */
267 fb.cc[1].r = 0; /* 8-6 (wasted bits on green) */
268 fb.cc[1].l = 8; /* This is the offset to the G bits (24-8-8) */
269 fb.cc[2].r = 0; /* 8-5 (wasted bits on red) */
270 fb.cc[2].l = 0; /* This is the offset to the B bits (24-8-8-8) */
271#else
264 fb.cc[0].r = 3; /* 8-5 (wasted bits on red) */ 272 fb.cc[0].r = 3; /* 8-5 (wasted bits on red) */
265 fb.cc[0].l = 11; /* this is the offset to the R bits (16-5) */ 273 fb.cc[0].l = 11; /* this is the offset to the R bits (16-5) */
266 fb.cc[1].r = 2; /* 8-6 (wasted bits on green) */ 274 fb.cc[1].r = 2; /* 8-6 (wasted bits on green) */
267 fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */ 275 fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */
268 fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */ 276 fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */
269 fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */ 277 fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */
278#endif
270#else 279#else
271 fb.mode=3; 280 fb.mode=3;
272#endif 281#endif