[U-Boot] [PATCH] Add splash screen support via loading from flash

Signed-off-by: Robert Winkler robert.winkler@boundarydevices.com --- board/boundary/nitrogen6x/nitrogen6x.c | 22 ++++++++++++++++++++++ include/configs/nitrogen6x.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 3b228cf..648b877 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -401,6 +401,24 @@ int board_eth_init(bd_t *bis) return 0; }
+ +void splash_screen_prepare(void) +{ + char *env_loadsplash; + + if (!getenv("splashimage") || !getenv("splashsize")) + return; + + env_loadsplash = getenv("loadsplash"); + if (!env_loadsplash) { + printf("Environment variable loadsplash not found!\n"); + return; + } + + if (run_command_list(env_loadsplash, -1, 0)) + printf("failed to run loadsplash %s\n\n", env_loadsplash); +} + static void setup_buttons(void) { imx_iomux_v3_setup_multiple_pads(button_pads, @@ -661,6 +679,10 @@ int board_video_skip(void) printf("unsupported panel %s\n", panel); ret = -EINVAL; } + + if (!ret) + splash_screen_prepare(); + return (0 != ret); }
diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h index 2c904d3..011666f 100644 --- a/include/configs/nitrogen6x.h +++ b/include/configs/nitrogen6x.h @@ -38,7 +38,7 @@ #define CONFIG_REVISION_TAG
/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (10 * 1024 * 1024) +#define CONFIG_SYS_MALLOC_LEN (12 * 1024 * 1024)
#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_MISC_INIT_R @@ -151,6 +151,13 @@ #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE #define CONFIG_VIDEO_BMP_RLE8 #define CONFIG_SPLASH_SCREEN +#define CONFIG_SPLASH_SCREEN_ALIGN + + #define CONFIG_VIDEO_BMP_GZIP +#ifdef CONFIG_VIDEO_BMP_GZIP +#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (6 * 1024 * 1024) +#endif + #define CONFIG_BMP_16BPP #define CONFIG_VIDEO_LOGO #define CONFIG_IPUV3_CLK 260000000 @@ -211,5 +218,7 @@ "echo details at http://boundarydevices.com/6q_bootscript ; " \ "setenv stdout serial\0" \ + "loadsplash=if sf probe ; then " \ + "sf read ${splashimage} c2000 ${splashsize} ; fi\0" \ "upgradeu=for dtype in " CONFIG_DRIVE_TYPES \ "; do " \ "for disk in 0 1 ; do ${dtype} dev ${disk} ;" \

Dear Robert Winkler,
In message 1369947781-25077-1-git-send-email-robert.winkler@boundarydevices.com you wrote:
Signed-off-by: Robert Winkler robert.winkler@boundarydevices.com
board/boundary/nitrogen6x/nitrogen6x.c | 22 ++++++++++++++++++++++ include/configs/nitrogen6x.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
Could you please explain why you need custom code here?
What exactly cannot be done wioth the existing features?
BTW: it would be nice if you flag board specific code in the Subject:, and it is considered mandatory to Cc: the respective board maintainer.
Best regards,
Wolfgang Denk

On Thu, May 30, 2013 at 4:32 PM, Wolfgang Denk wd@denx.de wrote:
Dear Robert Winkler,
In message < 1369947781-25077-1-git-send-email-robert.winkler@boundarydevices.com> you wrote:
Signed-off-by: Robert Winkler robert.winkler@boundarydevices.com
board/boundary/nitrogen6x/nitrogen6x.c | 22 ++++++++++++++++++++++ include/configs/nitrogen6x.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
Could you please explain why you need custom code here?
I originally tried to use the CONFIG_SPLASH_SCREEN_PREPARE functionality. After some frustration, I figured out that without CONFIG_LCD, it is never actually called. http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=common/stdio.c;h=5d5117...
It does seem odd that there are 2 totally different paths and the other splash screen related macros are used in both but the prepare function is only called in the LCD case.
Since we use CONFIG_VIDEO and not CONFIG_LCD, this seemed to be the best, or at least the least invasive, solution.
What exactly cannot be done wioth the existing features?
BTW: it would be nice if you flag board specific code in the Subject:, and it is considered mandatory to Cc: the respective board maintainer.
I apologize for that. I'm new and didn't know till after I'd already sent it. I did CC the board maintainer, Eric. We also went over the code in person.
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de Doubt isn't the opposite of faith; it is an element of faith.
- Paul Tillich, German theologian and historian

