mpc8610: refactor DIU initialization code to use existing bitmap and logo features
PATCH v2 1/1 mpc8610: refactor DIU initialization code to use existing bitmap and logo features
The Freescale MPC8610 DIU code had re-implement two features that already existed in U-Boot: bitmap drawing and top-of-screen logo (CONFIG_VIDEO_LOGO). So delete the 8610-specific code and use the built-in features instead.
---
This patch depends on the patch, "logos: add Freescale logo"
board/freescale/common/fsl_diu_fb.c | 132 +------------------------ board/freescale/common/fsl_diu_fb.h | 12 +-- board/freescale/mpc8610hpcd/mpc8610hpcd.c | 6 +- board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c | 44 +------- include/configs/MPC8610HPCD.h | 7 +- 5 files changed, 15 insertions(+), 186 deletions(-)
board/freescale/common/fsl_diu_fb.c +2 -130
@@ -208,10 +208,7 @@ static int fsl_diu_disable_panel(struct fb_info *info);static int allocate_buf (struct diu_addr *buf,u32 size,u32 bytes_align);void diu_set_pixel_clock (unsigned int pixclock); -int fsl_diu_init (int xres, -unsigned int pixel_format, -int gamma_fix, -unsigned char *splash_bmp) +int fsl_diu_init (int xres,unsigned int pixel_format,int gamma_fix) {struct fb_videomode *fsl_diu_mode_db;struct diu_ad *ad = &fsl_diu_fb_ad;
@@ -288,8 +285,6 @@ int fsl_diu_init(int xres, var->sync = fsl_diu_mode_db->sync; var->vmode = fsl_diu_mode_db->vmode; info->line_length = var->xres * var->bits_per_pixel /8 ; - info->logo_size =0 ; - info->logo_height =0 ; ad->pix_fmt = pixel_format; ad->addr =cpu_to_le32 ((unsigned int )info->screen_base);
@@ -358,13 +353,6 @@ int fsl_diu_init(int xres, fb_initialized =1 ; -if (splash_bmp) { - info->logo_height =fsl_diu_display_bmp (splash_bmp,0 ,0 ,0 ); - info->logo_size = info->logo_height * info->line_length; -debug ("logo height %d, logo_size 0x%x\n" , - info->logo_height,info->logo_size); - } -/* Enable the DIU */ fsl_diu_enable_panel (info);enable_lcdc ();
@@ -375,8 +363,7 @@ int fsl_diu_init(int xres,char *fsl_fb_open (struct fb_info **info) { *info = &fsl_fb_info; -return (char *) ((unsigned int )(*info)->screen_base - + (*info)->logo_size); +return fsl_fb_info.screen_base; }void fsl_diu_close (void )
@@ -485,118 +472,3 @@ static int allocate_buf(struct diu_addr *buf, u32 size, u32 bytes_align) buf->offset =0 ;return 0 ; } - -int fsl_diu_display_bmp (unsigned char *bmp, -int xoffset, -int yoffset, -int transpar) -{ -struct fb_info *info = &fsl_fb_info; -unsigned char r, g, b; -unsigned int *fb_t, val; -unsigned char *bitmap; -unsigned int palette[256 ]; -int width, height, bpp, ncolors, raster, offset, x, y, i, k, cpp; - -if (!bmp) { -printf ("Must supply a bitmap address\n" ); -return 0 ; - } - - raster = bmp[10 ] + (bmp[11 ] <<8 ) + (bmp[12 ] <<16 ) + (bmp[13 ] <<24 ); - width = (bmp[21 ] <<24 ) | (bmp[20 ] <<16 ) | (bmp[19 ] <<8 ) | bmp[18 ]; - height = (bmp[25 ] <<24 ) | (bmp[24 ] <<16 ) | (bmp[23 ] <<8 ) | bmp[22 ]; - bpp = (bmp[29 ] <<8 ) | (bmp[28 ]); - ncolors = bmp[46 ] + (bmp[47 ] <<8 ) + (bmp[48 ] <<16 ) + (bmp[49 ] <<24 ); - bitmap = bmp + raster; - cpp = info->var.bits_per_pixel /8 ; - -debug ("bmp = 0x%08x\n" , (unsigned int )bmp); -debug ("bitmap = 0x%08x\n" , (unsigned int )bitmap); -debug ("width = %d\n" , width); -debug ("height = %d\n" , height); -debug ("bpp = %d\n" , bpp); -debug ("ncolors = %d\n" , ncolors); - -debug ("xres = %d\n" , info->var.xres); -debug ("yres = %d\n" , info->var.yres); -debug ("Screen_base = 0x%x\n" , (unsigned int )info->screen_base); - -if (((width+xoffset) > info->var.xres) || - ((height+yoffset) > info->var.yres)) { -printf ("bitmap is out of range, image too large or too much offset\n" ); -return 0 ; - } -if (bpp <24 ) { -for (i =0 , offset =54 ; i < ncolors; i++, offset +=4 ) - palette[i] = (bmp[offset+2 ] <<16 ) - + (bmp[offset+1 ] <<8 ) + bmp[offset]; - } - -switch (bpp) { -case 1 : -for (y = height -1 ; y >=0 ; y--) { - fb_t = (unsigned int *) ((unsigned int )info->screen_base + (((y+yoffset) * info->var.xres) + xoffset)*cpp); -for (x =0 ; x < width; x +=8 ) { - b = *bitmap++; -for (k =0 ; k <8 ; k++) { -if (b &0x80 ) - *fb_t++ = palette[1 ]; -else - *fb_t++ = palette[0 ]; - b = b <<1 ; - } - } -for (i = (width /2 ) %4 ; i >0 ; i--) - bitmap++; - } -break ; -case 4 : -for (y = height -1 ; y >=0 ; y--) { - fb_t = (unsigned int *) ((unsigned int )info->screen_base + (((y+yoffset) * info->var.xres) + xoffset)*cpp); -for (x =0 ; x < width; x +=2 ) { - b = *bitmap++; - r = (b >>4 ) &0x0F ; - g = b &0x0F ; - *fb_t++ = palette[r]; - *fb_t++ = palette[g]; - } -for (i = (width /2 ) %4 ; i >0 ; i--) - bitmap++; - } -break ; -case 8 : -for (y = height -1 ; y >=0 ; y--) { - fb_t = (unsigned int *) ((unsigned int )info->screen_base + (((y+yoffset) * info->var.xres) + xoffset)*cpp); -for (x =0 ; x < width; x++) { - *fb_t++ = palette[ *bitmap++ ]; - } -for (i = (width /2 ) %4 ; i >0 ; i--) - bitmap++; - } -break ; -case 24 : -for (y = height -1 ; y >=0 ; y--) { - fb_t = (unsigned int *) ((unsigned int )info->screen_base + (((y+yoffset) * info->var.xres) + xoffset)*cpp); -for (x =0 ; x < width; x++) { - b = *bitmap++; - g = *bitmap++; - r = *bitmap++; - val = (r <<16 ) + (g <<8 ) + b; - *fb_t++ = val; - } -for (; (x %4 ) !=0 ; x++)/* 4-byte alignment */ - bitmap++; - } -break ; - } - -return height; -} - -void fsl_diu_clear_screen (void ) -{ -struct fb_info *info = &fsl_fb_info; - -memset (info->screen_base,0 , info->smem_len); -}
board/freescale/common/fsl_diu_fb.h +1 -11
@@ -52,18 +52,8 @@ struct fb_info {char *screen_base;unsigned long screen_size; -int logo_height; -unsigned int logo_size; };extern char *fsl_fb_open (struct fb_info **info); -extern int fsl_diu_init (int xres, -unsigned int pixel_format, -int gamma_fix, -unsigned char *splash_bmp); -extern void fsl_diu_clear_screen (void ); -extern int fsl_diu_display_bmp (unsigned char *bmp, -int xoffset, -int yoffset, -int transpar); +int fsl_diu_init (int xres,unsigned int pixel_format,int gamma_fix);
board/freescale/mpc8610hpcd/mpc8610hpcd.c +1 -5
@@ -36,7 +36,7 @@void sdram_init (void );phys_size_t fixed_sdram (void ); -void mpc8610hpcd_diu_init (void ); +int mpc8610hpcd_diu_init (void );/* called before any console output */
@@ -84,10 +84,6 @@ int misc_init_r(void)i2c_read (0x38 ,0x0A ,1 , &tmp_val,sizeof (tmp_val));debug ("DVI Encoder Read: 0x%02lx\n" ,tmp_val); -#ifdef CONFIG_FSL_DIU_FB -mpc8610hpcd_diu_init (); -#endif -return 0 ; }
board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c +6 -38
76 lines not on this page · raw message
include/configs/MPC8610HPCD.h +5 -2
@@ -22,11 +22,14 @@#define CONFIG_FSL_DIU_FB 1/* FSL DIU */ /* video */ -#undef CONFIG_VIDEO +#define CONFIG_VIDEO -#if defined(CONFIG_VIDEO ) +#ifdef CONFIG_VIDEO +#define CONFIG_CMD_BMP #define CONFIG_CFB_CONSOLE #define CONFIG_VGA_AS_SINGLE_DEVICE +#define CONFIG_VIDEO_LOGO +#define CONFIG_VIDEO_BMP_LOGO #endif #ifdef RUN_DIAG
Signature · 1 line
1.7.2.1
PATCH v2 1/1 mpc8610: refactor DIU initialization code to use existing bitmap and logo features
Quoted 6 lines · Timur Tabi
The Freescale MPC8610 DIU code had re-implement two features that already existed in U-Boot: bitmap drawing and top-of-screen logo (
CONFIG_VIDEO_LOGO). So delete the 8610-specific code and use the built-in features instead.Signed-off-by Timur Tabi <[email protected]>---
Ugh, this patch breaks 512x. v3 coming soon.