Date: Sun, 8 Sep 2019 09:47:21 +0000 (UTC) From: Oleksandr Tymoshenko <gonzo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352028 - head/sys/arm/broadcom/bcm2835 Message-ID: <201909080947.x889lLRC048852@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: gonzo Date: Sun Sep 8 09:47:21 2019 New Revision: 352028 URL: https://svnweb.freebsd.org/changeset/base/352028 Log: [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@mathistry.net> Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Sun Sep 8 01:58:02 2019 (r352027) +++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Sun Sep 8 09:47:21 2019 (r352028) @@ -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: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Sun Sep 8 01:58:02 2019 (r352027) +++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c Sun Sep 8 09:47:21 2019 (r352028) @@ -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: head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Sun Sep 8 01:58:02 2019 (r352027) +++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h Sun Sep 8 09:47:21 2019 (r352028) @@ -474,6 +474,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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909080947.x889lLRC048852>