public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined
@ 2013-06-06 17:57 Otavio Salvador
  2013-06-06 18:16 ` Otavio Salvador
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Otavio Salvador @ 2013-06-06 17:57 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 common/cmd_bmp.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 5a52edd..48e045e 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -33,6 +33,10 @@
 #include <malloc.h>
 #include <video.h>
 
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+#define BMP_ALIGN_CENTER	0x7FFF
+#endif
+
 static int bmp_info (ulong addr);
 
 /*
@@ -112,6 +116,25 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
 {
 	ulong addr;
 	int x = 0, y = 0;
+	__maybe_unused char *s;
+
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+	s = getenv("splashpos");
+	if (s != NULL) {
+		if (s[0] == 'm')
+			x = 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);
+		}
+	}
+#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
 
 	switch (argc) {
 	case 1:		/* use load_addr as default address */
-- 
1.8.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined
  2013-06-06 17:57 [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined Otavio Salvador
@ 2013-06-06 18:16 ` Otavio Salvador
  2013-06-17 21:36 ` Otavio Salvador
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Otavio Salvador @ 2013-06-06 18:16 UTC (permalink / raw)
  To: u-boot

Dear Anatolij,

On Thu, Jun 6, 2013 at 2:57 PM, Otavio Salvador <otavio@ossystems.com.br>wrote:

> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>

I forgot to add you in Cc; sorry.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined
  2013-06-06 17:57 [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined Otavio Salvador
  2013-06-06 18:16 ` Otavio Salvador
@ 2013-06-17 21:36 ` Otavio Salvador
  2013-07-01 22:01 ` Anatolij Gustschin
  2013-07-01 22:04 ` [U-Boot] [PATCH] video: consolidate splash screen alignment code Anatolij Gustschin
  3 siblings, 0 replies; 8+ messages in thread
From: Otavio Salvador @ 2013-06-17 21:36 UTC (permalink / raw)
  To: u-boot

On Thu, Jun 6, 2013 at 2:57 PM, Otavio Salvador <otavio@ossystems.com.br> wrote:
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

Ping?

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined
  2013-06-06 17:57 [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined Otavio Salvador
  2013-06-06 18:16 ` Otavio Salvador
  2013-06-17 21:36 ` Otavio Salvador
@ 2013-07-01 22:01 ` Anatolij Gustschin
  2013-07-01 22:25   ` Otavio Salvador
  2013-07-01 22:04 ` [U-Boot] [PATCH] video: consolidate splash screen alignment code Anatolij Gustschin
  3 siblings, 1 reply; 8+ messages in thread
From: Anatolij Gustschin @ 2013-07-01 22:01 UTC (permalink / raw)
  To: u-boot

Hello Otavio,

Sorry for delay.

On Thu,  6 Jun 2013 14:57:23 -0300
Otavio Salvador <otavio@ossystems.com.br> wrote:
...
> +#ifdef CONFIG_SPLASH_SCREEN_ALIGN
> +	s = getenv("splashpos");
> +	if (s != NULL) {
> +		if (s[0] == 'm')
> +			x = 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);
> +		}
> +	}
> +#endif /* CONFIG_SPLASH_SCREEN_ALIGN */

This code is already there in two other drivers, we should better
add a common function for "splashpos" checking and use it here.
I'll submit a patch shortly.

Thanks,

