[U-Boot] [PATCH 3/6] video: cfb_console: logo can be positioned via the splashpos variable

Bastian Ruppert Bastian.Ruppert at Sewerin.de
Fri Aug 10 09:26:43 CEST 2012


Signed-off-by: Bastian Ruppert <Bastian.Ruppert at Sewerin.de>
CC: Anatolij Gustschin <agust at denx.de>
CC: Tom Rini <trini at ti.com>
CC: Stefano Babic <sbabic at denx.de>
---
 drivers/video/cfb_console.c |   61 ++++++++++++++++++++++++++++---------------
 1 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 19d061f..21b52bd 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -66,7 +66,11 @@
  * CONFIG_CONSOLE_TIME	      - display time/date in upper right
  *				corner, needs CONFIG_CMD_DATE and
  *				CONFIG_CONSOLE_CURSOR
- * CONFIG_VIDEO_LOGO	      - display Linux Logo in upper left corner
+ * CONFIG_VIDEO_LOGO	      - display Linux Logo in upper left corner.
+ *				Use CONFIG_SPLASH_SCREEN_ALIGN with
+ *				environment variable "splashpos" to place
+ *				the logo on other position. In this case
+ *				no CONSOLE_EXTRA_INFO is possible.
  * CONFIG_VIDEO_BMP_LOGO      - use bmp_logo instead of linux_logo
  * CONFIG_CONSOLE_EXTRA_INFO  - display additional board information
  *				strings that normaly goes to serial
@@ -369,6 +373,8 @@ static void *video_fb_address;	/* frame buffer address */
 static void *video_console_address;	/* console buffer start address */
 
 static int video_logo_height = VIDEO_LOGO_HEIGHT;
+static int video_logo_xpos;
+static int video_logo_ypos;
 
 static int __maybe_unused cursor_state;
 static int __maybe_unused old_col;
@@ -1594,40 +1600,53 @@ static void *video_logo(void)
 	__maybe_unused int y_off = 0;
 
 #ifdef CONFIG_SPLASH_SCREEN
-	char *s;
 	ulong addr;
-
-	s = getenv("splashimage");
+#endif
+#if defined(CONFIG_SPLASH_SCREEN) || defined(CONFIG_SPLASH_SCREEN_ALIGN)
+	char *s;
+#endif
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+	s = getenv("splashpos");
 	if (s != NULL) {
-		int x = 0, y = 0;
+		if (s[0] == 'm')
+			video_logo_xpos = BMP_ALIGN_CENTER;
+		else
+			video_logo_xpos = simple_strtol(s, NULL, 0);
 
-		addr = simple_strtoul(s, NULL, 16);
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
-		s = getenv("splashpos");
+		s = strchr(s + 1, ',');
 		if (s != NULL) {
-			if (s[0] == 'm')
-				x = BMP_ALIGN_CENTER;
+			if (s[1] == 'm')
+				video_logo_ypos = BMP_ALIGN_CENTER;
 			else
-				x = simple_strtol(s, NULL, 0);
-
-			s = strchr(s + 1, ',');
-			if (s != NULL) {
-				if (s[1] == 'm')
-					y = BMP_ALIGN_CENTER;
-				else
-					y = simple_strtol(s + 1, NULL, 0);
-			}
+				video_logo_ypos = simple_strtol(s + 1, NULL, 0);
 		}
+	}
 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+#ifdef CONFIG_SPLASH_SCREEN
+	s = getenv("splashimage");
+	if (s != NULL) {
+
+		addr = simple_strtoul(s, NULL, 16);
 
-		if (video_display_bitmap(addr, x, y) == 0) {
+
+		if (video_display_bitmap(addr,			\
+					video_logo_xpos,	\
+					video_logo_ypos) == 0) {
 			video_logo_height = 0;
 			return ((void *) (video_fb_address));
 		}
 	}
 #endif /* CONFIG_SPLASH_SCREEN */
 
-	logo_plot(video_fb_address, VIDEO_COLS, 0, 0);
+	logo_plot(video_fb_address,		\
+		VIDEO_COLS,			\
+		video_logo_xpos,		\
+		video_logo_ypos);
+
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+	/* when using splashpos for video_logo, no console output */
+	return (video_fb_address + video_logo_height * VIDEO_LINE_LEN);
+#endif
 
 	sprintf(info, " %s", version_string);
 
-- 
1.7.0.4



More information about the U-Boot mailing list