Commit a303dfb0e9a93e516ea9427b5c09543d5f74ade1

Authored by Mark Jackson
Committed by Anatolij Gustschin
1 parent 689551c5ff

Add 16bpp BMP support

This patch adds 16bpp BMP support to the common lcd code.

Use CONFIG_BMP_16BPP and set LCD_BPP to LCD_COLOR16 to enable the code.

At the moment it's only been tested on the MIMC200 AVR32 board, but extending
this to other platforms should be a simple task !!

Signed-off-by: Mark Jackson <mpfj@mimc.co.uk>
Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
Acked-by: Anatolij Gustschin <agust@denx.de>

Showing 1 changed file with 41 additions and 10 deletions Side-by-side Diff

... ... @@ -84,7 +84,7 @@
84 84 static void *lcd_logo (void);
85 85  
86 86  
87   -#if LCD_BPP == LCD_COLOR8
  87 +#if (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
88 88 extern void lcd_setcolreg (ushort regno,
89 89 ushort red, ushort green, ushort blue);
90 90 #endif
... ... @@ -656,7 +656,7 @@
656 656  
657 657 bpix = NBITS(panel_info.vl_bpix);
658 658  
659   - if ((bpix != 1) && (bpix != 8)) {
  659 + if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
660 660 printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
661 661 bpix);
662 662 return 1;
663 663  
664 664  
665 665  
... ... @@ -738,17 +738,48 @@
738 738 bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
739 739 fb = (uchar *) (lcd_base +
740 740 (y + height - 1) * lcd_line_length + x);
741   - for (i = 0; i < height; ++i) {
742   - WATCHDOG_RESET();
743   - for (j = 0; j < width ; j++)
  741 +
  742 + switch (bpix) {
  743 + case 1: /* pass through */
  744 + case 8:
  745 + for (i = 0; i < height; ++i) {
  746 + WATCHDOG_RESET();
  747 + for (j = 0; j < width ; j++)
744 748 #if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
745   - *(fb++) = *(bmap++);
  749 + *(fb++) = *(bmap++);
746 750 #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
747   - *(fb++)=255-*(bmap++);
  751 + *(fb++)=255-*(bmap++);
748 752 #endif
749   - bmap += (width - padded_line);
750   - fb -= (width + lcd_line_length);
751   - }
  753 + bmap += (width - padded_line);
  754 + fb -= (width + lcd_line_length);
  755 + }
  756 + break;
  757 +
  758 +#if defined(CONFIG_BMP_16BPP)
  759 + case 16:
  760 + for (i = 0; i < height; ++i) {
  761 + WATCHDOG_RESET();
  762 + for (j = 0; j < width; j++) {
  763 +#if defined(CONFIG_ATMEL_LCD_BGR555)
  764 + *(fb++) = ((bmap[0] & 0x1f) << 2) |
  765 + (bmap[1] & 0x03);
  766 + *(fb++) = (bmap[0] & 0xe0) |
  767 + ((bmap[1] & 0x7c) >> 2);
  768 + bmap += 2;
  769 +#else
  770 + *(fb++) = *(bmap++);
  771 + *(fb++) = *(bmap++);
  772 +#endif
  773 + }
  774 + bmap += (padded_line - width) * 2;
  775 + fb -= (width * 2 + lcd_line_length);
  776 + }
  777 + break;
  778 +#endif /* CONFIG_BMP_16BPP */
  779 +
  780 + default:
  781 + break;
  782 + };
752 783  
753 784 return (0);
754 785 }