Force framebuffer virtual viewport to be the same as physical
VideoCore reports garbage in viewport geometry fields unless viewport was set previously by earlier stage boot loader. So when booting FreeBSD kernel directly from VideoCore's start.elf framebuffer intialization fails due to invalid vxres, vyres values. Make sure we request viewport to be equal to physical resolution Submitted by: Sylvain Garrigues <sylvain@sylvaingarrigues.com>
This commit is contained in:
parent
f734685ea4
commit
65c2672f67
@ -149,6 +149,9 @@ bcm_fb_attach(device_t dev)
|
||||
if (bcm2835_mbox_fb_get_w_h(&fb) != 0)
|
||||
return (ENXIO);
|
||||
fb.bpp = FB_DEPTH;
|
||||
fb.vxres = fb.xres;
|
||||
fb.vyres = fb.yres;
|
||||
fb.xoffset = fb.yoffset = 0;
|
||||
if (bcm2835_mbox_fb_init(&fb) != 0)
|
||||
return (ENXIO);
|
||||
|
||||
|
@ -80,6 +80,10 @@ bcm_fb_init(struct bcmsc_softc *sc, struct bcm2835_fb_config *fb)
|
||||
return (ENXIO);
|
||||
fb->bpp = FB_DEPTH;
|
||||
|
||||
fb->vxres = fb->xres;
|
||||
fb->vyres = fb->yres;
|
||||
fb->xoffset = fb->yoffset = 0;
|
||||
|
||||
if ((err = bcm2835_mbox_fb_init(fb)) != 0) {
|
||||
device_printf(sc->dev, "bcm2835_mbox_fb_init failed, err=%d\n", err);
|
||||
return (ENXIO);
|
||||
|
@ -475,20 +475,12 @@ bcm2835_mbox_fb_get_w_h(struct bcm2835_fb_config *fb)
|
||||
msg.hdr.code = BCM2835_MBOX_CODE_REQ;
|
||||
BCM2835_MBOX_INIT_TAG(&msg.physical_w_h, GET_PHYSICAL_W_H);
|
||||
msg.physical_w_h.tag_hdr.val_len = 0;
|
||||
BCM2835_MBOX_INIT_TAG(&msg.virtual_w_h, GET_VIRTUAL_W_H);
|
||||
msg.virtual_w_h.tag_hdr.val_len = 0;
|
||||
BCM2835_MBOX_INIT_TAG(&msg.offset, GET_VIRTUAL_OFFSET);
|
||||
msg.offset.tag_hdr.val_len = 0;
|
||||
msg.end_tag = 0;
|
||||
|
||||
err = bcm2835_mbox_property(&msg, sizeof(msg));
|
||||
if (err == 0) {
|
||||
fb->xres = msg.physical_w_h.body.resp.width;
|
||||
fb->yres = msg.physical_w_h.body.resp.height;
|
||||
fb->vxres = msg.virtual_w_h.body.resp.width;
|
||||
fb->vyres = msg.virtual_w_h.body.resp.height;
|
||||
fb->xoffset = msg.offset.body.resp.x;
|
||||
fb->yoffset = msg.offset.body.resp.y;
|
||||
}
|
||||
|
||||
return (err);
|
||||
|
@ -469,8 +469,6 @@ struct bcm2835_fb_config {
|
||||
struct msg_fb_get_w_h {
|
||||
struct bcm2835_mbox_hdr hdr;
|
||||
struct bcm2835_mbox_tag_fb_w_h physical_w_h;
|
||||
struct bcm2835_mbox_tag_fb_w_h virtual_w_h;
|
||||
struct bcm2835_mbox_tag_virtual_offset offset;
|
||||
uint32_t end_tag;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user