Dear Robert,
In message CAMDMJ5PJ_AqZaxTRdnvS8ju_SkVHV7zoDrBUyhgjt2jfr4Ok4Q@mail.gmail.com you wrote:
board/boundary/nitrogen6x/nitrogen6x.c | 22 ++++++++++++++++++++++ include/configs/nitrogen6x.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
Could you please explain why you need custom code here?
I originally tried to use the CONFIG_SPLASH_SCREEN_PREPARE functionality. After some frustration, I figured out that without CONFIG_LCD, it is never actually called. http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=common/stdio.c;h=5d5117...
It does seem odd that there are 2 totally different paths and the other splash screen related macros are used in both but the prepare function is only called in the LCD case.
OK, so this is a bug that needs to be fixed - but for all boards.
Since we use CONFIG_VIDEO and not CONFIG_LCD, this seemed to be the best, or at least the least invasive, solution.
No, this is definitely not the "best" solution, as it keeps the bug, so the next one who tries to do what you are doing will run into it again.
Pleast let's fix the problem at the cause.
Please fix the video code to also run splash_screen_prepare() at the appropriate place. While you are at it, please also replace this construct
1071 #ifdef CONFIG_SPLASH_SCREEN_PREPARE 1072 static inline int splash_screen_prepare(void) 1073 { 1074 return board_splash_screen_prepare(); 1075 } 1076 #else 1077 static inline int splash_screen_prepare(void) 1078 { 1079 return 0; 1080 } 1081 #endif
(in "common/lcd.c") and use a "weak" function for splash_screen_prepare(). board_splash_screen_prepare() is no longer needed, then (the boards can provide their own implementation of splash_screen_prepare()).
Thanks.
Best regards,
Wolfgang Denk

On Fri, May 31, 2013 at 12:49 AM, Wolfgang Denk wd@denx.de wrote:
Dear Robert,
In message CAMDMJ5PJ_AqZaxTRdnvS8ju_SkVHV7zoDrBUyhgjt2jfr4Ok4Q@mail.gmail.com you wrote:
board/boundary/nitrogen6x/nitrogen6x.c | 22 ++++++++++++++++++++++ include/configs/nitrogen6x.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
Could you please explain why you need custom code here?
I originally tried to use the CONFIG_SPLASH_SCREEN_PREPARE functionality. After some frustration, I figured out that without CONFIG_LCD, it is never actually called. http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=common/stdio.c;h=5d5117...
It does seem odd that there are 2 totally different paths and the other splash screen related macros are used in both but the prepare function is only called in the LCD case.
OK, so this is a bug that needs to be fixed - but for all boards.
Since we use CONFIG_VIDEO and not CONFIG_LCD, this seemed to be the best, or at least the least invasive, solution.
No, this is definitely not the "best" solution, as it keeps the bug, so the next one who tries to do what you are doing will run into it again.
Pleast let's fix the problem at the cause.
Please fix the video code to also run splash_screen_prepare() at the appropriate place. While you are at it, please also replace this construct
1071 #ifdef CONFIG_SPLASH_SCREEN_PREPARE 1072 static inline int splash_screen_prepare(void) 1073 { 1074 return board_splash_screen_prepare(); 1075 } 1076 #else 1077 static inline int splash_screen_prepare(void) 1078 { 1079 return 0; 1080 } 1081 #endif
(in "common/lcd.c") and use a "weak" function for splash_screen_prepare(). board_splash_screen_prepare() is no longer needed, then (the boards can provide their own implementation of splash_screen_prepare()).
I'm not quite clear on how it should be.
So if I were just fixing lcd.c to use a weak function it would look like this: #ifdef CONFIG_SPLASH_SCREEN_PREPARE int __splash_screen_prepare(void) { return 0; }
int splash_screen_prepare(void) __attribute__ ((weak, alias("__splash_screen_prepare"))); #endif
But it'd also have to go in cfb_console.c. Is it possible for a board to ever use both CONFIG_LCD and CONFIG_VIDEO and if ?
Also are prototypes necessary? Looking at cfb_console for example weak functions I see a prototype for video_set_lut in video_fb.h but I can't find any for board_video_skip.
Thanks.
Best regards,
Wolfgang Denk
-- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de Es ist offensichtlich, dass das menschliche Gehirn wie ein Computer funktioniert. Da es keine dummen Computer gibt, gibt es also auch keine dummen Menschen. Nur ein paar Leute, die unter DOS laufen. -- <unbekannt>
Thanks,
Robert Winkler

