Skip to content
Snippets Groups Projects
Commit 57d76a89 authored by Hannes Petermaier's avatar Hannes Petermaier Committed by Anatolij Gustschin
Browse files

Add support for 32-bit organized framebuffers


- Adds support for 32-bit organized framebuffers to the LCD-framework.

Signed-off-by: default avatarHannes Petermaier <oe5hpm@oevsv.at>
Cc: agust@denx.de
parent 6d1966e1
No related branches found
No related tags found
No related merge requests found
...@@ -100,7 +100,8 @@ ...@@ -100,7 +100,8 @@
#if LCD_BPP == LCD_MONOCHROME #if LCD_BPP == LCD_MONOCHROME
# define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \ # define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \
(c) << 4 | (c) << 5 | (c) << 6 | (c) << 7) (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) #elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || \
(LCD_BPP == LCD_COLOR32)
# define COLOR_MASK(c) (c) # define COLOR_MASK(c) (c)
#else #else
# error Unsupported LCD BPP. # error Unsupported LCD BPP.
...@@ -177,10 +178,20 @@ static void console_scrollup(void) ...@@ -177,10 +178,20 @@ static void console_scrollup(void)
CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows); CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
/* Clear the last rows */ /* Clear the last rows */
#if (LCD_BPP != LCD_COLOR32)
memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows, memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
COLOR_MASK(lcd_color_bg), COLOR_MASK(lcd_color_bg),
CONSOLE_ROW_SIZE * rows); CONSOLE_ROW_SIZE * rows);
#else
u32 *ppix = lcd_console_address +
CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
u32 i;
for (i = 0;
i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
i++) {
*ppix++ = COLOR_MASK(lcd_color_bg);
}
#endif
lcd_sync(); lcd_sync();
console_row -= rows; console_row -= rows;
} }
...@@ -308,13 +319,15 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count) ...@@ -308,13 +319,15 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
ushort off = x * (1 << LCD_BPP) % 8; ushort off = x * (1 << LCD_BPP) % 8;
#endif #endif
dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8); dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) { for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
uchar *s = str; uchar *s = str;
int i; int i;
#if LCD_BPP == LCD_COLOR16 #if LCD_BPP == LCD_COLOR16
ushort *d = (ushort *)dest; ushort *d = (ushort *)dest;
#elif LCD_BPP == LCD_COLOR32
u32 *d = (u32 *)dest;
#else #else
uchar *d = dest; uchar *d = dest;
#endif #endif
...@@ -347,6 +360,12 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count) ...@@ -347,6 +360,12 @@ static void lcd_drawchars(ushort x, ushort y, uchar *str, int count)
lcd_color_fg : lcd_color_bg; lcd_color_fg : lcd_color_bg;
bits <<= 1; bits <<= 1;
} }
#elif LCD_BPP == LCD_COLOR32
for (c = 0; c < 8; ++c) {
*d++ = (bits & 0x80) ?
lcd_color_fg : lcd_color_bg;
bits <<= 1;
}
#endif #endif
} }
#if LCD_BPP == LCD_MONOCHROME #if LCD_BPP == LCD_MONOCHROME
...@@ -476,9 +495,19 @@ void lcd_clear(void) ...@@ -476,9 +495,19 @@ void lcd_clear(void)
test_pattern(); test_pattern();
#else #else
/* set framebuffer to background color */ /* set framebuffer to background color */
#if (LCD_BPP != LCD_COLOR32)
memset((char *)lcd_base, memset((char *)lcd_base,
COLOR_MASK(lcd_getbgcolor()), COLOR_MASK(lcd_getbgcolor()),
lcd_line_length * panel_info.vl_row); lcd_line_length * panel_info.vl_row);
#else
u32 *ppix = lcd_base;
u32 i;
for (i = 0;
i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
i++) {
*ppix++ = COLOR_MASK(lcd_color_bg);
}
#endif
#endif #endif
/* Paint the logo and retrieve LCD base address */ /* Paint the logo and retrieve LCD base address */
debug("[LCD] Drawing the logo...\n"); debug("[LCD] Drawing the logo...\n");
......
...@@ -333,7 +333,7 @@ void lcd_sync(void); ...@@ -333,7 +333,7 @@ void lcd_sync(void);
#define LCD_COLOR4 2 #define LCD_COLOR4 2
#define LCD_COLOR8 3 #define LCD_COLOR8 3
#define LCD_COLOR16 4 #define LCD_COLOR16 4
#define LCD_COLOR32 5
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
#if defined(CONFIG_LCD_INFO_BELOW_LOGO) #if defined(CONFIG_LCD_INFO_BELOW_LOGO)
# define LCD_INFO_X 0 # define LCD_INFO_X 0
...@@ -384,6 +384,21 @@ void lcd_sync(void); ...@@ -384,6 +384,21 @@ void lcd_sync(void);
# define CONSOLE_COLOR_GREY 14 # define CONSOLE_COLOR_GREY 14
# define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */ # define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
#elif LCD_BPP == LCD_COLOR32
/*
* 32bpp color definitions
*/
# define CONSOLE_COLOR_RED 0x00ff0000
# define CONSOLE_COLOR_GREEN 0x0000ff00
# define CONSOLE_COLOR_YELLOW 0x00ffff00
# define CONSOLE_COLOR_BLUE 0x000000ff
# define CONSOLE_COLOR_MAGENTA 0x00ff00ff
# define CONSOLE_COLOR_CYAN 0x0000ffff
# define CONSOLE_COLOR_GREY 0x00aaaaaa
# define CONSOLE_COLOR_BLACK 0x00000000
# define CONSOLE_COLOR_WHITE 0x00ffffff /* Must remain last / highest*/
# define NBYTES(bit_code) (NBITS(bit_code) >> 3)
#else #else
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment