diff mbox

[U-Boot,v2,3/3] EXYNOS: display 32bpp bitmap TIZEN logo

Message ID 4F990583.6090905@samsung.com
State Changes Requested
Delegated to: Anatolij Gustschin
Headers show

Commit Message

Donghwa Lee April 26, 2012, 8:21 a.m. UTC
This patches support drawing 32bpp bitmap TIZEN logo in exynos fb.
trats_logo.h data is compressed from trats_logo.bmp to
trats_logo.bmp.gz by gzip and converted to trats_logo.h header file
format by some application. And then it is decomressed at the exynos
fb driver by gunzip_bmp().

change of v1:
 - set CONFIG_SYS_VIDEO_LOGO_MAX_SIZE bigger than BMP header file size.
 - drawing logo when boot_logo_on variable sets in board file.
 - move trats_logo* header file to another patch.
 - set RGB order depending on file format in board file.
 - and so on.

Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 board/samsung/trats/trats.c |   12 ++++++++++++
 drivers/video/exynos_fb.c   |   33 +++++++++++++++++++++++++++++++++
 drivers/video/exynos_fb.h   |    7 -------
 drivers/video/exynos_fimd.c |    2 +-
 include/configs/trats.h     |    5 ++++-
 include/lcd.h               |    4 ++++
 6 files changed, 54 insertions(+), 9 deletions(-)

Comments

Minkyu Kang April 27, 2012, 12:46 a.m. UTC | #1
On 26 April 2012 17:21, Donghwa Lee <dh09.lee@samsung.com> wrote:
> This patches support drawing 32bpp bitmap TIZEN logo in exynos fb.
> trats_logo.h data is compressed from trats_logo.bmp to
> trats_logo.bmp.gz by gzip and converted to trats_logo.h header file
> format by some application. And then it is decomressed at the exynos
> fb driver by gunzip_bmp().
>
> change of v1:
>  - set CONFIG_SYS_VIDEO_LOGO_MAX_SIZE bigger than BMP header file size.
>  - drawing logo when boot_logo_on variable sets in board file.
>  - move trats_logo* header file to another patch.
>  - set RGB order depending on file format in board file.
>  - and so on.

This change log should be moved under the "---" line.

>
> Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  board/samsung/trats/trats.c |   12 ++++++++++++
>  drivers/video/exynos_fb.c   |   33 +++++++++++++++++++++++++++++++++
>  drivers/video/exynos_fb.h   |    7 -------
>  drivers/video/exynos_fimd.c |    2 +-
>  include/configs/trats.h     |    5 ++++-
>  include/lcd.h               |    4 ++++
>  6 files changed, 54 insertions(+), 9 deletions(-)
>
> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> index 084b67a..9d75b8f 100644
> --- a/board/samsung/trats/trats.c
> +++ b/board/samsung/trats/trats.c
> @@ -37,6 +37,7 @@
>  #include <pmic.h>
>  #include <usb/s3c_udc.h>
>  #include <max8997_pmic.h>
> +#include <tizen_logo_data.h>
>
>  #include "setup.h"
>
> @@ -455,6 +456,13 @@ static int mipi_power(void)
>        return 0;
>  }
>
> +enum exynos_fb_rgb_mode_t {
> +       MODE_RGB_P = 0,
> +       MODE_BGR_P = 1,
> +       MODE_RGB_S = 2,
> +       MODE_BGR_S = 3,
> +};

I think this is not a board specific.
It should be moved to lcd.h or fb.h.. somewhere.

> +
>  vidinfo_t panel_info = {
>        .vl_freq        = 60,
>        .vl_col         = 720,
> @@ -489,6 +497,10 @@ vidinfo_t panel_info = {
>        .reset_delay    = 0,
>        .interface_mode = FIMD_RGB_INTERFACE,
>        .mipi_enabled   = 1,
> +       .boot_logo_on   = 1,
> +       .rgb_mode       = MODE_BGR_P,
> +       .logo_height = TIZEN_LOGO_HEIGHT,
> +       .logo_width = TIZEN_LOGO_WIDTH,
>  };
>
>  void init_panel_info(vidinfo_t *vid)
> diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
> index 96a8ec1..f669b65 100644
> --- a/drivers/video/exynos_fb.c
> +++ b/drivers/video/exynos_fb.c
> @@ -32,6 +32,10 @@
>
>  #include "exynos_fb.h"
>
> +#ifdef CONFIG_TRATS
> +#include <tizen_logo.h>

No, there are no relation between TZEN logo and CONFIG_TRATS.
Need another define.

> +#endif
> +
>  int lcd_line_length;
>  int lcd_color_fg;
>  int lcd_color_bg;
> @@ -64,6 +68,29 @@ static void exynos_lcd_init(vidinfo_t *vid)
>        exynos_fimd_lcd_init(vid);
>  }
>
> +static void draw_logo(void)
> +{
> +       int x, y;
> +       bmp_image_t *bmp;
> +       ulong addr, len;
> +       unsigned int logo_width, logo_height;
> +
> +       logo_width = panel_info.logo_width;
> +       logo_height = panel_info.logo_height;
> +       x = ((panel_width - logo_width) >> 1);
> +       y = ((panel_height - logo_height) >> 1) - 4;
> +
> +       addr = (ulong)logo;

If did not includes any logo, then you will be get compile errors.

> +       bmp = (bmp_image_t *)addr;
> +
> +       if (!((bmp->header.signature[0] =='B') &&
> +                     (bmp->header.signature[1] =='M'))) {
> +                       addr = (ulong)gunzip_bmp(addr, &len);
> +       }
> +
> +       lcd_display_bitmap((ulong)addr, x, y);
> +}
> +
>  static void lcd_panel_on(vidinfo_t *vid)
>  {
>        udelay(vid->init_delay);
> @@ -115,6 +142,12 @@ void lcd_ctrl_init(void *lcdbase)
>
>  void lcd_enable(void)
>  {
> +       if (panel_info.boot_logo_on) {
> +               memset(lcd_base, 0, panel_width * panel_height *
> +                               (NBITS(panel_info.vl_bpix) >> 3));
> +               draw_logo();
> +       }
> +
>        lcd_panel_on(&panel_info);
>  }
>
> diff --git a/drivers/video/exynos_fb.h b/drivers/video/exynos_fb.h
> index 66f5da6..4ff2efd 100644
> --- a/drivers/video/exynos_fb.h
> +++ b/drivers/video/exynos_fb.h
> @@ -27,13 +27,6 @@
>
>  #define MAX_CLOCK      (86 * 1000000)
>
> -enum exynos_fb_rgb_mode_t {
> -       MODE_RGB_P = 0,
> -       MODE_BGR_P = 1,
> -       MODE_RGB_S = 2,
> -       MODE_BGR_S = 3,
> -};
> -
>  enum exynos_cpu_auto_cmd_rate {
>        DISABLE_AUTO_FRM,
>        PER_TWO_FRM,
> diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
> index 6416b90..f07568a 100644
> --- a/drivers/video/exynos_fimd.c
> +++ b/drivers/video/exynos_fimd.c
> @@ -273,7 +273,7 @@ void exynos_fimd_lcd_init(vidinfo_t *vid)
>        /* store panel info to global variable */
>        pvid = vid;
>
> -       rgb_mode = MODE_RGB_P;
> +       rgb_mode = vid->rgb_mode;
>
>        if (vid->interface_mode == FIMD_RGB_INTERFACE) {
>                cfg |= EXYNOS_VIDCON0_VIDOUT_RGB;
> diff --git a/include/lcd.h b/include/lcd.h
> index 3d9ef16..5d09696 100644
> --- a/include/lcd.h
> +++ b/include/lcd.h
> @@ -235,6 +235,10 @@ typedef struct vidinfo {
>        unsigned int wr_setup;
>        unsigned int wr_act;
>        unsigned int wr_hold;
> +       unsigned int boot_logo_on;
> +       unsigned int rgb_mode;
> +       unsigned int logo_width;
> +       unsigned int logo_height;

boot_logo? or logo?
please fix it.

Thanks.
Minkyu Kang.
Anatolij Gustschin April 30, 2012, 10:14 a.m. UTC | #2
Hi,

On Thu, 26 Apr 2012 17:21:23 +0900
Donghwa Lee <dh09.lee@samsung.com> wrote:
...
> diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
> index 96a8ec1..f669b65 100644
> --- a/drivers/video/exynos_fb.c
> +++ b/drivers/video/exynos_fb.c
...
> @@ -64,6 +68,29 @@ static void exynos_lcd_init(vidinfo_t *vid)
>  	exynos_fimd_lcd_init(vid);
>  }
>  
> +static void draw_logo(void)
> +{
> +	int x, y;
> +	bmp_image_t *bmp;
> +	ulong addr, len;
> +	unsigned int logo_width, logo_height;
> +
> +	logo_width = panel_info.logo_width;
> +	logo_height = panel_info.logo_height;
> +	x = ((panel_width - logo_width) >> 1);
> +	y = ((panel_height - logo_height) >> 1) - 4;
> +
> +	addr = (ulong)logo;
> +	bmp = (bmp_image_t *)addr;
> +
> +	if (!((bmp->header.signature[0] =='B') &&
> +		      (bmp->header.signature[1] =='M'))) {
> +			addr = (ulong)gunzip_bmp(addr, &len);
> +	}
> +
> +	lcd_display_bitmap((ulong)addr, x, y);

Here freeing the buffer allocated by gunzip_bmp() is needed. But I think
that we should better use bmp_display((ulong)addr, x, y) here to reuse
the existing code. I've sent a patch [1] making bmp_display() non static,
so please use bmp_display() here.

Thanks,
Anatolij

[1] http://patchwork.ozlabs.org/patch/155490/
diff mbox

Patch

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 084b67a..9d75b8f 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -37,6 +37,7 @@ 
 #include <pmic.h>
 #include <usb/s3c_udc.h>
 #include <max8997_pmic.h>
+#include <tizen_logo_data.h>
 
 #include "setup.h"
 
@@ -455,6 +456,13 @@  static int mipi_power(void)
 	return 0;
 }
 
+enum exynos_fb_rgb_mode_t {
+	MODE_RGB_P = 0,
+	MODE_BGR_P = 1,
+	MODE_RGB_S = 2,
+	MODE_BGR_S = 3,
+};
+
 vidinfo_t panel_info = {
 	.vl_freq	= 60,
 	.vl_col		= 720,
@@ -489,6 +497,10 @@  vidinfo_t panel_info = {
 	.reset_delay	= 0,
 	.interface_mode = FIMD_RGB_INTERFACE,
 	.mipi_enabled	= 1,
+	.boot_logo_on	= 1,
+	.rgb_mode	= MODE_BGR_P,
+	.logo_height = TIZEN_LOGO_HEIGHT,
+	.logo_width = TIZEN_LOGO_WIDTH,
 };
 
 void init_panel_info(vidinfo_t *vid)
diff --git a/drivers/video/exynos_fb.c b/drivers/video/exynos_fb.c
index 96a8ec1..f669b65 100644
--- a/drivers/video/exynos_fb.c
+++ b/drivers/video/exynos_fb.c
@@ -32,6 +32,10 @@ 
 
 #include "exynos_fb.h"
 
+#ifdef CONFIG_TRATS
+#include <tizen_logo.h>
+#endif
+
 int lcd_line_length;
 int lcd_color_fg;
 int lcd_color_bg;
@@ -64,6 +68,29 @@  static void exynos_lcd_init(vidinfo_t *vid)
 	exynos_fimd_lcd_init(vid);
 }
 
+static void draw_logo(void)
+{
+	int x, y;
+	bmp_image_t *bmp;
+	ulong addr, len;
+	unsigned int logo_width, logo_height;
+
+	logo_width = panel_info.logo_width;
+	logo_height = panel_info.logo_height;
+	x = ((panel_width - logo_width) >> 1);
+	y = ((panel_height - logo_height) >> 1) - 4;
+
+	addr = (ulong)logo;
+	bmp = (bmp_image_t *)addr;
+
+	if (!((bmp->header.signature[0] =='B') &&
+		      (bmp->header.signature[1] =='M'))) {
+			addr = (ulong)gunzip_bmp(addr, &len);
+	}
+
+	lcd_display_bitmap((ulong)addr, x, y);
+}
+
 static void lcd_panel_on(vidinfo_t *vid)
 {
 	udelay(vid->init_delay);
@@ -115,6 +142,12 @@  void lcd_ctrl_init(void *lcdbase)
 
 void lcd_enable(void)
 {
+	if (panel_info.boot_logo_on) {
+		memset(lcd_base, 0, panel_width * panel_height *
+				(NBITS(panel_info.vl_bpix) >> 3));
+		draw_logo();
+	}
+
 	lcd_panel_on(&panel_info);
 }
 
diff --git a/drivers/video/exynos_fb.h b/drivers/video/exynos_fb.h
index 66f5da6..4ff2efd 100644
--- a/drivers/video/exynos_fb.h
+++ b/drivers/video/exynos_fb.h
@@ -27,13 +27,6 @@ 
 
 #define MAX_CLOCK	(86 * 1000000)
 
-enum exynos_fb_rgb_mode_t {
-	MODE_RGB_P = 0,
-	MODE_BGR_P = 1,
-	MODE_RGB_S = 2,
-	MODE_BGR_S = 3,
-};
-
 enum exynos_cpu_auto_cmd_rate {
 	DISABLE_AUTO_FRM,
 	PER_TWO_FRM,
diff --git a/drivers/video/exynos_fimd.c b/drivers/video/exynos_fimd.c
index 6416b90..f07568a 100644
--- a/drivers/video/exynos_fimd.c
+++ b/drivers/video/exynos_fimd.c
@@ -273,7 +273,7 @@  void exynos_fimd_lcd_init(vidinfo_t *vid)
 	/* store panel info to global variable */
 	pvid = vid;
 
-	rgb_mode = MODE_RGB_P;
+	rgb_mode = vid->rgb_mode;
 
 	if (vid->interface_mode == FIMD_RGB_INTERFACE) {
 		cfg |= EXYNOS_VIDCON0_VIDOUT_RGB;
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 5f913ca..e611ace 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -216,9 +216,12 @@ 
 /* LCD */
 #define CONFIG_EXYNOS_FB
 #define CONFIG_LCD
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_32BPP
 #define CONFIG_FB_ADDR		0x52504000
 #define CONFIG_S6E8AX0
 #define CONFIG_EXYNOS_MIPI_DSIM
-#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE	(1280 * 720 * 4)
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE ((500 * 120 * 4) + (1 << 12))
 
 #endif	/* __CONFIG_H */
diff --git a/include/lcd.h b/include/lcd.h
index 3d9ef16..5d09696 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -235,6 +235,10 @@  typedef struct vidinfo {
 	unsigned int wr_setup;
 	unsigned int wr_act;
 	unsigned int wr_hold;
+	unsigned int boot_logo_on;
+	unsigned int rgb_mode;
+	unsigned int logo_width;
+	unsigned int logo_height;
 
 	/* parent clock name(MPLL, EPLL or VPLL) */
 	unsigned int pclk_name;