Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rasops add a new flag for ri_flg to allow drivers to...



details:   https://anonhg.NetBSD.org/src/rev/d7d3efb91fe2
branches:  trunk
changeset: 772294:d7d3efb91fe2
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Dec 28 08:36:46 2011 +0000

description:
add a new flag for ri_flg to allow drivers to request an r3g3b2 devcmap
in 8 bit colour. Drivers are still responsible to generate an appropriate
colour map for the actual hardware.
For use with alpha blending which needs some sort of 'true' colour.

diffstat:

 sys/dev/rasops/rasops.c  |  13 ++++++++-----
 sys/dev/rasops/rasops.h  |   4 +++-
 sys/dev/rasops/rasops8.c |  12 ++++++++++--
 3 files changed, 21 insertions(+), 8 deletions(-)

diffs (85 lines):

diff -r 320f7092555a -r d7d3efb91fe2 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Wed Dec 28 03:13:09 2011 +0000
+++ b/sys/dev/rasops/rasops.c   Wed Dec 28 08:36:46 2011 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops.c,v 1.67 2011/12/22 04:52:45 macallan Exp $    */
+/*      $NetBSD: rasops.c,v 1.68 2011/12/28 08:36:46 macallan Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.67 2011/12/22 04:52:45 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.68 2011/12/28 08:36:46 macallan Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -809,9 +809,12 @@
                return;
 
        case 8:
-               for (i = 0; i < 16; i++)
-                       ri->ri_devcmap[i] = i | (i<<8) | (i<<16) | (i<<24);
-               return;
+               if ((ri->ri_flg & RI_8BIT_IS_RGB) == 0) {
+                       for (i = 0; i < 16; i++)
+                               ri->ri_devcmap[i] =
+                                   i | (i<<8) | (i<<16) | (i<<24);
+                       return;
+               }
        }
 
        p = rasops_cmap;
diff -r 320f7092555a -r d7d3efb91fe2 sys/dev/rasops/rasops.h
--- a/sys/dev/rasops/rasops.h   Wed Dec 28 03:13:09 2011 +0000
+++ b/sys/dev/rasops/rasops.h   Wed Dec 28 08:36:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops.h,v 1.27 2011/12/22 04:52:45 macallan Exp $ */
+/*     $NetBSD: rasops.h,v 1.28 2011/12/28 08:36:46 macallan Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -61,6 +61,8 @@
  * monochrome bitmap fonts. 
  */
 #define RI_ENABLE_ALPHA        0x1000
+/* set this in order to use r3g3b2 'true' colour in 8 bit */ 
+#define RI_8BIT_IS_RGB 0x2000
 
 struct rasops_info {
        /* These must be filled in by the caller */
diff -r 320f7092555a -r d7d3efb91fe2 sys/dev/rasops/rasops8.c
--- a/sys/dev/rasops/rasops8.c  Wed Dec 28 03:13:09 2011 +0000
+++ b/sys/dev/rasops/rasops8.c  Wed Dec 28 08:36:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops8.c,v 1.27 2010/05/04 04:57:34 macallan Exp $    */
+/*     $NetBSD: rasops8.c,v 1.28 2011/12/28 08:36:46 macallan Exp $    */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.27 2010/05/04 04:57:34 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.28 2011/12/28 08:36:46 macallan Exp $");
 
 #include "opt_rasops.h"
 
@@ -91,6 +91,14 @@
                ri->ri_ops.putchar = rasops8_putchar;
                break;
        }
+       if (ri->ri_flg & RI_8BIT_IS_RGB) {
+               ri->ri_rnum = 3;
+               ri->ri_rpos = 5;
+               ri->ri_gnum = 3;
+               ri->ri_gpos = 2;
+               ri->ri_bnum = 2;
+               ri->ri_bpos = 0;
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index