Hi Robert,
On 30/05/2013 23:03, Robert Winkler wrote:
Signed-off-by: Robert Winkler robert.winkler@boundarydevices.com
board/boundary/nitrogen6x/nitrogen6x.c | 22 ++++++++++++++++++++++ include/configs/nitrogen6x.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 3b228cf..648b877 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -401,6 +401,24 @@ int board_eth_init(bd_t *bis) return 0; }
+void splash_screen_prepare(void) +{
- char *env_loadsplash;
- if (!getenv("splashimage") || !getenv("splashsize"))
return;
- env_loadsplash = getenv("loadsplash");
- if (!env_loadsplash) {
printf("Environment variable loadsplash not found!\n");
return;
- }
- if (run_command_list(env_loadsplash, -1, 0))
printf("failed to run loadsplash %s\n\n", env_loadsplash);
+}
Which is the advantage instead of using the "preboot" variable setting CONFIG_PREBOOT ? It does pretty the same and you can move the whole script outside of board code.
Best regards, Stefano Babic

Hello Stefano
On Mon, Jun 3, 2013 at 12:44 AM, Stefano Babic sbabic@denx.de wrote:
Hi Robert,
On 30/05/2013 23:03, Robert Winkler wrote:
Signed-off-by: Robert Winkler robert.winkler@boundarydevices.com
board/boundary/nitrogen6x/nitrogen6x.c | 22 ++++++++++++++++++++++ include/configs/nitrogen6x.h | 11 ++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 3b228cf..648b877 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -401,6 +401,24 @@ int board_eth_init(bd_t *bis) return 0; }
+void splash_screen_prepare(void) +{
char *env_loadsplash;
if (!getenv("splashimage") || !getenv("splashsize"))
return;
env_loadsplash = getenv("loadsplash");
if (!env_loadsplash) {
printf("Environment variable loadsplash not found!\n");
return;
}
if (run_command_list(env_loadsplash, -1, 0))
printf("failed to run loadsplash %s\n\n", env_loadsplash);
+}
Which is the advantage instead of using the "preboot" variable setting CONFIG_PREBOOT ? It does pretty the same and you can move the whole script outside of board code.
The preboot command is run too late. It looks like it is run in main_loop but U-Boot looks for the splash image at the address in the splashimage variable in board_init_r -> stdio_init -> drv_lcd_init or drv_video_init (depending on whether you have CONFIG_LCD or CONFIG_VIDEO).
I have a patch ready that will fix the underlying problem with CONFIG_SPLASH_SCREEN_PREPARE not working for CONFIG_VIDEO so the nitrogen specific code (in a separate patch of course) will change to use the provided callback instead of just calling it in our own board_video_skip, but other than that it'll be the same as the patch I already submitted.
Best regards, Stefano Babic
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic@denx.de =====================================================================
Thanks,
Robert Winkler

Hi Robert,
On 03/06/2013 18:34, Robert Winkler wrote:
Which is the advantage instead of using the "preboot" variable setting CONFIG_PREBOOT ? It does pretty the same and you can move the whole script outside of board code.
The preboot command is run too late. It looks like it is run in main_loop but U-Boot looks for the splash image at the address in the splashimage variable in board_init_r -> stdio_init -> drv_lcd_init or drv_video_init (depending on whether you have CONFIG_LCD or CONFIG_VIDEO).
You are describing a bug - then it should be fixed globally, not only for this board.
Best regards, Stefano Babic

Hi Stefano,
On 06/04/2013 06:44 AM, Stefano Babic wrote:
Hi Robert,
On 03/06/2013 18:34, Robert Winkler wrote:
Which is the advantage instead of using the "preboot" variable setting CONFIG_PREBOOT ? It does pretty the same and you can move the whole script outside of board code.
The preboot command is run too late. It looks like it is run in main_loop but U-Boot looks for the splash image at the address in the splashimage variable in board_init_r -> stdio_init -> drv_lcd_init or drv_video_init (depending on whether you have CONFIG_LCD or CONFIG_VIDEO).
You are describing a bug - then it should be fixed globally, not only for this board.
What's the bug? - preboot being called too late, or - splash_screen_prepare() being called too early
It seems that having splash_screen_prepare() called early makes sense, because stdout could be set to include VGA and having access to stdout is very useful in preboot commands.
Please advise,
Eric

