* [U-Boot] [PATCH] video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB
@ 2010-08-23 21:58 Timur Tabi
2010-09-18 22:56 ` [U-Boot] [PATCH v2] " Anatolij Gustschin
0 siblings, 1 reply; 3+ messages in thread
From: Timur Tabi @ 2010-08-23 21:58 UTC (permalink / raw)
To: u-boot
Add support for 4bpp bitmaps, but only when writing to a GDF_32BIT_X888RGB.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
I only added support for GDF_32BIT_X888RGB because that's the only mode
that my video device supports in U-Boot. I wouldn't be able to test any
other mode, and it took a lot of trial and error to get this one mode working
correctly.
drivers/video/cfb_console.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index fae5417..1d52819 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1114,8 +1114,32 @@ int video_display_bitmap (ulong bmp_image, int x, int y)
}
#endif
- /* We handle only 8bpp or 24 bpp bitmap */
+ /* We handle only 4, 8, or 24 bpp bitmaps */
switch (le16_to_cpu (bmp->header.bit_count)) {
+ case 4:
+ padded_line -= width / 2;
+ ycount = height;
+
+ switch (VIDEO_DATA_FORMAT) {
+ case GDF_32BIT_X888RGB:
+ while (ycount--) {
+ WATCHDOG_RESET ();
+ /* Don't assume that 'width' is an even number */
+ for (xcount = 0; xcount < width; xcount++) {
+ if (xcount & 1) {
+ cte = bmp->color_table[*bmap & 0xF];
+ bmap++;
+ } else
+ cte = bmp->color_table[*bmap >> 4];
+ FILL_32BIT_X888RGB(cte.red, cte.green, cte.blue);
+ }
+ bmap += padded_line;
+ fb -= (VIDEO_VISIBLE_COLS + width) * VIDEO_PIXEL_SIZE;
+ }
+ break;
+ }
+ break;
+
case 8:
padded_line -= width;
if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX) {
--
1.7.0.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB
2010-08-23 21:58 [U-Boot] [PATCH] video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB Timur Tabi
@ 2010-09-18 22:56 ` Anatolij Gustschin
2010-09-18 23:08 ` Anatolij Gustschin
0 siblings, 1 reply; 3+ messages in thread
From: Anatolij Gustschin @ 2010-09-18 22:56 UTC (permalink / raw)
To: u-boot
From: Timur Tabi <timur@freescale.com>
Add support for 4bpp bitmaps, currently only for GDF_32BIT_X888RGB
frame buffer format.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Hi Timur,
I slighlty modified original patch, the result is this v2.
Hope this is okay.
Anatolij
v2:
- slightly changed commit message
- fixed too long lines (> 80)
- added info output about unsupported frame buffer formats
drivers/video/cfb_console.c | 38 +++++++++++++++++++++++++++++++++++++-
1 files changed, 37 insertions(+), 1 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 3d047f2..dd849c2 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1118,8 +1118,44 @@ int video_display_bitmap (ulong bmp_image, int x, int y)
}
#endif
- /* We handle only 8bpp or 24 bpp bitmap */
+ /* We handle only 4, 8, or 24 bpp bitmaps */
switch (le16_to_cpu (bmp->header.bit_count)) {
+ case 4:
+ padded_line -= width / 2;
+ ycount = height;
+
+ switch (VIDEO_DATA_FORMAT) {
+ case GDF_32BIT_X888RGB:
+ while (ycount--) {
+ WATCHDOG_RESET ();
+ /*
+ * Don't assume that 'width' is an
+ * even number
+ */
+ for (xcount = 0; xcount < width; xcount++) {
+ uchar idx;
+
+ if (xcount & 1) {
+ idx = *bmap & 0xF;
+ bmap++;
+ } else
+ idx = *bmap >> 4;
+ cte = bmp->color_table[idx];
+ FILL_32BIT_X888RGB(cte.red, cte.green,
+ cte.blue);
+ }
+ bmap += padded_line;
+ fb -= (VIDEO_VISIBLE_COLS + width) *
+ VIDEO_PIXEL_SIZE;
+ }
+ break;
+ default:
+ puts("4bpp bitmap unsupported with current "
+ "video mode\n");
+ break;
+ }
+ break;
+
case 8:
padded_line -= width;
if (VIDEO_DATA_FORMAT == GDF__8BIT_INDEX) {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH v2] video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB
2010-09-18 22:56 ` [U-Boot] [PATCH v2] " Anatolij Gustschin
@ 2010-09-18 23:08 ` Anatolij Gustschin
0 siblings, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2010-09-18 23:08 UTC (permalink / raw)
To: u-boot
On Sun, 19 Sep 2010 00:56:37 +0200
Anatolij Gustschin <agust@denx.de> wrote:
> From: Timur Tabi <timur@freescale.com>
>
> Add support for 4bpp bitmaps, currently only for GDF_32BIT_X888RGB
> frame buffer format.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
> Hi Timur,
>
> I slighlty modified original patch, the result is this v2.
> Hope this is okay.
>
> Anatolij
>
> v2:
> - slightly changed commit message
> - fixed too long lines (> 80)
> - added info output about unsupported frame buffer formats
>
> drivers/video/cfb_console.c | 38 +++++++++++++++++++++++++++++++++++++-
> 1 files changed, 37 insertions(+), 1 deletions(-)
Applied to u-boot-video/next, thanks!
Best regards,
Anatolij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-18 23:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-23 21:58 [U-Boot] [PATCH] video: cfb_console: add support for 4bpp bitmaps with GDF_32BIT_X888RGB Timur Tabi
2010-09-18 22:56 ` [U-Boot] [PATCH v2] " Anatolij Gustschin
2010-09-18 23:08 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox