Commit 57d76a89b0f0afc1bb622c5c0b8d10dfd34f28b5

Authored by Hannes Petermaier
Committed by Anatolij Gustschin
1 parent 6d1966e123

Add support for 32-bit organized framebuffers

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

Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
Cc: agust@denx.de

Showing 2 changed files with 48 additions and 4 deletions Side-by-side Diff

... ... @@ -100,7 +100,8 @@
100 100 #if LCD_BPP == LCD_MONOCHROME
101 101 # define COLOR_MASK(c) ((c) | (c) << 1 | (c) << 2 | (c) << 3 | \
102 102 (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
103   -#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
  103 +#elif (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16) || \
  104 + (LCD_BPP == LCD_COLOR32)
104 105 # define COLOR_MASK(c) (c)
105 106 #else
106 107 # error Unsupported LCD BPP.
107 108  
... ... @@ -177,10 +178,20 @@
177 178 CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows);
178 179  
179 180 /* Clear the last rows */
  181 +#if (LCD_BPP != LCD_COLOR32)
180 182 memset(lcd_console_address + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows,
181 183 COLOR_MASK(lcd_color_bg),
182 184 CONSOLE_ROW_SIZE * rows);
183   -
  185 +#else
  186 + u32 *ppix = lcd_console_address +
  187 + CONSOLE_SIZE - CONSOLE_ROW_SIZE * rows;
  188 + u32 i;
  189 + for (i = 0;
  190 + i < (CONSOLE_ROW_SIZE * rows) / NBYTES(panel_info.vl_bpix);
  191 + i++) {
  192 + *ppix++ = COLOR_MASK(lcd_color_bg);
  193 + }
  194 +#endif
184 195 lcd_sync();
185 196 console_row -= rows;
186 197 }
187 198  
... ... @@ -308,13 +319,15 @@
308 319 ushort off = x * (1 << LCD_BPP) % 8;
309 320 #endif
310 321  
311   - dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
  322 + dest = (uchar *)(lcd_base + y * lcd_line_length + x * NBITS(LCD_BPP)/8);
312 323  
313 324 for (row = 0; row < VIDEO_FONT_HEIGHT; ++row, dest += lcd_line_length) {
314 325 uchar *s = str;
315 326 int i;
316 327 #if LCD_BPP == LCD_COLOR16
317 328 ushort *d = (ushort *)dest;
  329 +#elif LCD_BPP == LCD_COLOR32
  330 + u32 *d = (u32 *)dest;
318 331 #else
319 332 uchar *d = dest;
320 333 #endif
... ... @@ -347,6 +360,12 @@
347 360 lcd_color_fg : lcd_color_bg;
348 361 bits <<= 1;
349 362 }
  363 +#elif LCD_BPP == LCD_COLOR32
  364 + for (c = 0; c < 8; ++c) {
  365 + *d++ = (bits & 0x80) ?
  366 + lcd_color_fg : lcd_color_bg;
  367 + bits <<= 1;
  368 + }
350 369 #endif
351 370 }
352 371 #if LCD_BPP == LCD_MONOCHROME
353 372  
... ... @@ -476,9 +495,19 @@
476 495 test_pattern();
477 496 #else
478 497 /* set framebuffer to background color */
  498 +#if (LCD_BPP != LCD_COLOR32)
479 499 memset((char *)lcd_base,
480 500 COLOR_MASK(lcd_getbgcolor()),
481 501 lcd_line_length * panel_info.vl_row);
  502 +#else
  503 + u32 *ppix = lcd_base;
  504 + u32 i;
  505 + for (i = 0;
  506 + i < (lcd_line_length * panel_info.vl_row)/NBYTES(panel_info.vl_bpix);
  507 + i++) {
  508 + *ppix++ = COLOR_MASK(lcd_color_bg);
  509 + }
  510 +#endif
482 511 #endif
483 512 /* Paint the logo and retrieve LCD base address */
484 513 debug("[LCD] Drawing the logo...\n");
... ... @@ -333,7 +333,7 @@
333 333 #define LCD_COLOR4 2
334 334 #define LCD_COLOR8 3
335 335 #define LCD_COLOR16 4
336   -
  336 +#define LCD_COLOR32 5
337 337 /*----------------------------------------------------------------------*/
338 338 #if defined(CONFIG_LCD_INFO_BELOW_LOGO)
339 339 # define LCD_INFO_X 0
... ... @@ -383,6 +383,21 @@
383 383 # define CONSOLE_COLOR_CYAN 6
384 384 # define CONSOLE_COLOR_GREY 14
385 385 # define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
  386 +
  387 +#elif LCD_BPP == LCD_COLOR32
  388 +/*
  389 + * 32bpp color definitions
  390 + */
  391 +# define CONSOLE_COLOR_RED 0x00ff0000
  392 +# define CONSOLE_COLOR_GREEN 0x0000ff00
  393 +# define CONSOLE_COLOR_YELLOW 0x00ffff00
  394 +# define CONSOLE_COLOR_BLUE 0x000000ff
  395 +# define CONSOLE_COLOR_MAGENTA 0x00ff00ff
  396 +# define CONSOLE_COLOR_CYAN 0x0000ffff
  397 +# define CONSOLE_COLOR_GREY 0x00aaaaaa
  398 +# define CONSOLE_COLOR_BLACK 0x00000000
  399 +# define CONSOLE_COLOR_WHITE 0x00ffffff /* Must remain last / highest*/
  400 +# define NBYTES(bit_code) (NBITS(bit_code) >> 3)
386 401  
387 402 #else
388 403