Hi Eric,
On 04/06/2013 15:55, Eric Nelson wrote:
Hi Stefano,
On 06/04/2013 06:44 AM, Stefano Babic wrote:
Hi Robert,
On 03/06/2013 18:34, Robert Winkler wrote:
Which is the advantage instead of using the "preboot" variable setting CONFIG_PREBOOT ? It does pretty the same and you can move the whole script outside of board code.
The preboot command is run too late. It looks like it is run in main_loop but U-Boot looks for the splash image at the address in the splashimage variable in board_init_r -> stdio_init -> drv_lcd_init or drv_video_init (depending on whether you have CONFIG_LCD or CONFIG_VIDEO).
You are describing a bug - then it should be fixed globally, not only for this board.
What's the bug? - preboot being called too late, or
preboot is not called too late. The behavior is correct and wanted, as the name says, and the variable is evaluated during the main loop before booting. My suggestion comes because it is possible to implement a splashscreen (even if the name can be misleading..), setting preboot to something like "nand read <address> <offset>;bmp display <address>". In your case (with a bmp image), it could be: "preboot=if sf probe ; then " \ "sf read ${splashimage} c2000 ${splashsize} ; bmp display ${splashimage}; fi\0"
The behavior is exactly as the subject in the patch, the delay is from power-on until main loop is called. It can be on some boards acceptable, sometimes not.
- splash_screen_prepare() being called too early
It seems that having splash_screen_prepare() called early makes sense, because stdout could be set to include VGA and having access to stdout is very useful in preboot commands.
You mention that it does not work, and then I assume that it is a bug, because an image should be displayed. But again, if it does not work, the issue is related to the video subsystem and should be fixed there and not in board code - this is my point.
Best regards, Stefano Babic

Hi Stefano,
On 06/04/2013 07:15 AM, Stefano Babic wrote:
Hi Eric,
On 04/06/2013 15:55, Eric Nelson wrote:
Hi Stefano,
On 06/04/2013 06:44 AM, Stefano Babic wrote:
Hi Robert,
On 03/06/2013 18:34, Robert Winkler wrote:
Which is the advantage instead of using the "preboot" variable setting CONFIG_PREBOOT ? It does pretty the same and you can move the whole script outside of board code.
The preboot command is run too late. It looks like it is run in main_loop but U-Boot looks for the splash image at the address in the splashimage variable in board_init_r -> stdio_init -> drv_lcd_init or drv_video_init (depending on whether you have CONFIG_LCD or CONFIG_VIDEO).
You are describing a bug - then it should be fixed globally, not only for this board.
What's the bug? - preboot being called too late, or
preboot is not called too late. The behavior is correct and wanted, as the name says, and the variable is evaluated during the main loop before booting. My suggestion comes because it is possible to implement a splashscreen (even if the name can be misleading..), setting preboot to something like "nand read <address> <offset>;bmp display <address>". In your case (with a bmp image), it could be: "preboot=if sf probe ; then " \ "sf read ${splashimage} c2000 ${splashsize} ; bmp display ${splashimage}; fi\0"
The behavior is exactly as the subject in the patch, the delay is from power-on until main loop is called. It can be on some boards acceptable, sometimes not.
Gotcha. This method doesn't involve splash_screen_prepare() though.
It also will blink the display since the splash screen will paint after the the compiled-in logo case. http://git.denx.de/u-boot.git/?p=u-boot.git;a=blob;f=common/lcd.c#l1085
- splash_screen_prepare() being called too early
It seems that having splash_screen_prepare() called early makes sense, because stdout could be set to include VGA and having access to stdout is very useful in preboot commands.
You mention that it does not work, and then I assume that it is a bug, because an image should be displayed. But again, if it does not work, the issue is related to the video subsystem and should be fixed there and not in board code - this is my point.
This works with Robert's latest patch, which implements splash_screen_prepare() for boards that use cfb_console.
It just wasn't implemented there.
Regards,
Eric

