]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'tx6-update-2016-02-03' into karo-tx6
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 18 Feb 2016 17:37:33 +0000 (18:37 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 18 Feb 2016 17:37:33 +0000 (18:37 +0100)
board/karo/tx28/tx28.c
board/karo/tx48/tx48.c
board/karo/tx51/tx51.c
board/karo/tx53/tx53.c
board/karo/tx6/tx6qdl.c
board/karo/tx6/tx6ul.c
common/lcd.c

index f9cb02df21fb87b98fb53daf73ab4380b10c46a4..b8086a02e15ea203549b9a6c011de0855334afa1 100644 (file)
@@ -402,14 +402,12 @@ static const struct gpio stk5_gpios[] = {
 };
 
 #ifdef CONFIG_LCD
-static ushort tx28_cmap[256];
 vidinfo_t panel_info = {
        /* set to max. size supported by SoC */
        .vl_col = 1600,
        .vl_row = 1200,
 
        .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
-       .cmap = tx28_cmap,
 };
 
 static struct fb_videomode tx28_fb_modes[] = {
index e89dda8cc29092c92b51d6c034b33fe9fc0c2d0b..7383738a249121f4a5812b5c04fdf244512d5fc1 100644 (file)
@@ -162,14 +162,12 @@ static const struct gpio stk5v5_gpios[] = {
 };
 
 #ifdef CONFIG_LCD
-static u16 tx48_cmap[256];
 vidinfo_t panel_info = {
        /* set to max. size supported by SoC */
        .vl_col = 1366,
        .vl_row = 768,
 
        .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
-       .cmap = tx48_cmap,
 };
 
 static struct lcd_ctrl_config lcd_cfg = {
index 586663cb0e23689e3d6cda70a4f698f948ab02df..00f82621b30915f38686c0ca5ebcc74b20a85c70 100644 (file)
@@ -548,14 +548,12 @@ static const struct gpio stk5_gpios[] = {
 };
 
 #ifdef CONFIG_LCD
-static u16 tx51_cmap[256];
 vidinfo_t panel_info = {
        /* set to max. size supported by SoC */
        .vl_col = 1600,
        .vl_row = 1200,
 
        .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
-       .cmap = tx51_cmap,
 };
 
 static struct fb_videomode tx51_fb_modes[] = {
index 082d2bdd761f046acddbb5a1a3e45cca4da07298..11b071eb33d4f421594d2f24b64ea537a48b776f 100644 (file)
@@ -762,14 +762,12 @@ static const struct gpio stk5_gpios[] = {
 };
 
 #ifdef CONFIG_LCD
-static u16 tx53_cmap[256];
 vidinfo_t panel_info = {
        /* set to max. size supported by SoC */
        .vl_col = 1600,
        .vl_row = 1200,
 
        .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
-       .cmap = tx53_cmap,
 };
 
 static struct fb_videomode tx53_fb_modes[] = {
index f0076e6ccdeee20342e6c73112534ec5077ab2e6..a232461e077b260811e8f5c0172cafe7f60c243f 100644 (file)
@@ -803,14 +803,12 @@ static const struct gpio stk5_gpios[] = {
 };
 
 #ifdef CONFIG_LCD
-static u16 tx6_cmap[256];
 vidinfo_t panel_info = {
        /* set to max. size supported by SoC */
        .vl_col = 1920,
        .vl_row = 1080,
 
        .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
-       .cmap = tx6_cmap,
 };
 
 static struct fb_videomode tx6_fb_modes[] = {
index b216b112598a6078c9918cee984a676c72391f05..b8ff2c8f4f748bc787d438678507f91a8800703d 100644 (file)
@@ -716,14 +716,12 @@ static const struct gpio stk5_gpios[] = {
 };
 
 #ifdef CONFIG_LCD
-static u16 tx6_cmap[256];
 vidinfo_t panel_info = {
        /* set to max. size supported by SoC */
        .vl_col = 4096,
        .vl_row = 1024,
 
        .vl_bpix = LCD_COLOR32,    /* Bits per pixel, 0: 1bpp, 1: 2bpp, 2: 4bpp, 3: 8bpp ... */
-       .cmap = tx6_cmap,
 };
 
 static struct fb_videomode tx6_fb_modes[] = {
index 23c502106cba1cea78c9feb156c84741350ec4fc..eb37ecd185551de79f1249f177a2a7bb53224f00 100644 (file)
@@ -418,17 +418,18 @@ static inline void lcd_logo_plot(int x, int y) {}
 static void splash_align_axis(int *axis, unsigned long panel_size,
                                        unsigned long picture_size)
 {
-       unsigned long panel_picture_delta = panel_size - picture_size;
-       unsigned long axis_alignment;
+       int panel_picture_delta = panel_size - picture_size;
+       int axis_alignment;
 
        if (*axis == BMP_ALIGN_CENTER)
                axis_alignment = panel_picture_delta / 2;
+       else if (abs(*axis) > (int)panel_size)
+               axis_alignment = panel_size;
        else if (*axis < 0)
                axis_alignment = panel_picture_delta + *axis + 1;
        else
                return;
-
-       *axis = max(0, (int)axis_alignment);
+       *axis = axis_alignment;
 }
 #endif
 
@@ -621,7 +622,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
        hdr_size = get_unaligned_le16(&bmp->header.size);
        debug("hdr_size=%d, bmp_bpix=%d\n", hdr_size, bmp_bpix);
 
-       colors = 1 << bmp_bpix;
+       colors = 1ULL << bmp_bpix;
 
        bpix = NBITS(panel_info.vl_bpix);
 
@@ -636,16 +637,14 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
         * We support displaying 8bpp BMPs on 16bpp LCDs
         * and displaying 24bpp BMPs on 32bpp LCDs
         * */
-       if (bpix != bmp_bpix &&
-           !(bmp_bpix == 8 && bpix == 16) &&
-           !(bmp_bpix == 24 && bpix == 32)) {
+       if (bpix < bmp_bpix) {
                printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
                        bpix, get_unaligned_le16(&bmp->header.bit_count));
                return 1;
        }
 
-       debug("Display-bmp: %lu x %lu  with %llu colors, display %d\n",
-               width, height, colors, NBITS(bmp_bpix));
+       debug("Display-bmp: %lu x %lu  with %llu colors, display %llu\n",
+               width, height, colors, 1ULL << bpix);
 
        if (bmp_bpix == 8)
                lcd_set_cmap(bmp, colors);
@@ -658,11 +657,21 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
        bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 
-       if ((x + width) > pwidth)
+       if (x < 0) {
+               width += x;
+               bmap += -x * bmp_bpix / 8;
+               x = 0;
+       }
+       if ((x + width) > pwidth) {
                width = pwidth - x;
+       }
+       if (y < 0) {
+               height += y;
+               y = 0;
+       }
        if ((y + height) > panel_info.vl_row) {
+               bmap += (y + height - panel_info.vl_row) * bmp_bpix / 8 * padded_width;
                height = panel_info.vl_row - y;
-               bmap += (panel_info.vl_row - y) * padded_width;
        }
 
        fb   = (uchar *)(lcd_base +
@@ -689,9 +698,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                for (i = 0; i < height; ++i) {
                        WATCHDOG_RESET();
                        for (j = 0; j < width; j++) {
-                               if (bpix != 16) {
+                               if (bpix == 8) {
                                        fb_put_byte(&fb, &bmap);
-                               } else {
+                               } else if (bpix == 16) {
                                        struct bmp_color_table_entry *entry;
                                        uint val;
 
@@ -704,17 +713,27 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                                                        entry->red >> 3 << 11;
                                        }
                                        *(uint16_t *)fb = val;
-                                       bmap++;
                                        fb += sizeof(uint16_t) / sizeof(*fb);
+                               } else if (bpix == 32) {
+                                       uint32_t *fb32 = (uint32_t *)fb;
+                                       struct bmp_color_table_entry *entry;
+                                       uint val;
+
+                                       if (cmap_base) {
+                                               val = cmap_base[*bmap];
+                                       } else {
+                                               entry = &palette[*bmap];
+                                               val = entry->blue |
+                                                       entry->green << 8 |
+                                                       entry->red << 16;
+                                       }
+                                       *fb32 = val;
+                                       fb += sizeof(uint32_t) / sizeof(*fb);
                                }
+                               bmap++;
                        }
-                       if (bpix > 8) {
-                               bmap += padded_width - width;
-                               fb   -= width * bpix / 8 + lcd_line_length;
-                       } else {
-                               bmap += padded_width;
-                               fb -= lcd_line_length;
-                       }
+                       bmap += padded_width - width;
+                       fb   -= width * bpix / 8 + lcd_line_length;
                }
                break;
        }
@@ -730,7 +749,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                }
                break;
 #endif /* CONFIG_BMP_16BPP */
-#if defined(CONFIG_BMP_24BMP)
+#if defined(CONFIG_BMP_24BPP)
        case 24:
                for (i = 0; i < height; ++i) {
                        for (j = 0; j < width; j++) {
@@ -739,6 +758,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                                *(fb++) = *(bmap++);
                                *(fb++) = 0;
                        }
+                       bmap += (padded_width - width) * 3;
                        fb -= lcd_line_length + width * (bpix / 8);
                }
                break;
@@ -759,6 +779,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
                }
                break;
 #endif /* CONFIG_BMP_32BPP */
+       default:
+               printf("Logo with %ubpp on %ubpp display not supported\n",
+                       bmp_bpix, bpix);
        };
 
        lcd_sync();