Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wsfb Add 10-bit pixel format support.
details: https://anonhg.NetBSD.org/src/rev/182e5908d668
branches: trunk
changeset: 1023259:182e5908d668
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Aug 30 22:47:24 2021 +0000
description:
Add 10-bit pixel format support.
diffstat:
sys/arch/arm/fdt/arm_simplefb.c | 16 ++++++++++++++--
sys/dev/fdt/simplefb.c | 7 +++++--
sys/dev/wsfb/genfb.c | 28 +++++++++++++++++-----------
3 files changed, 36 insertions(+), 15 deletions(-)
diffs (165 lines):
diff -r 396d1241b3fe -r 182e5908d668 sys/arch/arm/fdt/arm_simplefb.c
--- a/sys/arch/arm/fdt/arm_simplefb.c Mon Aug 30 22:32:06 2021 +0000
+++ b/sys/arch/arm/fdt/arm_simplefb.c Mon Aug 30 22:47:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_simplefb.c,v 1.10 2021/03/02 11:51:00 jmcneill Exp $ */
+/* $NetBSD: arm_simplefb.c,v 1.11 2021/08/30 22:47:24 jmcneill Exp $ */
/*-
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include "opt_vcons.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.10 2021/03/02 11:51:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.11 2021/08/30 22:47:24 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -68,6 +68,7 @@
uint32_t sc_stride;
uint16_t sc_depth;
bool sc_swapped;
+ bool sc_10bit;
void *sc_bits;
} arm_simplefb_softc;
@@ -136,6 +137,12 @@
ri->ri_rpos = 8;
ri->ri_gpos = 16;
ri->ri_bpos = 24;
+ } else if (sc->sc_10bit) {
+ KASSERT(ri->ri_depth == 32);
+ ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 10;
+ ri->ri_rpos = 20;
+ ri->ri_gpos = 10;
+ ri->ri_bpos = 0;
}
scr->scr_flags |= VCONS_LOADFONT;
@@ -207,6 +214,7 @@
uint16_t depth;
long defattr;
bool swapped = false;
+ bool is_10bit = false;
const int phandle = arm_simplefb_find_node();
if (phandle == -1)
@@ -231,6 +239,9 @@
strcmp(format, "b8g8r8x8") == 0) {
depth = 32;
swapped = true;
+ } else if (strcmp(format, "x2r10g10b10") == 0) {
+ depth = 32;
+ is_10bit = true;
} else if (strcmp(format, "r5g6b5") == 0) {
depth = 16;
} else {
@@ -259,6 +270,7 @@
sc->sc_stride = stride;
sc->sc_bits = bus_space_vaddr(bst, bsh);
sc->sc_swapped = swapped;
+ sc->sc_10bit = is_10bit;
wsfont_init();
diff -r 396d1241b3fe -r 182e5908d668 sys/dev/fdt/simplefb.c
--- a/sys/dev/fdt/simplefb.c Mon Aug 30 22:32:06 2021 +0000
+++ b/sys/dev/fdt/simplefb.c Mon Aug 30 22:47:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: simplefb.c,v 1.14 2021/03/02 11:51:00 jmcneill Exp $ */
+/* $NetBSD: simplefb.c,v 1.15 2021/08/30 22:47:24 jmcneill Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
#include "opt_wsdisplay_compat.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.14 2021/03/02 11:51:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.15 2021/08/30 22:47:24 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -162,6 +162,9 @@
strcmp(format, "b8g8r8x8") == 0) {
depth = 32;
prop_dictionary_set_bool(dict, "is_swapped", true);
+ } else if (strcmp(format, "x2r10g10b10") == 0) {
+ depth = 32;
+ prop_dictionary_set_bool(dict, "is_10bit", true);
} else if (strcmp(format, "r5g6b5") == 0) {
depth = 16;
} else {
diff -r 396d1241b3fe -r 182e5908d668 sys/dev/wsfb/genfb.c
--- a/sys/dev/wsfb/genfb.c Mon Aug 30 22:32:06 2021 +0000
+++ b/sys/dev/wsfb/genfb.c Mon Aug 30 22:47:24 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb.c,v 1.83 2021/08/07 16:19:17 thorpej Exp $ */
+/* $NetBSD: genfb.c,v 1.84 2021/08/30 22:47:25 jmcneill Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.83 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.84 2021/08/30 22:47:25 jmcneill Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -558,7 +558,7 @@
struct genfb_softc *sc = cookie;
struct rasops_info *ri = &scr->scr_ri;
int wantcols;
- bool is_bgr, is_swapped;
+ bool is_bgr, is_swapped, is_10bit;
ri->ri_depth = sc->sc_depth;
ri->ri_width = sc->sc_width;
@@ -584,7 +584,6 @@
switch (ri->ri_depth) {
case 32:
case 24:
- ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 8;
ri->ri_flg |= RI_ENABLE_ALPHA;
is_bgr = false;
@@ -595,22 +594,29 @@
prop_dictionary_get_bool(device_properties(sc->sc_dev),
"is_swapped", &is_swapped);
+ is_10bit = false;
+ prop_dictionary_get_bool(device_properties(sc->sc_dev),
+ "is_10bit", &is_10bit);
+
+ const int bits = is_10bit ? 10 : 8;
+ ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = bits;
+
if (is_bgr) {
/* someone requested BGR */
- ri->ri_rpos = 0;
- ri->ri_gpos = 8;
- ri->ri_bpos = 16;
+ ri->ri_rpos = bits * 0;
+ ri->ri_gpos = bits * 1;
+ ri->ri_bpos = bits * 2;
} else if (is_swapped) {
/* byte-swapped, must be 32 bpp */
- KASSERT(ri->ri_depth == 32);
+ KASSERT(ri->ri_depth == 32 && bits == 8);
ri->ri_rpos = 8;
ri->ri_gpos = 16;
ri->ri_bpos = 24;
} else {
/* assume RGB */
- ri->ri_rpos = 16;
- ri->ri_gpos = 8;
- ri->ri_bpos = 0;
+ ri->ri_rpos = bits * 2;
+ ri->ri_gpos = bits * 1;
+ ri->ri_bpos = bits * 0;
}
break;
Home |
Main Index |
Thread Index |
Old Index