Stefano
On Tue, Jun 4, 2013 at 7:30 AM, Eric Nelson eric.nelson@boundarydevices.com wrote:
Hi Stefano,
On 06/04/2013 07:15 AM, Stefano Babic wrote:
Hi Eric,
On 04/06/2013 15:55, Eric Nelson wrote:
Hi Stefano,
On 06/04/2013 06:44 AM, Stefano Babic wrote:
Hi Robert,
On 03/06/2013 18:34, Robert Winkler wrote:
Which is the advantage instead of using the "preboot" variable setting CONFIG_PREBOOT ? It does pretty the same and you can move the whole script outside of board code.
The preboot command is run too late. It looks like it is run in main_loop but U-Boot looks for the splash image at the address in the splashimage variable in board_init_r -> stdio_init -> drv_lcd_init or drv_video_init (depending on whether you have CONFIG_LCD or CONFIG_VIDEO).
You are describing a bug - then it should be fixed globally, not only for this board.
What's the bug? - preboot being called too late, or
preboot is not called too late. The behavior is correct and wanted, as the name says, and the variable is evaluated during the main loop before booting. My suggestion comes because it is possible to implement a splashscreen (even if the name can be misleading..), setting preboot to something like "nand read <address> <offset>;bmp display <address>". In your case (with a bmp image), it could be: "preboot=if sf probe ; then " \ "sf read ${splashimage} c2000 ${splashsize} ; bmp display ${splashimage}; fi\0"
The behavior is exactly as the subject in the patch, the delay is from power-on until main loop is called. It can be on some boards acceptable, sometimes not.
Gotcha. This method doesn't involve splash_screen_prepare() though.
It also will blink the display since the splash screen will paint after the the compiled-in logo case.
http://git.denx.de/u-boot.git/?p=u-boot.git;a=blob;f=common/lcd.c#l1085
- splash_screen_prepare() being called too early
It seems that having splash_screen_prepare() called early makes sense, because stdout could be set to include VGA and having access to stdout is very useful in preboot commands.
You mention that it does not work, and then I assume that it is a bug, because an image should be displayed. But again, if it does not work, the issue is related to the video subsystem and should be fixed there and not in board code - this is my point.
Yes, as Eric mentioned I submitted a patch yesterday which fixes splash screen prepare not working with CONFIG_VIDEO and will submit a separate patch to add the function to nitrogen6x.c once that goes through.
The only difference is that we won't call it in board_video_skip in nitrogen6x.c, it'll be called in drv_video_init similar to the way it is called in lcd_logo from drv_lcd_init.
Another thing that Eric pointed out that is a difference between PREBOOT and SPLASH_SCREEN_PREPARE is the former will always run but the latter will only run if there's a display which is preferable.
If I had submitted the fix first instead of just working around the bug I would probably have saved some confusion. Sorry about that.
This works with Robert's latest patch, which implements splash_screen_prepare() for boards that use cfb_console.
It just wasn't implemented there.
Regards,
Eric

Hi Robert,
On 04/06/2013 16:57, Robert Winkler wrote:
Yes, as Eric mentioned I submitted a patch yesterday which fixes splash screen prepare not working with CONFIG_VIDEO and will submit a separate patch to add the function to nitrogen6x.c once that goes through.
Ok, understood.
The only difference is that we won't call it in board_video_skip in nitrogen6x.c, it'll be called in drv_video_init similar to the way it is called in lcd_logo from drv_lcd_init.
Another thing that Eric pointed out that is a difference between PREBOOT and SPLASH_SCREEN_PREPARE is the former will always run but the latter will only run if there's a display which is preferable.
If I had submitted the fix first instead of just working around the bug I would probably have saved some confusion. Sorry about that.
No worry - thanks for explanation, now we have better understood the issue.
Best regards, Stefano

Hi Eric,
On 04/06/2013 16:30, Eric Nelson wrote:
Gotcha. This method doesn't involve splash_screen_prepare() though.
It also will blink the display since the splash screen will paint after the the compiled-in logo case. http://git.denx.de/u-boot.git/?p=u-boot.git;a=blob;f=common/lcd.c#l1085
Right, this methods has drawbacks in your case.
Stefano
participants (4)
-
Eric Nelson
-
Robert Winkler
-
Stefano Babic
-
Wolfgang Denk