Module Name: src
Committed By: macallan
Date: Thu Apr 12 22:36:15 UTC 2012
Modified Files:
src/sys/dev/wsfb: genfb.c
Log Message:
in 32 bit colour assume RGB ordering, allow override using a device property
To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.47 src/sys/dev/wsfb/genfb.c:1.48
--- src/sys/dev/wsfb/genfb.c:1.47 Tue Feb 7 18:48:19 2012
+++ src/sys/dev/wsfb/genfb.c Thu Apr 12 22:36:15 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb.c,v 1.47 2012/02/07 18:48:19 phx Exp $ */
+/* $NetBSD: genfb.c,v 1.48 2012/04/12 22:36:15 macallan Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.47 2012/02/07 18:48:19 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.48 2012/04/12 22:36:15 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -507,8 +507,30 @@ genfb_init_screen(void *cookie, struct v
ri->ri_flg |= RI_CLEAR;
}
- if (ri->ri_depth == 32)
+ if (ri->ri_depth == 32) {
+ bool is_bgr = false;
+
ri->ri_flg |= RI_ENABLE_ALPHA;
+ prop_dictionary_get_bool(device_properties(sc->sc_dev),
+ "is_bgr", &is_bgr);
+ if (is_bgr) {
+ /* someone requested BGR */
+ ri->ri_rnum = 8;
+ ri->ri_gnum = 8;
+ ri->ri_bnum = 8;
+ ri->ri_rpos = 0;
+ ri->ri_gpos = 8;
+ ri->ri_bpos = 16;
+ } else {
+ /* assume RGB */
+ ri->ri_rnum = 8;
+ ri->ri_gnum = 8;
+ ri->ri_bnum = 8;
+ ri->ri_rpos = 16;
+ ri->ri_gpos = 8;
+ ri->ri_bpos = 0;
+ }
+ }
if (ri->ri_depth == 8 && sc->sc_cmcb != NULL)
ri->ri_flg |= RI_ENABLE_ALPHA | RI_8BIT_IS_RGB;