Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
Timestamp:
2021-06-24T08:32:54Z (5 months ago)
Author:
GitHub <noreply@…>
Branches:
master
Children:
65ec18d
Parents:
a977e37 (diff), 1b7b7af (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Maurizio Lombardi <mlombard@…> (2021-06-24 08:32:54)
git-committer:
GitHub <noreply@…> (2021-06-24 08:32:54)
Message:

Merge pull request #214 from maurizio-lombardi/gfx_rpi3

Graphics improvements for the Raspberry PI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/drivers/bcm2835/mbox.c

    ra977e37 r37d0dd4  
    8686}
    8787
    88 bool bcm2835_fb_init(fb_properties_t *prop)
     88bool bcm2835_fb_init(fb_properties_t *prop, uint32_t width, uint32_t height)
    8989{
    9090        bcm2835_mbox_t *fb_mbox;
     
    9595            KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
    9696
    97         fb_desc->width = 640;
    98         fb_desc->height = 480;
     97        fb_desc->width = width;
     98        fb_desc->height = height;
    9999        fb_desc->virt_width = fb_desc->width;
    100100        fb_desc->virt_height = fb_desc->height;
     
    128128}
    129129
     130bool bcm2835_mbox_get_fb_size(uint32_t *w, uint32_t *h)
     131{
     132        bool r;
     133        MBOX_BUFF_ALLOC(msg, mbox_getfbsize_buf_t);
     134        bcm2835_mbox_t *mbox;
     135
     136        mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t),
     137            KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE);
     138        assert(mbox);
     139
     140        msg->buf_hdr.size = sizeof(mbox_getfbsize_buf_t);
     141        msg->buf_hdr.code = MBOX_PROP_CODE_REQ;
     142        msg->tag_hdr.tag_id = MBOX_TAG_GET_PHYS_W_H;
     143        msg->tag_hdr.buf_size = sizeof(msg->body);
     144        msg->tag_hdr.val_len  = 0;
     145        msg->zero = 0;
     146
     147        mbox_write(mbox,
     148            MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)msg));
     149        mbox_read(mbox, MBOX_CHAN_PROP_A2V);
     150
     151        r = msg->buf_hdr.code == MBOX_PROP_CODE_RESP_OK;
     152        if (r) {
     153                *h = msg->body.height;
     154                *w = msg->body.width;
     155        }
     156
     157        km_unmap((uintptr_t) mbox, sizeof(bcm2835_mbox_t));
     158        return r;
     159}
     160
    130161/**
    131162 * @}
Note: See TracChangeset for help on using the changeset viewer.