From b01c7923e3923680d9389bcd7cf5ad2e5f083e30 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:22 -0700 Subject: dm: video: Implement the bmp command for driver model This command can use the bitmap display code in the uclass. This is similar to the code in lcd.c and cfb_console.c. These other copies will go away when all boards are converted to use driver model for video. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- common/cmd_bmp.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index f04b7d4..fd5b7db 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -10,7 +10,9 @@ */ #include +#include #include +#include #include #include #include @@ -225,6 +227,9 @@ static int bmp_info(ulong addr) */ int bmp_display(ulong addr, int x, int y) { +#ifdef CONFIG_DM_VIDEO + struct udevice *dev; +#endif int ret; struct bmp_image *bmp = map_sysmem(addr, 0); void *bmp_alloc_addr = NULL; @@ -240,7 +245,22 @@ int bmp_display(ulong addr, int x, int y) } addr = map_to_sysmem(bmp); -#if defined(CONFIG_LCD) +#ifdef CONFIG_DM_VIDEO + ret = uclass_first_device(UCLASS_VIDEO, &dev); + if (!ret) { + if (!dev) + ret = -ENODEV; + if (!ret) { + bool align = false; + +# ifdef CONFIG_SPLASH_SCREEN_ALIGN + align = true; +# endif /* CONFIG_SPLASH_SCREEN_ALIGN */ + ret = video_bmp_display(dev, addr, x, y, align); + } + } + return ret ? CMD_RET_FAILURE : 0; +#elif defined(CONFIG_LCD) ret = lcd_display_bitmap(addr, x, y); #elif defined(CONFIG_VIDEO) ret = video_display_bitmap(addr, x, y); -- cgit v1.1