1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2014-06-18 07:15:00 +02:00
parent 0250be1d67
commit a1842c04f9
49 changed files with 1653 additions and 341 deletions

View file

@ -3,6 +3,7 @@
#ifndef __LCD_GB_H__
#define __LCD_GB_H__
#include "lcd.h"
#include "defs.h"
struct vissprite
@ -23,7 +24,7 @@ struct scan
#elif LCD_DEPTH > 4
byte buf[256];
#endif
un16 pal[64];
fb_data pal[64];
byte pri[256];
struct vissprite vs[16];
int ns, l, x, y, s, t, u, v, wx, wy, wt, wv;
@ -61,6 +62,3 @@ void pal_dirty(void) ICODE_ATTR;
void lcd_reset(void);
#endif

View file

@ -19,7 +19,7 @@ struct scan scan IBSS_ATTR;
#define BG (scan.bg)
#define WND (scan.wnd)
#if LCD_DEPTH ==16
#if LCD_DEPTH >= 16
#define BUF (scan.buf)
#else
#define BUF (scan.buf[scanline_ind])
@ -1154,6 +1154,7 @@ void set_pal(void)
static void updatepalette(int i)
{
int c, r, g, b;
fb_data px;
c = (lcd.pal[i<<1] | ((int)lcd.pal[(i<<1)|1] << 8)) & 0x7FFF;
r = (c & 0x001F) << 3;
@ -1167,18 +1168,16 @@ static void updatepalette(int i)
g = (g >> fb.cc[1].r) << fb.cc[1].l;
b = (b >> fb.cc[2].r) << fb.cc[2].l;
#if LCD_PIXELFORMAT == RGB565
c = r|g|b;
#elif LCD_PIXELFORMAT == RGB565SWAPPED
c = swap16(r|g|b);
#endif
px = FB_SCALARPACK_LCD(c);
/* updatepalette might get called, but the pallete does not necessarily
* need to be updated.
*/
if(PAL[i]!=c)
if(memcmp(&PAL[i], &px, sizeof(fb_data)))
{
PAL[i] = c;
PAL[i] = px;
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
rb->lcd_pal256_update_pal(PAL);
#endif
@ -1256,4 +1255,3 @@ void lcd_reset(void)
lcd_begin();
vram_dirty();
}

View file

@ -261,12 +261,21 @@ void vid_init(void)
fb.enabled=1;
#if defined(HAVE_LCD_COLOR)
#if LCD_DEPTH == 24
fb.cc[0].r = 0; /* 8-8 (wasted bits on red) */
fb.cc[0].l = 16; /* this is the offset to the R bits (24-8) */
fb.cc[1].r = 0; /* 8-6 (wasted bits on green) */
fb.cc[1].l = 8; /* This is the offset to the G bits (24-8-8) */
fb.cc[2].r = 0; /* 8-5 (wasted bits on red) */
fb.cc[2].l = 0; /* This is the offset to the B bits (24-8-8-8) */
#else
fb.cc[0].r = 3; /* 8-5 (wasted bits on red) */
fb.cc[0].l = 11; /* this is the offset to the R bits (16-5) */
fb.cc[1].r = 2; /* 8-6 (wasted bits on green) */
fb.cc[1].l = 5; /* This is the offset to the G bits (16-5-6) */
fb.cc[2].r = 3; /* 8-5 (wasted bits on red) */
fb.cc[2].l = 0; /* This is the offset to the B bits (16-5-6-5) */
#endif
#else
fb.mode=3;
#endif