summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorrin <rin@NetBSD.org>2020-10-19 01:12:14 +0000
committerrin <rin@NetBSD.org>2020-10-19 01:12:14 +0000
commit6deedafda44b855bfb8eb6ba4120bee600d47455 (patch)
treee9c583f54661713efb71185f05dc147dd70bbe39 /sys/dev/fdt
parentbc55fab413e4a543149ca618f7ef2b6ec1e30b18 (diff)
Fix colors of 32-bpp raster console for evbarm/aarch64eb and armeb.
Most boards are configured to little-endian in initial, and switched to big-endian after kernel is loaded. In this case, framebuffer seems byte-swapped to CPU. It is best to reconfigure framebuffer (as done recently for sunxi_mixer by jmcneill), but in most cases, HW is incapable, or we just don't know register bits to configure them. Therefore, override "format" FDT property for "simple-framebuffer" to let drivers know byte-order for 32-bpp framebuffer. Then, make fdt/simplefb (genfb) and arm_simplefb (early console) detect byte-swapped FB, and configure genfb(4) or rasops(4) layers accordingly. Tested on Pine A64+ (arm_simplefb) and Cubietruck (both fdt/simplefb and arm_simplefb). Discussed with jmcneill. Thanks!!
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/simplefb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/fdt/simplefb.c b/sys/dev/fdt/simplefb.c
index d766538e60a..9c4af114b29 100644
--- a/sys/dev/fdt/simplefb.c
+++ b/sys/dev/fdt/simplefb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: simplefb.c,v 1.8 2019/07/23 14:34:12 rin Exp $ */
+/* $NetBSD: simplefb.c,v 1.9 2020/10/19 01:12:14 rin Exp $ */
/*-
* Copyright (c) 2017 Jared McNeill <jmcneill@invisible.ca>
@@ -29,7 +29,7 @@
#include "opt_wsdisplay_compat.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.8 2019/07/23 14:34:12 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: simplefb.c,v 1.9 2020/10/19 01:12:14 rin Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -157,6 +157,10 @@ simplefb_attach_genfb(struct simplefb_softc *sc)
if (strcmp(format, "a8b8g8r8") == 0 ||
strcmp(format, "x8r8g8b8") == 0) {
depth = 32;
+ } else if (strcmp(format, "r8g8b8a8") == 0 ||
+ strcmp(format, "b8g8r8x8") == 0) {
+ depth = 32;
+ prop_dictionary_set_bool(dict, "is_swapped", true);
} else if (strcmp(format, "r5g6b5") == 0) {
depth = 16;
} else {