From: Mark Jackson <mpfj@mimc.co.uk>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] Add 16bpp BMP support
Date: Tue, 27 Jan 2009 11:32:20 +0000 [thread overview]
Message-ID: <497EF0C4.3060907@mimc.co.uk> (raw)
This patch adds 16bpp BMP support to the common lcd code.
At the moment it's only been tested on the MIMC200 AVR32 board, but the hooks
are in place to extend this to other platforms.
Signed-off-by: Mark Jackson <mpfj@mimc.co.uk>
---
common/lcd.c | 55 +++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 45 insertions(+), 10 deletions(-)
diff --git a/common/lcd.c b/common/lcd.c
index ae79051..8cbb540 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -84,7 +84,7 @@ extern void lcd_enable (void);
static void *lcd_logo (void);
-#if LCD_BPP == LCD_COLOR8
+#if (LCD_BPP == LCD_COLOR8) || (LCD_BPP == LCD_COLOR16)
extern void lcd_setcolreg (ushort regno,
ushort red, ushort green, ushort blue);
#endif
@@ -656,7 +656,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
bpix = NBITS(panel_info.vl_bpix);
- if ((bpix != 1) && (bpix != 8)) {
+ if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
bpix);
return 1;
@@ -738,17 +738,52 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
fb = (uchar *) (lcd_base +
(y + height - 1) * lcd_line_length + x);
- for (i = 0; i < height; ++i) {
- WATCHDOG_RESET();
- for (j = 0; j < width ; j++)
+
+ switch (bpix) {
+ case 1: /* pass through */
+ case 8:
+ for (i = 0; i < height; ++i) {
+ WATCHDOG_RESET();
+ for (j = 0; j < width ; j++)
#if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD)
- *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
#elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200)
- *(fb++)=255-*(bmap++);
+ *(fb++)=255-*(bmap++);
#endif
- bmap += (width - padded_line);
- fb -= (width + lcd_line_length);
- }
+ bmap += (width - padded_line);
+ fb -= (width + lcd_line_length);
+ }
+ break;
+
+#if defined(CONFIG_PXA250)
+#error 16 bpp support not added for PXA250
+#elif defined(CONFIG_ATMEL_LCD)
+ case 16:
+ for (i = 0; i < height; ++i) {
+ WATCHDOG_RESET();
+ for (j = 0; j < width; j++) {
+#if defined(CONFIG_ATMEL_LCD_BGR555)
+ *(fb++) = ((bmap[0] & 0x1f) << 2) | (bmap[1] & 0x03);
+ *(fb++) = (bmap[0] & 0xe0) | ((bmap[1] & 0x7c) >> 2);
+ bmap += 2;
+#else
+ *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
+#endif
+ }
+ bmap += (padded_line - width) * 2;
+ fb -= (width * 2 + lcd_line_length);
+ }
+ break;
+#elif defined(CONFIG_MPC823)
+#error 16 bpp support not added for MPC823
+#elif defined(CONFIG_MCC200)
+#error 16 bpp support not added for MCC200
+#endif
+
+ default:
+ break;
+ };
return (0);
}
next reply other threads:[~2009-01-27 11:32 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-27 11:32 Mark Jackson [this message]
2009-01-27 12:15 ` [U-Boot] [PATCH v2] Add 16bpp BMP support Wolfgang Denk
2009-01-27 12:21 ` Mark Jackson
2009-01-27 12:56 ` Wolfgang Denk
2009-01-27 12:58 ` Mark Jackson
2009-01-27 12:58 ` [U-Boot] Reset command on u-boot command line not working Ajeesh Kumar
2009-01-27 13:16 ` Roman Mashak
2009-01-27 13:35 ` Ajeesh Kumar
2009-01-27 13:51 ` Wolfgang Denk
2009-01-27 14:13 ` Ajeesh Kumar
2009-01-27 14:33 ` Kumar Gala
2009-01-27 15:05 ` Jayakrishnan M
2009-01-29 2:48 ` Ajeesh Kumar
2009-01-27 14:53 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=497EF0C4.3060907@mimc.co.uk \
--to=mpfj@mimc.co.uk \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox