Module Name: src
Committed By: macallan
Date: Wed Dec 28 08:36:46 UTC 2011
Modified Files:
src/sys/dev/rasops: rasops.c rasops.h rasops8.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/rasops/rasops.h \
src/sys/dev/rasops/rasops8.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.67 src/sys/dev/rasops/rasops.c:1.68
--- src/sys/dev/rasops/rasops.c:1.67 Thu Dec 22 04:52:45 2011
+++ src/sys/dev/rasops/rasops.c Wed Dec 28 08:36:46 2011
@@ -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 @@ rasops_init_devcmap(struct rasops_info *
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;
Index: src/sys/dev/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.27 src/sys/dev/rasops/rasops.h:1.28
--- src/sys/dev/rasops/rasops.h:1.27 Thu Dec 22 04:52:45 2011
+++ src/sys/dev/rasops/rasops.h Wed Dec 28 08:36:46 2011
@@ -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 */
Index: src/sys/dev/rasops/rasops8.c
diff -u src/sys/dev/rasops/rasops8.c:1.27 src/sys/dev/rasops/rasops8.c:1.28
--- src/sys/dev/rasops/rasops8.c:1.27 Tue May 4 04:57:34 2010
+++ src/sys/dev/rasops/rasops8.c Wed Dec 28 08:36:46 2011
@@ -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 @@ rasops8_init(struct rasops_info *ri)
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;
+ }
}
/*