Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/rpi Newer Raspberry Pi firmware has changed ...
details: https://anonhg.NetBSD.org/src/rev/896ebf73f91b
branches: trunk
changeset: 335686:896ebf73f91b
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Wed Jan 21 11:02:55 2015 +0000
description:
Newer Raspberry Pi firmware has changed the framebuffer from BGR to RGB.
The method we use to set the pixel order (vcprop set pixel order) does
not seem to work, nor does querying the pixel order (vcprop get pixel order).
The firmware passes this information to the kernel by adding a
"bcm2708_fb.fbswap" kernel cmdline arg. 0=BGR, 1=RGB. If the parameter is
absent, assume we are running on old firmware and use BGR mode.
diffstat:
sys/arch/evbarm/rpi/rpi_machdep.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
diffs (89 lines):
diff -r d3e6bd691b31 -r 896ebf73f91b sys/arch/evbarm/rpi/rpi_machdep.c
--- a/sys/arch/evbarm/rpi/rpi_machdep.c Wed Jan 21 08:35:31 2015 +0000
+++ b/sys/arch/evbarm/rpi/rpi_machdep.c Wed Jan 21 11:02:55 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpi_machdep.c,v 1.55 2014/10/07 08:37:18 mlelstv Exp $ */
+/* $NetBSD: rpi_machdep.c,v 1.56 2015/01/21 11:02:55 jmcneill Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.55 2014/10/07 08:37:18 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpi_machdep.c,v 1.56 2015/01/21 11:02:55 jmcneill Exp $");
#include "opt_evbarm_boardtype.h"
#include "opt_ddb.h"
@@ -296,7 +296,6 @@
struct vcprop_tag_fbres vbt_res;
struct vcprop_tag_fbres vbt_vres;
struct vcprop_tag_fbdepth vbt_depth;
- struct vcprop_tag_fbpixelorder vbt_pixelorder;
struct vcprop_tag_fbalpha vbt_alpha;
struct vcprop_tag_allocbuf vbt_allocbuf;
struct vcprop_tag_blankscreen vbt_blank;
@@ -334,14 +333,6 @@
},
.bpp = 32,
},
- .vbt_pixelorder = {
- .tag = {
- .vpt_tag = VCPROPTAG_SET_FB_PIXEL_ORDER,
- .vpt_len = VCPROPTAG_LEN(vb_setfb.vbt_pixelorder),
- .vpt_rcode = VCPROPTAG_REQUEST,
- },
- .state = VCPROP_PIXEL_BGR,
- },
.vbt_alpha = {
.tag = {
.vpt_tag = VCPROPTAG_SET_FB_ALPHA_MODE,
@@ -750,6 +741,7 @@
char *ptr;
int integer;
int error;
+ bool is_bgr = true;
if (get_bootconf_option(boot_args, "fb",
BOOTOPT_TYPE_STRING, &ptr)) {
@@ -779,7 +771,6 @@
!vcprop_tag_success_p(&vb_setfb.vbt_res.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_vres.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_depth.tag) ||
- !vcprop_tag_success_p(&vb_setfb.vbt_pixelorder.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_allocbuf.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_blank.tag) ||
!vcprop_tag_success_p(&vb_setfb.vbt_pitch.tag)) {
@@ -798,8 +789,6 @@
vb_setfb.vbt_res.width, vb_setfb.vbt_res.height);
printf("%s: vwidth = %d vheight = %d\n", __func__,
vb_setfb.vbt_vres.width, vb_setfb.vbt_vres.height);
- printf("%s: pixelorder = %d\n", __func__,
- vb_setfb.vbt_pixelorder.state);
#endif
if (vb_setfb.vbt_allocbuf.address == 0 ||
@@ -821,8 +810,20 @@
vb_setfb.vbt_pitch.linebytes);
prop_dictionary_set_uint32(dict, "address",
vb_setfb.vbt_allocbuf.address);
- if (vb_setfb.vbt_pixelorder.state == VCPROP_PIXEL_BGR)
- prop_dictionary_set_bool(dict, "is_bgr", true);
+
+ /*
+ * Old firmware uses BGR. New firmware uses RGB. The get and set
+ * pixel order mailbox properties don't seem to work. The firmware
+ * adds a kernel cmdline option bcm2708_fb.fbswap=<0|1>, so use it
+ * to determine pixel order. 0 means BGR, 1 means RGB.
+ *
+ * See https://github.com/raspberrypi/linux/issues/514
+ */
+ if (get_bootconf_option(boot_args, "bcm2708_fb.fbswap",
+ BOOTOPT_TYPE_INT, &integer)) {
+ is_bgr = integer == 0;
+ }
+ prop_dictionary_set_bool(dict, "is_bgr", is_bgr);
/* if "genfb.type=<n>" is passed in cmdline, override wsdisplay type */
if (get_bootconf_option(boot_args, "genfb.type",
Home |
Main Index |
Thread Index |
Old Index