video: Provide a command to list built-in images

Add a new 'video images' command which lists the graphical images that
are compiled into U-Boot. Generally the only one is the logo.

Series-to: concept
Series-cc: heinrich
Cover-letter:
video: Tidy up embedded graphical images
U-Boot includes a few graphical images which are compiled in, such as
the logo and the BGRT logo used for EFI.

At present these are handled by a Makefile rule which looks for files
ending with '_logo.bmp'.

This series moves these into a new drivers/video/images directory and
puts them in a linker list, so it is possible to see what images are
available.

Adding a new image is simpler, just requiring the addition of the normal
'obj-y += file.bmp' rule.

This series also adds a new 'video' command which provides the existing
'setcurs' and 'lcdputs' as subcommands, along with documentation and
tests.

It also adds a more convenient 'write' subcommand.

END
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 2:44 1:43
Series-version: 3
This commit is contained in:
Simon Glass
2025-10-01 15:17:30 -06:00
parent ed6674e5be
commit 366ae61115
3 changed files with 64 additions and 3 deletions

View File

@@ -8,6 +8,7 @@
#include <command.h>
#include <dm.h>
#include <linker_lists.h>
#include <video.h>
#include <video_console.h>
@@ -100,6 +101,29 @@ static int do_video_write(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
static int do_video_images(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
struct video_image *image;
int count, i;
image = ll_entry_start(struct video_image, video_image);
count = ll_entry_count(struct video_image, video_image);
printf("%-20s %10s\n", "Name", "Size");
printf("%-20s %10s\n", "--------------------", "----------");
for (i = 0; i < count; i++, image++) {
ulong size = (ulong)image->end - (ulong)image->begin;
printf("%-20s %10lu\n", image->name, size);
}
printf("\nTotal images: %d\n", count);
return 0;
}
U_BOOT_CMD(
setcurs, 3, 1, do_video_setcursor,
"set cursor position within screen",
@@ -116,9 +140,11 @@ U_BOOT_LONGHELP(video,
"setcursor <col> <row> - Set cursor position\n"
"video puts <string> - Write string at current position\n"
"video write [-p] [<col>:<row> <string>]... - Write strings at specified positions\n"
" -p: Use pixel coordinates instead of character positions");
" -p: Use pixel coordinates instead of character positions\n"
"video images - List images compiled into U-Boot");
U_BOOT_CMD_WITH_SUBCMDS(video, "Video commands", video_help_text,
U_BOOT_SUBCMD_MKENT(setcursor, 3, 1, do_video_setcursor),
U_BOOT_SUBCMD_MKENT(puts, 2, 1, do_video_puts),
U_BOOT_SUBCMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_video_write));
U_BOOT_SUBCMD_MKENT(write, CONFIG_SYS_MAXARGS, 1, do_video_write),
U_BOOT_SUBCMD_MKENT(images, 1, 1, do_video_images));