Anatolij

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] video: consolidate splash screen alignment code
  2013-06-06 17:57 [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined Otavio Salvador
                   ` (2 preceding siblings ...)
  2013-07-01 22:01 ` Anatolij Gustschin
@ 2013-07-01 22:04 ` Anatolij Gustschin
  2013-07-01 22:24   ` Otavio Salvador
  2013-07-08 18:47   ` Anatolij Gustschin
  3 siblings, 2 replies; 8+ messages in thread
From: Anatolij Gustschin @ 2013-07-01 22:04 UTC (permalink / raw)
  To: u-boot

Code for checking "splashpos" environment variable is
duplicated in drivers, move it to the common function.
Call this function also in the bmp display command to
consider "splashpos" settings.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 common/cmd_bmp.c            |    3 +++
 common/lcd.c                |   19 ++-----------------
 common/splash.c             |   25 +++++++++++++++++++++++++
 drivers/video/cfb_console.c |   24 ++----------------------
 include/splash.h            |    7 +++++++
 5 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 946031d..a7c5fbd 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -31,6 +31,7 @@
 #include <command.h>
 #include <asm/byteorder.h>
 #include <malloc.h>
+#include <splash.h>
 #include <video.h>
 
 static int bmp_info (ulong addr);
@@ -125,6 +126,8 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const ar
 	ulong addr;
 	int x = 0, y = 0;
 
+	splash_get_pos(&x, &y);
+
 	switch (argc) {
 	case 1:		/* use load_addr as default address */
 		addr = load_addr;
diff --git a/common/lcd.c b/common/lcd.c
index 95006aa..50ea4d6 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -1089,23 +1089,8 @@ static void *lcd_logo(void)
 			return (void *)lcd_base;
 
 		addr = simple_strtoul (s, NULL, 16);
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
-		s = getenv("splashpos");
-		if (s != NULL) {
-			if (s[0] == 'm')
-				x = 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);
-			}
-		}
-#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+
+		splash_get_pos(&x, &y);
 
 		if (bmp_display(addr, x, y) == 0)
 			return (void *)lcd_base;
diff --git a/common/splash.c b/common/splash.c
index c744497..18885f1 100644
--- a/common/splash.c
+++ b/common/splash.c
@@ -20,6 +20,7 @@
  *
  */
 
+#include <common.h>
 #include <splash.h>
 
 int __splash_screen_prepare(void)
@@ -29,3 +30,27 @@ int __splash_screen_prepare(void)
 
 int splash_screen_prepare(void)
 	__attribute__ ((weak, alias("__splash_screen_prepare")));
+
+
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+void splash_get_pos(int *x, int *y)
+{
+	char *s = getenv("splashpos");
+
+	if (!s)
+		return;
+
+	if (s[0] == 'm')
+		*x = 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);
+	}
+}
+#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 785bbcf..e384b71 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -222,11 +222,7 @@
 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
 #include <watchdog.h>
 #include <bmp_layout.h>
-
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
-#define BMP_ALIGN_CENTER	0x7FFF
-#endif
-
+#include <splash.h>
 #endif
 
 /*
@@ -1976,23 +1972,7 @@ static void *video_logo(void)
 	__maybe_unused ulong addr;
 	__maybe_unused char *s;
 
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
-	s = getenv("splashpos");
-	if (s != NULL) {
-		if (s[0] == 'm')
-			video_logo_xpos = BMP_ALIGN_CENTER;
-		else
-			video_logo_xpos = simple_strtol(s, NULL, 0);
-
-		s = strchr(s + 1, ',');
-		if (s != NULL) {
-			if (s[1] == 'm')
-				video_logo_ypos = BMP_ALIGN_CENTER;
-			else
-				video_logo_ypos = simple_strtol(s + 1, NULL, 0);
-		}
-	}
-#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+	splash_get_pos(&video_logo_xpos, &video_logo_ypos);
 
 #ifdef CONFIG_SPLASH_SCREEN
 	s = getenv("splashimage");
diff --git a/include/splash.h b/include/splash.h
index a8dd151..89ee7b2 100644
--- a/include/splash.h
+++ b/include/splash.h
@@ -25,5 +25,12 @@
 
 int splash_screen_prepare(void);
 
+#ifdef CONFIG_SPLASH_SCREEN_ALIGN
+void splash_get_pos(int *x, int *y);
+#else
+static inline void splash_get_pos(int *x, int *y) { }
+#endif
+
+#define BMP_ALIGN_CENTER	0x7FFF
 
 #endif
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] video: consolidate splash screen alignment code
  2013-07-01 22:04 ` [U-Boot] [PATCH] video: consolidate splash screen alignment code Anatolij Gustschin
@ 2013-07-01 22:24   ` Otavio Salvador
  2013-07-08 18:47   ` Anatolij Gustschin
  1 sibling, 0 replies; 8+ messages in thread
From: Otavio Salvador @ 2013-07-01 22:24 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 1, 2013 at 7:04 PM, Anatolij Gustschin <agust@denx.de> wrote:
> Code for checking "splashpos" environment variable is
> duplicated in drivers, move it to the common function.
> Call this function also in the bmp display command to
> consider "splashpos" settings.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>

Awesome!

Acked-by: Otavio Salvador <otavio@ossystems.com.br>

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined
  2013-07-01 22:01 ` Anatolij Gustschin
@ 2013-07-01 22:25   ` Otavio Salvador
  0 siblings, 0 replies; 8+ messages in thread
From: Otavio Salvador @ 2013-07-01 22:25 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 1, 2013 at 7:01 PM, Anatolij Gustschin <agust@denx.de> wrote:
> Hello Otavio,
>
> Sorry for delay.
>
> On Thu,  6 Jun 2013 14:57:23 -0300
> Otavio Salvador <otavio@ossystems.com.br> wrote:
> ...
>> +#ifdef CONFIG_SPLASH_SCREEN_ALIGN
>> +     s = getenv("splashpos");
>> +     if (s != NULL) {
>> +             if (s[0] == 'm')
>> +                     x = 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);
>> +             }
>> +     }
>> +#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
>
> This code is already there in two other drivers, we should better
> add a common function for "splashpos" checking and use it here.
> I'll submit a patch shortly.

Agreed; I just acked the patch ... it looks great, thanks!

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://projetos.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] video: consolidate splash screen alignment code
  2013-07-01 22:04 ` [U-Boot] [PATCH] video: consolidate splash screen alignment code Anatolij Gustschin
  2013-07-01 22:24   ` Otavio Salvador
@ 2013-07-08 18:47   ` Anatolij Gustschin
  1 sibling, 0 replies; 8+ messages in thread
From: Anatolij Gustschin @ 2013-07-08 18:47 UTC (permalink / raw)
  To: u-boot

On Tue,  2 Jul 2013 00:04:05 +0200
Anatolij Gustschin <agust@denx.de> wrote:

> Code for checking "splashpos" environment variable is
> duplicated in drivers, move it to the common function.
> Call this function also in the bmp display command to
> consider "splashpos" settings.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  common/cmd_bmp.c            |    3 +++
>  common/lcd.c                |   19 ++-----------------
>  common/splash.c             |   25 +++++++++++++++++++++++++
>  drivers/video/cfb_console.c |   24 ++----------------------
>  include/splash.h            |    7 +++++++
>  5 files changed, 39 insertions(+), 39 deletions(-)

Applied to u-boot-video/master. Thanks!

Anatolij

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-07-08 18:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06 17:57 [U-Boot] [PATCH] bmp: Respect "splashpos" if it is defined Otavio Salvador
2013-06-06 18:16 ` Otavio Salvador
2013-06-17 21:36 ` Otavio Salvador
2013-07-01 22:01 ` Anatolij Gustschin
2013-07-01 22:25   ` Otavio Salvador
2013-07-01 22:04 ` [U-Boot] [PATCH] video: consolidate splash screen alignment code Anatolij Gustschin
2013-07-01 22:24   ` Otavio Salvador
2013-07-08 18:47   ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox