Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/sys/arch/arm/iomd Pull up revision 1.13 (requested by b...



details:   https://anonhg.NetBSD.org/src/rev/762b2db90d37
branches:  netbsd-1-6
changeset: 528051:762b2db90d37
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 21 14:52:14 2002 +0000

description:
Pull up revision 1.13 (requested by bjh21 in ticket #328):
Move over to using a 6:5:5 R:G:B palette in 16-bit display modes, and abstract
the palette generation to work with arbitrary numbers of bits.
This allows X to work after a fashion, since it tries to put the VIDC into
a 6:5:5 mode itself (which we ignore).  Anything that actually tries to take
advantage of the DirectColor visual it offers will still be screwed, but I
hope such applications are rare.

diffstat:

 sys/arch/arm/iomd/vidc20config.c |  22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diffs (48 lines):

diff -r 433f0c563e00 -r 762b2db90d37 sys/arch/arm/iomd/vidc20config.c
--- a/sys/arch/arm/iomd/vidc20config.c  Fri Jun 21 14:50:55 2002 +0000
+++ b/sys/arch/arm/iomd/vidc20config.c  Fri Jun 21 14:52:14 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vidc20config.c,v 1.9.6.1 2002/06/21 14:50:47 lukem Exp $       */
+/*     $NetBSD: vidc20config.c,v 1.9.6.2 2002/06/21 14:52:14 lukem Exp $       */
 
 /*
  * Copyright (c) 2001 Reinoud Zandijk
@@ -48,7 +48,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.9.6.1 2002/06/21 14:50:47 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.9.6.2 2002/06/21 14:52:14 lukem Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -697,18 +697,22 @@
                 * green = LUT[pixel[11:4]].green
                 * blue  = LUT[pixel[15:8]].blue
                 *
-                * We just want 5:5:5 R:G:B.
+                * We use 6:5:5 R:G:B cos that's what Xarm32VIDC wants.
                 */
+#define RBITS 6
+#define GBITS 5
+#define BBITS 5
                vidcvideo_write(VIDC_PALREG, 0x00000000);
                for (i = 0; i < 256; i++) {
-                       int r5, g5, b5;
+                       int r, g, b;
 
-                       r5 = i & 0x1f;
-                       g5 = (i >> 1) & 0x1f;
-                       b5 = (i >> 2) & 0x1f;
+                       r = i & ((1 << RBITS) - 1);
+                       g = (i >> (RBITS - 4)) & ((1 << GBITS) - 1);
+                       b = (i >> (RBITS + GBITS - 8)) & ((1 << BBITS) - 1);
                        vidcvideo_write(VIDC_PALETTE,
-                           VIDC_COL(r5 << 3 | r5 >> 2, g5 << 3 | g5 >> 2,
-                               b5 << 3 | b5 >> 2));  
+                           VIDC_COL(r << (8 - RBITS) | r >> (2 * RBITS - 8),
+                               g << (8 - GBITS) | g >> (2 * GBITS - 8),
+                               b << (8 - BBITS) | b >> (2 * BBITS - 8)));
                }
                break;                  
        case 5: /* 32 bpp */



Home | Main Index | Thread Index | Old Index