Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wsfb in 32 bit colour assume RGB ordering, allow ove...



details:   https://anonhg.NetBSD.org/src/rev/1730101d4186
branches:  trunk
changeset: 778765:1730101d4186
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Apr 12 22:36:15 2012 +0000

description:
in 32 bit colour assume RGB ordering, allow override using a device property

diffstat:

 sys/dev/wsfb/genfb.c |  28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r a5bef10f517c -r 1730101d4186 sys/dev/wsfb/genfb.c
--- a/sys/dev/wsfb/genfb.c      Thu Apr 12 22:10:05 2012 +0000
+++ b/sys/dev/wsfb/genfb.c      Thu Apr 12 22:36:15 2012 +0000
@@ -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 @@
                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;



Home | Main Index | Thread Index | Old Index