Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/iomd Move over to using a 6:5:5 R:G:B palette i...



details:   https://anonhg.NetBSD.org/src/rev/e2caa5d352f6
branches:  trunk
changeset: 533047:e2caa5d352f6
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Wed Jun 19 22:42:02 2002 +0000

description:
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 +++++++++++++---------
 sys/arch/arm/iomd/vidcvideo.c    |   6 +++---
 2 files changed, 16 insertions(+), 12 deletions(-)

diffs (75 lines):

diff -r 8f6da905960b -r e2caa5d352f6 sys/arch/arm/iomd/vidc20config.c
--- a/sys/arch/arm/iomd/vidc20config.c  Wed Jun 19 17:43:30 2002 +0000
+++ b/sys/arch/arm/iomd/vidc20config.c  Wed Jun 19 22:42:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vidc20config.c,v 1.12 2002/06/17 21:00:13 bjh21 Exp $  */
+/*     $NetBSD: vidc20config.c,v 1.13 2002/06/19 22:42:02 bjh21 Exp $  */
 
 /*
  * Copyright (c) 2001 Reinoud Zandijk
@@ -48,7 +48,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.12 2002/06/17 21:00:13 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidc20config.c,v 1.13 2002/06/19 22:42:02 bjh21 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 */
diff -r 8f6da905960b -r e2caa5d352f6 sys/arch/arm/iomd/vidcvideo.c
--- a/sys/arch/arm/iomd/vidcvideo.c     Wed Jun 19 17:43:30 2002 +0000
+++ b/sys/arch/arm/iomd/vidcvideo.c     Wed Jun 19 22:42:02 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vidcvideo.c,v 1.11 2002/04/03 16:03:50 reinoud Exp $ */
+/* $NetBSD: vidcvideo.c,v 1.12 2002/06/19 22:42:02 bjh21 Exp $ */
 
 /*
  * Copyright (c) 2001 Reinoud Zandijk
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: vidcvideo.c,v 1.11 2002/04/03 16:03:50 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidcvideo.c,v 1.12 2002/06/19 22:42:02 bjh21 Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -731,7 +731,7 @@
        { 0,  0,  0,   0,  0,  0},      /*  2 bpp */
        { 0,  0,  0,   0,  0,  0},      /*  4 bpp */
        { 0,  0,  0,   0,  0,  0},      /*  8 bpp */
-       { 5,  5,  5,   0,  5, 10},      /* 16 bpp */
+       { 6,  5,  5,   0,  6, 11},      /* 16 bpp */
        { 8,  8,  8,   0,  8, 16},      /* 32 bpp */
 };
 



Home | Main Index | Thread Index | Old Index