summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/video/Kconfig1
-rw-r--r--drivers/video/Makefile3
-rw-r--r--drivers/video/sandbox_sdl.c2
-rw-r--r--drivers/video/u_boot_logo.bmpbin0 -> 6932 bytes
-rw-r--r--drivers/video/video-uclass.c26
-rw-r--r--include/video.h2
-rw-r--r--scripts/Makefile.lib21
-rw-r--r--test/dm/video.c43
8 files changed, 89 insertions, 9 deletions
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7a73ecc1f4..e601b47806 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -17,6 +17,7 @@ config DM_VIDEO
config VIDEO_LOGO
bool "Show the U-Boot logo on the display"
depends on DM_VIDEO
+ select VIDEO_BMP_RLE8
help
This enables showing the U-Boot logo on the display when a video
device is probed. It appears at the top right. The logo itself is at
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 8956b5f9b0..4038395b12 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -17,6 +17,9 @@ obj-$(CONFIG_DM_VIDEO) += video_bmp.o
obj-$(CONFIG_PANEL) += panel-uclass.o
obj-$(CONFIG_DM_PANEL_HX8238D) += hx8238d.o
obj-$(CONFIG_SIMPLE_PANEL) += simple_panel.o
+
+obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.o
+
endif
obj-${CONFIG_EXYNOS_FB} += exynos/
diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c
index 2afe66fab1..9081c7da62 100644
--- a/drivers/video/sandbox_sdl.c
+++ b/drivers/video/sandbox_sdl.c
@@ -82,12 +82,14 @@ static void set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp)
int sandbox_sdl_set_bpp(struct udevice *dev, enum video_log2_bpp l2bpp)
{
+ struct video_uc_plat *uc_plat = dev_get_uclass_plat(dev);
int ret;
if (device_active(dev))
return -EINVAL;
sandbox_sdl_remove_display();
+ uc_plat->hide_logo = true;
set_bpp(dev, l2bpp);
ret = device_probe(dev);
diff --git a/drivers/video/u_boot_logo.bmp b/drivers/video/u_boot_logo.bmp
new file mode 100644
index 0000000000..47f1e9b997
--- /dev/null
+++ b/drivers/video/u_boot_logo.bmp
Binary files differ
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index a52b5d9323..7d499bcec5 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -319,6 +319,24 @@ int video_sync_copy_all(struct udevice *dev)
#endif
+#define SPLASH_DECL(_name) \
+ extern u8 __splash_ ## _name ## _begin[]; \
+ extern u8 __splash_ ## _name ## _end[]
+
+#define SPLASH_START(_name) __splash_ ## _name ## _begin
+
+SPLASH_DECL(u_boot_logo);
+
+static int show_splash(struct udevice *dev)
+{
+ u8 *data = SPLASH_START(u_boot_logo);
+ int ret;
+
+ ret = video_bmp_display(dev, map_to_sysmem(data), -4, 4, true);
+
+ return 0;
+}
+
/* Set up the display ready for use */
static int video_post_probe(struct udevice *dev)
{
@@ -384,6 +402,14 @@ static int video_post_probe(struct udevice *dev)
return ret;
}
+ if (IS_ENABLED(CONFIG_VIDEO_LOGO) && !plat->hide_logo) {
+ ret = show_splash(dev);
+ if (ret) {
+ log_debug("Cannot show splash screen\n");
+ return ret;
+ }
+ }
+
return 0;
};
diff --git a/include/video.h b/include/video.h
index 471b659d6b..1d75a90510 100644
--- a/include/video.h
+++ b/include/video.h
@@ -30,12 +30,14 @@ struct udevice;
* @base: Base address of frame buffer, 0 if not yet known
* @copy_base: Base address of a hardware copy of the frame buffer. See
* CONFIG_VIDEO_COPY.
+ * @hide_logo: Hide the logo (used for testing)
*/
struct video_uc_plat {
uint align;
uint size;
ulong base;
ulong copy_base;
+ bool hide_logo;
};
enum video_polarity {
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b4e63bc0ca..77ad282bbe 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -374,6 +374,27 @@ cmd_S_ttf= \
$(obj)/%.S: $(src)/%.ttf
$(call cmd,S_ttf)
+# Splash logos
+# ---------------------------------------------------------------------------
+
+# Generate an assembly file to wrap the splash data
+quiet_cmd_S_splash= TTF $@
+# Modified for U-Boot
+cmd_S_splash= \
+( \
+ echo '.section .rodata.splash.init,"a"'; \
+ echo '.balign 16'; \
+ echo '.global __splash_$(*F)_begin'; \
+ echo '__splash_$(*F)_begin:'; \
+ echo '.incbin "$<" '; \
+ echo '__splash_$(*F)_end:'; \
+ echo '.global __splash_$(*F)_end'; \
+ echo '.balign 16'; \
+) > $@
+
+$(obj)/%.S: $(src)/%.bmp
+ $(call cmd,S_splash)
+
# EFI applications
# A Makefile target *.efi is built as EFI application.
# A Makefile target *_efi.S wraps *.efi as built-in EFI application.
diff --git a/test/dm/video.c b/test/dm/video.c
index 4e76574a91..d4a3c9c6c1 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -115,6 +115,31 @@ static int select_vidconsole(struct unit_test_state *uts, const char *drv_name)
return 0;
}
+/**
+ * video_get_nologo() - Disable the logo on the video device and return it
+ *
+ * @uts: Test state
+ * @devp: Returns video device
+ * @return 0 if OK, -ve on error
+ */
+static int video_get_nologo(struct unit_test_state *uts, struct udevice **devp)
+{
+ struct video_uc_plat *uc_plat;
+ struct udevice *dev;
+
+ ut_assertok(uclass_find_first_device(UCLASS_VIDEO, &dev));
+ ut_assertnonnull(dev);
+ uc_plat = dev_get_uclass_plat(dev);
+ uc_plat->hide_logo = true;
+
+ /* now probe it */
+ ut_assertok(uclass_first_device_err(UCLASS_VIDEO, &dev));
+ ut_assertnonnull(dev);
+ *devp = dev;
+
+ return 0;
+}
+
/* Test text output works on the video console */
static int dm_test_video_text(struct unit_test_state *uts)
{
@@ -125,7 +150,7 @@ static int dm_test_video_text(struct unit_test_state *uts)
#define SCROLL_LINES 100
ut_assertok(select_vidconsole(uts, "vidconsole0"));
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_asserteq(46, compress_frame_buffer(uts, dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
@@ -157,7 +182,7 @@ static int dm_test_video_chars(struct unit_test_state *uts)
const char *test_string = "Well\b\b\b\bxhe is\r \n\ta very \amodest \bman\n\t\tand Has much to\b\bto be modest about.";
ut_assertok(select_vidconsole(uts, "vidconsole0"));
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
vidconsole_put_string(con, test_string);
ut_asserteq(466, compress_frame_buffer(uts, dev));
@@ -174,7 +199,7 @@ static int dm_test_video_ansi(struct unit_test_state *uts)
struct udevice *dev, *con;
ut_assertok(select_vidconsole(uts, "vidconsole0"));
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
/* reference clear: */
@@ -222,7 +247,7 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot,
plat = dev_get_plat(dev);
plat->rot = rot;
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
ut_asserteq(46, compress_frame_buffer(uts, dev));
@@ -311,7 +336,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts)
struct udevice *dev;
ulong addr;
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr));
ut_assertok(video_bmp_display(dev, addr, 0, 0, false));
@@ -433,7 +458,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts)
struct udevice *dev;
ulong addr;
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(read_file(uts, "tools/logos/denx-comp.bmp", &addr));
ut_assertok(video_bmp_display(dev, addr, 0, 0, false));
@@ -487,7 +512,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts)
struct udevice *dev, *con;
const char *test_string = "Criticism may not be agreeable, but it is necessary. It fulfils the same function as pain in the human body. It calls attention to an unhealthy state of things. Some see private enterprise as a predatory target to be shot, others as a cow to be milked, but few are those who see it as a sturdy horse pulling the wagon. The \aprice OF\b\bof greatness\n\tis responsibility.\n\nBye";
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
vidconsole_put_string(con, test_string);
ut_asserteq(12237, compress_frame_buffer(uts, dev));
@@ -508,7 +533,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts)
plat = dev_get_plat(dev);
plat->font_size = 100;
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
vidconsole_put_string(con, test_string);
ut_asserteq(35030, compress_frame_buffer(uts, dev));
@@ -529,7 +554,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts)
plat = dev_get_plat(dev);
plat->font_size = 100;
- ut_assertok(uclass_get_device(UCLASS_VIDEO, 0, &dev));
+ ut_assertok(video_get_nologo(uts, &dev));
ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con));
vidconsole_put_string(con, test_string);
ut_asserteq(29018, compress_frame_buffer(uts, dev));