svn commit: r361899 - stable/12/sys/arm/broadcom/bcm2835

Oleksandr Tymoshenko gonzo at FreeBSD.org
Mon Jun 8 00:20:17 UTC 2020


Author: gonzo
Date: Mon Jun  8 00:20:15 2020
New Revision: 361899
URL: https://svnweb.freebsd.org/changeset/base/361899

Log:
  MFC r352028:
  
  [rpi] Inherit framebuffer BPP value from the VideoCore firmware
  
  Instead of using hardcoded bpp of 24, obtain current/configured value
  from VideoCore. This solves certain problems with Xorg/Qt apps that
  require bpp of 32 to work properly. The mode can be forced by setting
  framebuffer_depth value in config.txt
  
  PR:		235363
  Submitted by:	Steve Peurifoy <ssw01 at mathistry.net>
  Tested by:	Johnathan Chen <jonc at chen.org.nz> (stabe/12 patch)

Modified:
  stable/12/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
  stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
  stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==============================================================================
--- stable/12/sys/arm/broadcom/bcm2835/bcm2835_fbd.c	Sun Jun  7 19:56:17 2020	(r361898)
+++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_fbd.c	Mon Jun  8 00:20:15 2020	(r361899)
@@ -85,7 +85,13 @@ bcm_fb_init(struct bcmsc_softc *sc, struct bcm2835_fb_
 	memset(fb, 0, sizeof(*fb));
 	if (bcm2835_mbox_fb_get_w_h(fb) != 0)
 		return (ENXIO);
-	fb->bpp = FB_DEPTH;
+	if (bcm2835_mbox_fb_get_bpp(fb) != 0)
+		return (ENXIO);
+	if (fb->bpp < FB_DEPTH) {
+		device_printf(sc->dev, "changing fb bpp from %d to %d\n", fb->bpp, FB_DEPTH);
+		fb->bpp = FB_DEPTH;
+	} else
+		device_printf(sc->dev, "keeping existing fb bpp of %d\n", fb->bpp);
 
 	fb->vxres = fb->xres;
 	fb->vyres = fb->yres;

Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==============================================================================
--- stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c	Sun Jun  7 19:56:17 2020	(r361898)
+++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox.c	Mon Jun  8 00:20:15 2020	(r361899)
@@ -499,6 +499,26 @@ bcm2835_mbox_fb_get_w_h(struct bcm2835_fb_config *fb)
 }
 
 int
+bcm2835_mbox_fb_get_bpp(struct bcm2835_fb_config *fb)
+{
+	int err;
+	struct msg_fb_get_bpp msg;
+	
+	memset(&msg, 0, sizeof(msg));
+	msg.hdr.buf_size = sizeof(msg);
+	msg.hdr.code = BCM2835_MBOX_CODE_REQ;
+	BCM2835_MBOX_INIT_TAG(&msg.bpp, GET_DEPTH);
+	msg.bpp.tag_hdr.val_len = 0;
+	msg.end_tag = 0;
+	
+	err = bcm2835_mbox_property(&msg, sizeof(msg));
+	if (err == 0)
+		fb->bpp = msg.bpp.body.resp.bpp;
+	
+	return (err);
+}
+
+int
 bcm2835_mbox_fb_init(struct bcm2835_fb_config *fb)
 {
 	int err;

Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
==============================================================================
--- stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h	Sun Jun  7 19:56:17 2020	(r361898)
+++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h	Mon Jun  8 00:20:15 2020	(r361899)
@@ -475,6 +475,14 @@ struct msg_fb_get_w_h {
 
 int bcm2835_mbox_fb_get_w_h(struct bcm2835_fb_config *);
 
+struct msg_fb_get_bpp {
+	struct bcm2835_mbox_hdr hdr;
+	struct bcm2835_mbox_tag_depth bpp;
+	uint32_t end_tag;
+};
+
+int bcm2835_mbox_fb_get_bpp(struct bcm2835_fb_config *);
+
 struct msg_fb_setup {
 	struct bcm2835_mbox_hdr hdr;
 	struct bcm2835_mbox_tag_fb_w_h physical_w_h;


More information about the svn-src-all mailing list