public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Wired cursor colors....
@ 2014-03-21 12:17 Reinhard Arlt
  0 siblings, 0 replies; 2+ messages in thread
From: Reinhard Arlt @ 2014-03-21 12:17 UTC (permalink / raw)
  To: u-boot

Hello,

if have updated the u-boot for the cpci750 recently.

If i use the console on the CPCI-DVI VGA graphic board, i now get 
strange coursor colors.

I have investigated the problem, and find out, that with commit

03d31fcf4c37d90a00e66f06b38742960139f090

video: cfb_console: Make the software cursor non-destructive

the software cursor handling is change dramatic.

I my opinion, it is broken now for most pixel format.

The routine

static void video_invertchar(int xx, int yy)

handle only framebuffer with 8 bit data per pixel, and if even in 8 bit 
per pixel mode, it do not work for, if you use GDF__8BIT_332RGB mode.

In GDF__8BIT_INDEX mode, there are only entries in the CLUT for index 
0x00  and 0x01. So inverting a pixel from 0x00 to 0xff results in 
displaying typical uninitialized CLUT entry, so we get a cursor with a 
random color.

I do not have graphic hardware to test all possible cases for a tested 
patch, so how can we proceed fix this problem?

In GDF__8BIT_INDEX mode, the correct handling would be

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 904caf7..344d2b6 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -620,7 +620,11 @@ static void video_invertchar(int xx, int yy)
  	for (y = firsty; y < lasty; y += VIDEO_LINE_LEN) {
  		for (x = firstx; x < lastx; x++) {
  			u8 *dest = (u8 *)(video_fb_address) + x + y;
+#if 0
  			*dest = ~*dest;
+#else
+			*dest ^= 0x01;
+#endif
  		}
  	}
  }

but this break all other graphic mode of course.

Kind regards

Reinhard Arlt

^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [U-Boot] Wired cursor colors....
@ 2014-03-21 13:54 Reinhard Arlt
  0 siblings, 0 replies; 2+ messages in thread
From: Reinhard Arlt @ 2014-03-21 13:54 UTC (permalink / raw)
  To: u-boot

Hello,

here is an idea, how to fix the

void video_invertchar(int xx, int yy)

routine in

cfb_console.c

This is not a patch yet, just a idea.

Reinhard

diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 904caf7..33d5a2c 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -619,8 +619,37 @@ static void video_invertchar(int xx, int yy)
         int x, y;
         for (y = firsty; y < lasty; y += VIDEO_LINE_LEN) {
                 for (x = firstx; x < lastx; x++) {
-                       u8 *dest = (u8 *)(video_fb_address) + x + y;
-                       *dest = ~*dest;
+                        u8 *dest8;
+                        u16 *dest16;
+                        u32 *dest32;
+
+                        switch (VIDEO_DATA_FORMAT) {
+                        case GDF__8BIT_INDEX:
+                               dest8 = (u8 *)(video_fb_address) + x + y;
+
+                               *dest8 ^= 0x01;
+                                break;
+
+                       case GDF__8BIT_332RGB:
+                               dest8 = (u8 *)(video_fb_address) + x + y;
+
+                               *dest8 = ~*dest8;
+                                break;
+
+                       case GDF_15BIT_555RGB:
+                       case GDF_16BIT_565RGB:
+                               dest16 = (u16 *)(video_fb_address) + x + y;
+
+                               *dest16 = ~*dest16;
+                                break;
+
+                       case GDF_32BIT_X888RGB:
+                       case GDF_24BIT_888RGB:
+                               dest32 = (u32 *)(video_fb_address) + x + y;
+
+                               *dest32 = ~*dest32;
+                                break;
+                       }
                 }
         }
  }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-21 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21 12:17 [U-Boot] Wired cursor colors Reinhard Arlt
  -- strict thread matches above, loose matches on Subject: below --
2014-03-21 13:54 Reinhard Arlt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox