The patch titled

     fbcon: Saner 16-color to 4-color conversion

has been added to the -mm tree.  Its filename is

     fbcon-saner-16-color-to-4-color-conversion.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

fbdev-add-fbset-a-support.patch
vesafb-add-blanking-support.patch
fbdev-resurrect-hooks-to-get-edid-from-firmware.patch
savagefb-driver-updates.patch
nvidiafb-fallback-to-firmware-edid.patch
fbdev-fix-greater-than-1-bit-monochrome-color-handling.patch
fbcon-saner-16-color-to-4-color-conversion.patch
console-fix-buffer-copy-on-vc-resize.patch
radeonfb_old-fix-broken-link.patch
fbdev-update-framebuffer-feature-list.patch



From: "Antonino A. Daplas" <[EMAIL PROTECTED]>

Currently, the default linux 16-colors are converted to 4-colors by simply
dividing the values by 4.  However, this is not necessarily correct since the
first 4 colors are converted to black, rendering them invisible.

So, for black, no conversion; for light colors, convert to gray, for normal
text color, no conversion, and for bright colors, convert to intense white.

Signed-off-by: Antonino Daplas <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/video/console/fbcon.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff -puN 
drivers/video/console/fbcon.c~fbcon-saner-16-color-to-4-color-conversion 
drivers/video/console/fbcon.c
--- 
devel/drivers/video/console/fbcon.c~fbcon-saner-16-color-to-4-color-conversion  
    2005-08-21 21:53:59.000000000 -0700
+++ devel-akpm/drivers/video/console/fbcon.c    2005-08-21 21:53:59.000000000 
-0700
@@ -247,9 +247,26 @@ static inline int get_color(struct vc_da
        case 2:
                /*
                 * Scale down 16-colors to 4 colors. Default 4-color palette
-                * is grayscale.
+                * is grayscale. However, simply dividing the values by 4
+                * will not work, as colors 1, 2 and 3 will be scaled-down
+                * to zero rendering them invisible.  So empirically convert
+                * colors to a sane 4-level grayscale.
                 */
-               color /= 4;
+               switch (color) {
+               case 0:
+                       color = 0; /* black */
+                       break;
+               case 1 ... 6:
+                       color = 2; /* white */
+                       break;
+               case 7 ... 8:
+                       color = 1; /* gray */
+                       break;
+               default:
+                       color = 3; /* intense white */
+                       break;
+               }
+               break;
        case 3:
                /*
                 * Last 8 entries of default 16-color palette is a more intense
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to