Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2002 |
wdenk | b37c7e5 | 2003-06-30 16:24:52 +0000 | [diff] [blame] | 4 | * Detlev Zundel, DENX Software Engineering, dzu@denx.de. |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * BMP handling routines |
| 9 | */ |
| 10 | |
| 11 | #include <common.h> |
| 12 | #include <bmp_layout.h> |
| 13 | #include <command.h> |
Simon Glass | 0c670fc | 2019-08-01 09:46:36 -0600 | [diff] [blame] | 14 | #include <dm.h> |
| 15 | #include <gzip.h> |
Simon Glass | 8e8ccfe | 2019-12-28 10:45:03 -0700 | [diff] [blame] | 16 | #include <image.h> |
Simon Glass | 0c670fc | 2019-08-01 09:46:36 -0600 | [diff] [blame] | 17 | #include <lcd.h> |
Simon Glass | f7ae49f | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 18 | #include <log.h> |
Stefan Roese | c29ab9d | 2005-10-08 10:19:07 +0200 | [diff] [blame] | 19 | #include <malloc.h> |
Simon Glass | 72b335e | 2016-01-05 09:30:58 -0700 | [diff] [blame] | 20 | #include <mapmem.h> |
Anatolij Gustschin | ff8fb56 | 2013-07-02 00:04:05 +0200 | [diff] [blame] | 21 | #include <splash.h> |
Stefan Reinauer | f674f7c | 2012-09-28 15:11:11 +0000 | [diff] [blame] | 22 | #include <video.h> |
Simon Glass | 0c670fc | 2019-08-01 09:46:36 -0600 | [diff] [blame] | 23 | #include <asm/byteorder.h> |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 24 | |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 25 | static int bmp_info (ulong addr); |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 26 | |
| 27 | /* |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 28 | * Allocate and decompress a BMP image using gunzip(). |
| 29 | * |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 30 | * Returns a pointer to the decompressed image data. This pointer is |
| 31 | * aligned to 32-bit-aligned-address + 2. |
| 32 | * See doc/README.displaying-bmps for explanation. |
| 33 | * |
| 34 | * The allocation address is passed to 'alloc_addr' and must be freed |
| 35 | * by the caller after use. |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 36 | * |
| 37 | * Returns NULL if decompression failed, or if the decompressed data |
| 38 | * didn't contain a valid BMP signature. |
| 39 | */ |
| 40 | #ifdef CONFIG_VIDEO_BMP_GZIP |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 41 | struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, |
| 42 | void **alloc_addr) |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 43 | { |
| 44 | void *dst; |
| 45 | unsigned long len; |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 46 | struct bmp_image *bmp; |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 47 | |
| 48 | /* |
| 49 | * Decompress bmp image |
| 50 | */ |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 51 | len = CONFIG_SYS_VIDEO_LOGO_MAX_SIZE; |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 52 | /* allocate extra 3 bytes for 32-bit-aligned-address + 2 alignment */ |
| 53 | dst = malloc(CONFIG_SYS_VIDEO_LOGO_MAX_SIZE + 3); |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 54 | if (dst == NULL) { |
| 55 | puts("Error: malloc in gunzip failed!\n"); |
| 56 | return NULL; |
| 57 | } |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 58 | |
| 59 | bmp = dst; |
| 60 | |
| 61 | /* align to 32-bit-aligned-address + 2 */ |
Adam Heinrich | 7719521 | 2018-12-31 12:11:08 +0100 | [diff] [blame] | 62 | bmp = (struct bmp_image *)((((uintptr_t)dst + 1) & ~3) + 2); |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 63 | |
Simon Glass | 72b335e | 2016-01-05 09:30:58 -0700 | [diff] [blame] | 64 | if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0), |
| 65 | &len) != 0) { |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 66 | free(dst); |
| 67 | return NULL; |
| 68 | } |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 69 | if (len == CONFIG_SYS_VIDEO_LOGO_MAX_SIZE) |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 70 | puts("Image could be truncated" |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 71 | " (increase CONFIG_SYS_VIDEO_LOGO_MAX_SIZE)!\n"); |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 72 | |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 73 | /* |
| 74 | * Check for bmp mark 'BM' |
| 75 | */ |
| 76 | if (!((bmp->header.signature[0] == 'B') && |
| 77 | (bmp->header.signature[1] == 'M'))) { |
| 78 | free(dst); |
| 79 | return NULL; |
| 80 | } |
| 81 | |
Wolfgang Denk | 17f79e4 | 2011-02-09 15:11:10 +0100 | [diff] [blame] | 82 | debug("Gzipped BMP image detected!\n"); |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 83 | |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 84 | *alloc_addr = dst; |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 85 | return bmp; |
| 86 | } |
| 87 | #else |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 88 | struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, |
| 89 | void **alloc_addr) |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 90 | { |
| 91 | return NULL; |
| 92 | } |
| 93 | #endif |
| 94 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 95 | static int do_bmp_info(struct cmd_tbl *cmdtp, int flag, int argc, |
| 96 | char *const argv[]) |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 97 | { |
| 98 | ulong addr; |
| 99 | |
| 100 | switch (argc) { |
Simon Glass | bb872dd | 2019-12-28 10:45:02 -0700 | [diff] [blame] | 101 | case 1: /* use image_load_addr as default address */ |
| 102 | addr = image_load_addr; |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 103 | break; |
| 104 | case 2: /* use argument */ |
Simon Glass | 7e5f460 | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 105 | addr = hextoul(argv[1], NULL); |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 106 | break; |
| 107 | default: |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 108 | return CMD_RET_USAGE; |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | return (bmp_info(addr)); |
| 112 | } |
| 113 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 114 | static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc, |
| 115 | char *const argv[]) |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 116 | { |
| 117 | ulong addr; |
| 118 | int x = 0, y = 0; |
| 119 | |
Anatolij Gustschin | ff8fb56 | 2013-07-02 00:04:05 +0200 | [diff] [blame] | 120 | splash_get_pos(&x, &y); |
| 121 | |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 122 | switch (argc) { |
Simon Glass | bb872dd | 2019-12-28 10:45:02 -0700 | [diff] [blame] | 123 | case 1: /* use image_load_addr as default address */ |
| 124 | addr = image_load_addr; |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 125 | break; |
| 126 | case 2: /* use argument */ |
Simon Glass | 7e5f460 | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 127 | addr = hextoul(argv[1], NULL); |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 128 | break; |
| 129 | case 4: |
Simon Glass | 7e5f460 | 2021-07-24 09:03:29 -0600 | [diff] [blame] | 130 | addr = hextoul(argv[1], NULL); |
Patrick Delaunay | b0fcedb | 2018-12-01 14:41:07 +0100 | [diff] [blame] | 131 | if (!strcmp(argv[2], "m")) |
| 132 | x = BMP_ALIGN_CENTER; |
| 133 | else |
Simon Glass | 0b1284e | 2021-07-24 09:03:30 -0600 | [diff] [blame] | 134 | x = dectoul(argv[2], NULL); |
Patrick Delaunay | b0fcedb | 2018-12-01 14:41:07 +0100 | [diff] [blame] | 135 | if (!strcmp(argv[3], "m")) |
| 136 | y = BMP_ALIGN_CENTER; |
| 137 | else |
Simon Glass | 0b1284e | 2021-07-24 09:03:30 -0600 | [diff] [blame] | 138 | y = dectoul(argv[3], NULL); |
Wolfgang Denk | 93e1459 | 2013-10-04 17:43:24 +0200 | [diff] [blame] | 139 | break; |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 140 | default: |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 141 | return CMD_RET_USAGE; |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | return (bmp_display(addr, x, y)); |
| 145 | } |
| 146 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 147 | static struct cmd_tbl cmd_bmp_sub[] = { |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 148 | U_BOOT_CMD_MKENT(info, 3, 0, do_bmp_info, "", ""), |
| 149 | U_BOOT_CMD_MKENT(display, 5, 0, do_bmp_display, "", ""), |
| 150 | }; |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 151 | |
Wolfgang Denk | 2e5167c | 2010-10-28 20:00:11 +0200 | [diff] [blame] | 152 | #ifdef CONFIG_NEEDS_MANUAL_RELOC |
Heiko Schocher | f1d2b31 | 2010-09-17 13:10:39 +0200 | [diff] [blame] | 153 | void bmp_reloc(void) { |
| 154 | fixup_cmdtable(cmd_bmp_sub, ARRAY_SIZE(cmd_bmp_sub)); |
| 155 | } |
| 156 | #endif |
| 157 | |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 158 | /* |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 159 | * Subroutine: do_bmp |
| 160 | * |
| 161 | * Description: Handler for 'bmp' command.. |
| 162 | * |
| 163 | * Inputs: argv[1] contains the subcommand |
| 164 | * |
| 165 | * Return: None |
| 166 | * |
| 167 | */ |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 168 | static int do_bmp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 169 | { |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 170 | struct cmd_tbl *c; |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 171 | |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 172 | /* Strip off leading 'bmp' command argument */ |
| 173 | argc--; |
| 174 | argv++; |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 175 | |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 176 | c = find_cmd_tbl(argv[0], &cmd_bmp_sub[0], ARRAY_SIZE(cmd_bmp_sub)); |
| 177 | |
Wolfgang Denk | 47e26b1 | 2010-07-17 01:06:04 +0200 | [diff] [blame] | 178 | if (c) |
Frans Meulenbroeks | 9acd4f0 | 2010-03-27 11:16:10 +0100 | [diff] [blame] | 179 | return c->cmd(cmdtp, flag, argc, argv); |
Wolfgang Denk | 47e26b1 | 2010-07-17 01:06:04 +0200 | [diff] [blame] | 180 | else |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 181 | return CMD_RET_USAGE; |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 182 | } |
| 183 | |
wdenk | 0d49839 | 2003-07-01 21:06:45 +0000 | [diff] [blame] | 184 | U_BOOT_CMD( |
wdenk | 4b248f3 | 2004-03-14 16:51:43 +0000 | [diff] [blame] | 185 | bmp, 5, 1, do_bmp, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 186 | "manipulate BMP image data", |
wdenk | 4b248f3 | 2004-03-14 16:51:43 +0000 | [diff] [blame] | 187 | "info <imageAddr> - display image info\n" |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 188 | "bmp display <imageAddr> [x y] - display image at x,y" |
wdenk | b0fce99 | 2003-06-29 21:03:46 +0000 | [diff] [blame] | 189 | ); |
| 190 | |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 191 | /* |
| 192 | * Subroutine: bmp_info |
| 193 | * |
| 194 | * Description: Show information about bmp file in memory |
| 195 | * |
| 196 | * Inputs: addr address of the bmp file |
| 197 | * |
| 198 | * Return: None |
| 199 | * |
| 200 | */ |
| 201 | static int bmp_info(ulong addr) |
| 202 | { |
Simon Glass | 72b335e | 2016-01-05 09:30:58 -0700 | [diff] [blame] | 203 | struct bmp_image *bmp = (struct bmp_image *)map_sysmem(addr, 0); |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 204 | void *bmp_alloc_addr = NULL; |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 205 | unsigned long len; |
Stefan Roese | c29ab9d | 2005-10-08 10:19:07 +0200 | [diff] [blame] | 206 | |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 207 | if (!((bmp->header.signature[0]=='B') && |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 208 | (bmp->header.signature[1]=='M'))) |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 209 | bmp = gunzip_bmp(addr, &len, &bmp_alloc_addr); |
Stefan Roese | c29ab9d | 2005-10-08 10:19:07 +0200 | [diff] [blame] | 210 | |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 211 | if (bmp == NULL) { |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 212 | printf("There is no valid bmp file at the given address\n"); |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 213 | return 1; |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 214 | } |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 215 | |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 216 | printf("Image size : %d x %d\n", le32_to_cpu(bmp->header.width), |
| 217 | le32_to_cpu(bmp->header.height)); |
| 218 | printf("Bits per pixel: %d\n", le16_to_cpu(bmp->header.bit_count)); |
| 219 | printf("Compression : %d\n", le32_to_cpu(bmp->header.compression)); |
Stefan Roese | c29ab9d | 2005-10-08 10:19:07 +0200 | [diff] [blame] | 220 | |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 221 | if (bmp_alloc_addr) |
| 222 | free(bmp_alloc_addr); |
Stefan Roese | c29ab9d | 2005-10-08 10:19:07 +0200 | [diff] [blame] | 223 | |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 224 | return(0); |
| 225 | } |
| 226 | |
| 227 | /* |
| 228 | * Subroutine: bmp_display |
| 229 | * |
| 230 | * Description: Display bmp file located in memory |
| 231 | * |
| 232 | * Inputs: addr address of the bmp file |
| 233 | * |
| 234 | * Return: None |
| 235 | * |
| 236 | */ |
Anatolij Gustschin | de3b49c | 2012-04-27 04:38:06 +0000 | [diff] [blame] | 237 | int bmp_display(ulong addr, int x, int y) |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 238 | { |
Simon Glass | b01c792 | 2016-01-18 19:52:22 -0700 | [diff] [blame] | 239 | #ifdef CONFIG_DM_VIDEO |
| 240 | struct udevice *dev; |
| 241 | #endif |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 242 | int ret; |
Simon Glass | 72b335e | 2016-01-05 09:30:58 -0700 | [diff] [blame] | 243 | struct bmp_image *bmp = map_sysmem(addr, 0); |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 244 | void *bmp_alloc_addr = NULL; |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 245 | unsigned long len; |
| 246 | |
| 247 | if (!((bmp->header.signature[0]=='B') && |
| 248 | (bmp->header.signature[1]=='M'))) |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 249 | bmp = gunzip_bmp(addr, &len, &bmp_alloc_addr); |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 250 | |
| 251 | if (!bmp) { |
| 252 | printf("There is no valid bmp file at the given address\n"); |
| 253 | return 1; |
| 254 | } |
Simon Glass | 72b335e | 2016-01-05 09:30:58 -0700 | [diff] [blame] | 255 | addr = map_to_sysmem(bmp); |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 256 | |
Simon Glass | b01c792 | 2016-01-18 19:52:22 -0700 | [diff] [blame] | 257 | #ifdef CONFIG_DM_VIDEO |
Simon Glass | 3f603cb | 2016-02-11 13:23:26 -0700 | [diff] [blame] | 258 | ret = uclass_first_device_err(UCLASS_VIDEO, &dev); |
Simon Glass | b01c792 | 2016-01-18 19:52:22 -0700 | [diff] [blame] | 259 | if (!ret) { |
Simon Glass | 3f603cb | 2016-02-11 13:23:26 -0700 | [diff] [blame] | 260 | bool align = false; |
Simon Glass | b01c792 | 2016-01-18 19:52:22 -0700 | [diff] [blame] | 261 | |
Patrick Delaunay | b0fcedb | 2018-12-01 14:41:07 +0100 | [diff] [blame] | 262 | if (CONFIG_IS_ENABLED(SPLASH_SCREEN_ALIGN) || |
| 263 | x == BMP_ALIGN_CENTER || |
| 264 | y == BMP_ALIGN_CENTER) |
| 265 | align = true; |
| 266 | |
Simon Glass | 3f603cb | 2016-02-11 13:23:26 -0700 | [diff] [blame] | 267 | ret = video_bmp_display(dev, addr, x, y, align); |
Simon Glass | b01c792 | 2016-01-18 19:52:22 -0700 | [diff] [blame] | 268 | } |
Simon Glass | b01c792 | 2016-01-18 19:52:22 -0700 | [diff] [blame] | 269 | #elif defined(CONFIG_LCD) |
Simon Glass | 72b335e | 2016-01-05 09:30:58 -0700 | [diff] [blame] | 270 | ret = lcd_display_bitmap(addr, x, y); |
wdenk | 281e00a | 2004-08-01 22:48:16 +0000 | [diff] [blame] | 271 | #else |
Simon Glass | 1fa43ca | 2022-01-23 07:04:08 -0700 | [diff] [blame] | 272 | # error bmp_display() requires CONFIG_LCD |
wdenk | 4b248f3 | 2004-03-14 16:51:43 +0000 | [diff] [blame] | 273 | #endif |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 274 | |
Piotr Wilczek | f7ef9d6 | 2013-06-05 08:14:30 +0200 | [diff] [blame] | 275 | if (bmp_alloc_addr) |
| 276 | free(bmp_alloc_addr); |
Hans-Christian Egtvedt | 43ef1c3 | 2007-11-30 17:29:59 +0100 | [diff] [blame] | 277 | |
Simon Glass | e517db7 | 2016-01-30 15:45:15 -0700 | [diff] [blame] | 278 | return ret ? CMD_RET_FAILURE : 0; |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 279 | } |