From patchwork Sat Sep 1 22:29:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatolij Gustschin X-Patchwork-Id: 181154 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3D46F2C0085 for ; Sun, 2 Sep 2012 08:29:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AE66F2808B; Sun, 2 Sep 2012 00:29:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M-euLLj+THxc; Sun, 2 Sep 2012 00:29:18 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AE8D328090; Sun, 2 Sep 2012 00:29:16 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 768BA28090 for ; Sun, 2 Sep 2012 00:29:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IPfx35S4I6Bs for ; Sun, 2 Sep 2012 00:29:09 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by theia.denx.de (Postfix) with ESMTPS id 188102808B for ; Sun, 2 Sep 2012 00:29:06 +0200 (CEST) Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3X8XD12HvRz3hhdl; Sun, 2 Sep 2012 00:29:05 +0200 (CEST) X-Auth-Info: HgaiyfU7Kgo/0mXD8wPkYihe4zJhn2+awyozQkh7DXo= Received: from localhost (p4FDE7349.dip.t-dialin.net [79.222.115.73]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA id 3X8XD073ydzbbfk; Sun, 2 Sep 2012 00:29:04 +0200 (CEST) From: Anatolij Gustschin To: u-boot@lists.denx.de Date: Sun, 2 Sep 2012 00:29:25 +0200 Message-Id: <1346538565-1821-1-git-send-email-agust@denx.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1344583606-12778-3-git-send-email-Bastian.Ruppert@Sewerin.de> References: <1344583606-12778-3-git-send-email-Bastian.Ruppert@Sewerin.de> Cc: Tom Rini , Bastian Ruppert Subject: [U-Boot] [PATCH v2 3/6] video: cfb_console: logo can be positioned via the splashpos variable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Bastian Ruppert Extend the driver for placing the video/bmp logo as specified by "splashpos" environment variable. Signed-off-by: Bastian Ruppert Signed-off-by: Anatolij Gustschin CC: Tom Rini CC: Stefano Babic --- v2: - remove some ifdefs - revise commit log - adjust video_logo_height by video_logo_ypos and thus fix return address for video console offset - add BMP_ALIGN_CENTER case to logo_plot() for proper logo offset calculation if "m" specifier is used in splashpos drivers/video/cfb_console.c | 88 ++++++++++++++++++++++++++++++------------ 1 files changed, 63 insertions(+), 25 deletions(-) diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 19d061f..81e5e08 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; @@ -1488,8 +1494,21 @@ void logo_plot(void *screen, int width, int x, int y) int ycount = video_logo_height; unsigned char r, g, b, *logo_red, *logo_blue, *logo_green; unsigned char *source; - unsigned char *dest = (unsigned char *) screen + - ((y * width * VIDEO_PIXEL_SIZE) + x * VIDEO_PIXEL_SIZE); + unsigned char *dest; + +#ifdef CONFIG_SPLASH_SCREEN_ALIGN + if (x == BMP_ALIGN_CENTER) + x = max(0, (VIDEO_VISIBLE_COLS - VIDEO_LOGO_WIDTH) / 2); + else if (x < 0) + x = max(0, VIDEO_VISIBLE_COLS - VIDEO_LOGO_WIDTH + x + 1); + + if (y == BMP_ALIGN_CENTER) + y = max(0, (VIDEO_VISIBLE_ROWS - VIDEO_LOGO_HEIGHT) / 2); + else if (y < 0) + y = max(0, VIDEO_VISIBLE_ROWS - VIDEO_LOGO_HEIGHT + y + 1); +#endif /* CONFIG_SPLASH_SCREEN_ALIGN */ + + dest = (unsigned char *)screen + (y * width + x) * VIDEO_PIXEL_SIZE; #ifdef CONFIG_VIDEO_BMP_LOGO source = bmp_logo_bitmap; @@ -1592,42 +1611,61 @@ static void *video_logo(void) char info[128]; int space, len; __maybe_unused int y_off = 0; + __maybe_unused ulong addr; + __maybe_unused char *s; -#ifdef CONFIG_SPLASH_SCREEN - char *s; - ulong addr; - - s = getenv("splashimage"); +#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 */ - if (video_display_bitmap(addr, x, y) == 0) { +#ifdef CONFIG_SPLASH_SCREEN + s = getenv("splashimage"); + if (s != NULL) { + + addr = simple_strtoul(s, NULL, 16); + + + 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, skip any info + * output on video console if the logo is not at 0,0 + */ + if (video_logo_xpos || video_logo_ypos) { + /* + * video_logo_height is used in text and cursor offset + * calculations. Since the console is below the logo, + * we need to adjust the logo height + */ + video_logo_height += video_logo_ypos; + return video_fb_address + video_logo_height * VIDEO_LINE_LEN; + } +#endif sprintf(info, " %s", version_string);