Skip to content
Snippets Groups Projects
Commit b3873d3f authored by Tom Rini's avatar Tom Rini
Browse files

Merge branch 'master' of git://git.denx.de/u-boot-video

parents 5cf41dcc d23019f3
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <common.h> #include <common.h>
#include <lcd.h> #include <lcd.h>
#include <mpc5xxx.h> #include <mpc5xxx.h>
#include <malloc.h>
#ifdef CONFIG_LCD #ifdef CONFIG_LCD
...@@ -210,4 +211,23 @@ void show_progress (int size, int tot) ...@@ -210,4 +211,23 @@ void show_progress (int size, int tot)
} }
#endif #endif
int bmp_display(ulong addr, int x, int y)
{
int ret;
bmp_image_t *bmp = (bmp_image_t *)addr;
if (!bmp) {
printf("There is no valid bmp file at the given address\n");
return 1;
}
ret = lcd_display_bitmap((ulong)bmp, x, y);
if ((unsigned long)bmp != addr)
free(bmp);
return ret;
}
#endif /* CONFIG_LCD */ #endif /* CONFIG_LCD */
...@@ -498,23 +498,43 @@ static int lcd_getbgcolor(void) ...@@ -498,23 +498,43 @@ static int lcd_getbgcolor(void)
/************************************************************************/ /************************************************************************/
/* ** Chipset depending Bitmap / Logo stuff... */ /* ** Chipset depending Bitmap / Logo stuff... */
/************************************************************************/ /************************************************************************/
static inline ushort *configuration_get_cmap(void)
{
#if defined CONFIG_CPU_PXA
struct pxafb_info *fbi = &panel_info.pxa;
return (ushort *)fbi->palette;
#elif defined(CONFIG_MPC823)
immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
cpm8xx_t *cp = &(immr->im_cpm);
return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]);
#elif defined(CONFIG_ATMEL_LCD)
return (ushort *)(panel_info.mmio + ATMEL_LCDC_LUT(0));
#elif !defined(CONFIG_ATMEL_HLCD) && !defined(CONFIG_EXYNOS_FB)
return panel_info.cmap;
#else
#if defined(CONFIG_LCD_LOGO)
return bmp_logo_palette;
#else
return NULL;
#endif
#endif
}
#ifdef CONFIG_LCD_LOGO #ifdef CONFIG_LCD_LOGO
void bitmap_plot(int x, int y) void bitmap_plot(int x, int y)
{ {
#ifdef CONFIG_ATMEL_LCD #ifdef CONFIG_ATMEL_LCD
uint *cmap; uint *cmap = (uint *)bmp_logo_palette;
#else #else
ushort *cmap; ushort *cmap = (ushort *)bmp_logo_palette;
#endif #endif
ushort i, j; ushort i, j;
uchar *bmap; uchar *bmap;
uchar *fb; uchar *fb;
ushort *fb16; ushort *fb16;
#if defined(CONFIG_CPU_PXA) #if defined(CONFIG_MPC823)
struct pxafb_info *fbi = &panel_info.pxa; immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
#elif defined(CONFIG_MPC823) cpm8xx_t *cp = &(immr->im_cpm);
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
volatile cpm8xx_t *cp = &(immr->im_cpm);
#endif #endif
debug("Logo: width %d height %d colors %d cmap %d\n", debug("Logo: width %d height %d colors %d cmap %d\n",
...@@ -525,20 +545,17 @@ void bitmap_plot(int x, int y) ...@@ -525,20 +545,17 @@ void bitmap_plot(int x, int y)
fb = (uchar *)(lcd_base + y * lcd_line_length + x); fb = (uchar *)(lcd_base + y * lcd_line_length + x);
if (NBITS(panel_info.vl_bpix) < 12) { if (NBITS(panel_info.vl_bpix) < 12) {
/* Leave room for default color map */ /* Leave room for default color map
#if defined(CONFIG_CPU_PXA) * default case: generic system with no cmap (most likely 16bpp)
cmap = (ushort *) fbi->palette; * cmap was set to the source palette, so no change is done.
#elif defined(CONFIG_MPC823) * This avoids even more ifdefs in the next stanza
*/
#if defined(CONFIG_MPC823)
cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]); cmap = (ushort *) &(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]);
#elif defined(CONFIG_ATMEL_LCD) #elif defined(CONFIG_ATMEL_LCD)
cmap = (uint *) (panel_info.mmio + ATMEL_LCDC_LUT(0)); cmap = (uint *)configuration_get_cmap();
#else #else
/* cmap = configuration_get_cmap();
* default case: generic system with no cmap (most likely 16bpp)
* We set cmap to the source palette, so no change is done.
* This avoids even more ifdef in the next stanza
*/
cmap = bmp_logo_palette;
#endif #endif
WATCHDOG_RESET(); WATCHDOG_RESET();
...@@ -607,7 +624,46 @@ static inline void bitmap_plot(int x, int y) {} ...@@ -607,7 +624,46 @@ static inline void bitmap_plot(int x, int y) {}
#ifdef CONFIG_SPLASH_SCREEN_ALIGN #ifdef CONFIG_SPLASH_SCREEN_ALIGN
#define BMP_ALIGN_CENTER 0x7FFF #define BMP_ALIGN_CENTER 0x7FFF
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;
if (*axis == BMP_ALIGN_CENTER)
axis_alignment = panel_picture_delta / 2;
else if (*axis < 0)
axis_alignment = panel_picture_delta + *axis + 1;
else
return;
*axis = max(0, axis_alignment);
}
#endif
#if defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
#define FB_PUT_BYTE(fb, from) *(fb)++ = (255 - *(from)++)
#else
#define FB_PUT_BYTE(fb, from) *(fb)++ = *(from)++
#endif
#if defined(CONFIG_BMP_16BPP)
#if defined(CONFIG_ATMEL_LCD_BGR555)
static inline void fb_put_word(uchar **fb, uchar **from)
{
*(*fb)++ = (((*from)[0] & 0x1f) << 2) | ((*from)[1] & 0x03);
*(*fb)++ = ((*from)[0] & 0xe0) | (((*from)[1] & 0x7c) >> 2);
*from += 2;
}
#else
static inline void fb_put_word(uchar **fb, uchar **from)
{
*(*fb)++ = *(*from)++;
*(*fb)++ = *(*from)++;
}
#endif #endif
#endif /* CONFIG_BMP_16BPP */
int lcd_display_bitmap(ulong bmp_image, int x, int y) int lcd_display_bitmap(ulong bmp_image, int x, int y)
{ {
...@@ -623,14 +679,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ...@@ -623,14 +679,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
unsigned long width, height, byte_width; unsigned long width, height, byte_width;
unsigned long pwidth = panel_info.vl_col; unsigned long pwidth = panel_info.vl_col;
unsigned colors, bpix, bmp_bpix; unsigned colors, bpix, bmp_bpix;
#if defined(CONFIG_CPU_PXA)
struct pxafb_info *fbi = &panel_info.pxa;
#elif defined(CONFIG_MPC823)
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
volatile cpm8xx_t *cp = &(immr->im_cpm);
#endif
if (!((bmp->header.signature[0] == 'B') && if (!bmp || !((bmp->header.signature[0] == 'B') &&
(bmp->header.signature[1] == 'M'))) { (bmp->header.signature[1] == 'M'))) {
printf("Error: no valid bmp image at %lx\n", bmp_image); printf("Error: no valid bmp image at %lx\n", bmp_image);
...@@ -666,14 +716,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ...@@ -666,14 +716,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
#if !defined(CONFIG_MCC200) #if !defined(CONFIG_MCC200)
/* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */ /* MCC200 LCD doesn't need CMAP, supports 1bpp b&w only */
if (bmp_bpix == 8) { if (bmp_bpix == 8) {
#if defined(CONFIG_CPU_PXA) cmap = configuration_get_cmap();
cmap = (ushort *)fbi->palette;
#elif defined(CONFIG_MPC823)
cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
#elif !defined(CONFIG_ATMEL_LCD) && !defined(CONFIG_EXYNOS_FB)
cmap = panel_info.cmap;
#endif
cmap_base = cmap; cmap_base = cmap;
/* Set color map */ /* Set color map */
...@@ -722,15 +765,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ...@@ -722,15 +765,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
padded_line = (width&0x3) ? ((width&~0x3)+4) : (width); padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
#ifdef CONFIG_SPLASH_SCREEN_ALIGN #ifdef CONFIG_SPLASH_SCREEN_ALIGN
if (x == BMP_ALIGN_CENTER) splash_align_axis(&x, pwidth, width);
x = max(0, (pwidth - width) / 2); splash_align_axis(&y, panel_info.vl_row, height);
else if (x < 0)
x = max(0, pwidth - width + x + 1);
if (y == BMP_ALIGN_CENTER)
y = max(0, (panel_info.vl_row - height) / 2);
else if (y < 0)
y = max(0, panel_info.vl_row - height + y + 1);
#endif /* CONFIG_SPLASH_SCREEN_ALIGN */ #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
if ((x + width) > pwidth) if ((x + width) > pwidth)
...@@ -754,11 +790,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ...@@ -754,11 +790,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
WATCHDOG_RESET(); WATCHDOG_RESET();
for (j = 0; j < width; j++) { for (j = 0; j < width; j++) {
if (bpix != 16) { if (bpix != 16) {
#if defined(CONFIG_CPU_PXA) || defined(CONFIG_ATMEL_LCD) FB_PUT_BYTE(fb, bmap);
*(fb++) = *(bmap++);
#elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
*(fb++) = 255 - *(bmap++);
#endif
} else { } else {
*(uint16_t *)fb = cmap_base[*(bmap++)]; *(uint16_t *)fb = cmap_base[*(bmap++)];
fb += sizeof(uint16_t) / sizeof(*fb); fb += sizeof(uint16_t) / sizeof(*fb);
...@@ -773,18 +805,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) ...@@ -773,18 +805,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
case 16: case 16:
for (i = 0; i < height; ++i) { for (i = 0; i < height; ++i) {
WATCHDOG_RESET(); WATCHDOG_RESET();
for (j = 0; j < width; j++) { for (j = 0; j < width; j++)
#if defined(CONFIG_ATMEL_LCD_BGR555) fb_put_word(&fb, &bmap);
*(fb++) = ((bmap[0] & 0x1f) << 2) |
(bmap[1] & 0x03);
*(fb++) = (bmap[0] & 0xe0) |
((bmap[1] & 0x7c) >> 2);
bmap += 2;
#else
*(fb++) = *(bmap++);
*(fb++) = *(bmap++);
#endif
}
bmap += (padded_line - width) * 2; bmap += (padded_line - width) * 2;
fb -= (width * 2 + lcd_line_length); fb -= (width * 2 + lcd_line_length);
} }
...@@ -842,17 +865,7 @@ static void *lcd_logo(void) ...@@ -842,17 +865,7 @@ static void *lcd_logo(void)
} }
#endif /* CONFIG_SPLASH_SCREEN_ALIGN */ #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
#ifdef CONFIG_VIDEO_BMP_GZIP if (bmp_display(addr, x, y) == 0)
bmp_image_t *bmp = (bmp_image_t *)addr;
unsigned long len;
if (!((bmp->header.signature[0] == 'B') &&
(bmp->header.signature[1] == 'M'))) {
addr = (ulong)gunzip_bmp(addr, &len);
}
#endif
if (lcd_display_bitmap(addr, x, y) == 0)
return (void *)lcd_base; return (void *)lcd_base;
} }
#endif /* CONFIG_SPLASH_SCREEN */ #endif /* CONFIG_SPLASH_SCREEN */
......
...@@ -271,7 +271,6 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix) ...@@ -271,7 +271,6 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix)
struct diu *hw = (struct diu *)CONFIG_SYS_DIU_ADDR; struct diu *hw = (struct diu *)CONFIG_SYS_DIU_ADDR;
u8 *gamma_table_base; u8 *gamma_table_base;
unsigned int i, j; unsigned int i, j;
struct diu_ad *dummy_ad;
struct diu_addr gamma; struct diu_addr gamma;
struct diu_addr cursor; struct diu_addr cursor;
...@@ -302,14 +301,6 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix) ...@@ -302,14 +301,6 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix)
return -1; return -1;
} }
/* The AD struct for the dummy framebuffer and the FB itself */
dummy_ad = allocate_fb(2, 4, 4, NULL);
if (!dummy_ad) {
printf("DIU: Out of memory\n");
return -1;
}
dummy_ad->pix_fmt = 0x88883316;
/* read mode info */ /* read mode info */
info.var.xres = fsl_diu_mode_db->xres; info.var.xres = fsl_diu_mode_db->xres;
info.var.yres = fsl_diu_mode_db->yres; info.var.yres = fsl_diu_mode_db->yres;
...@@ -376,10 +367,7 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix) ...@@ -376,10 +367,7 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix)
out_be32(&hw->gamma, gamma.paddr); out_be32(&hw->gamma, gamma.paddr);
out_be32(&hw->cursor, cursor.paddr); out_be32(&hw->cursor, cursor.paddr);
out_be32(&hw->bgnd, 0x007F7F7F); out_be32(&hw->bgnd, 0x007F7F7F);
out_be32(&hw->bgnd_wb, 0);
out_be32(&hw->disp_size, info.var.yres << 16 | info.var.xres); out_be32(&hw->disp_size, info.var.yres << 16 | info.var.xres);
out_be32(&hw->wb_size, 0);
out_be32(&hw->wb_mem_addr, 0);
out_be32(&hw->hsyn_para, info.var.left_margin << 22 | out_be32(&hw->hsyn_para, info.var.left_margin << 22 |
info.var.hsync_len << 11 | info.var.hsync_len << 11 |
info.var.right_margin); info.var.right_margin);
...@@ -388,18 +376,13 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix) ...@@ -388,18 +376,13 @@ int fsl_diu_init(u16 xres, u16 yres, u32 pixel_format, int gamma_fix)
info.var.vsync_len << 11 | info.var.vsync_len << 11 |
info.var.lower_margin); info.var.lower_margin);
out_be32(&hw->syn_pol, 0);
out_be32(&hw->thresholds, 0x00037800);
out_be32(&hw->int_status, 0);
out_be32(&hw->int_mask, 0);
out_be32(&hw->plut, 0x01F5F666);
/* Pixel Clock configuration */ /* Pixel Clock configuration */
diu_set_pixel_clock(info.var.pixclock); diu_set_pixel_clock(info.var.pixclock);
/* Set the frame buffers */ /* Set the frame buffers */
out_be32(&hw->desc[0], virt_to_phys(ad)); out_be32(&hw->desc[0], virt_to_phys(ad));
out_be32(&hw->desc[1], virt_to_phys(dummy_ad)); out_be32(&hw->desc[1], 0);
out_be32(&hw->desc[2], virt_to_phys(dummy_ad)); out_be32(&hw->desc[2], 0);
/* Enable the DIU, set display to all three planes */ /* Enable the DIU, set display to all three planes */
out_be32(&hw->diu_mode, 1); out_be32(&hw->diu_mode, 1);
......
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