Enable syscons framebuffer support for bcm2835. It makes possible to run Xorg

on Raspberry Pi.
o convert mmap address to physical.
o add FBIOGTYPE ioctl handler - allow to get screen resolution by new
    xf86-video-scfb driver.
Originally designed for "Efika MX" project.

Sponsored by:	FreeBSD Foundation
This commit is contained in:
ray 2013-01-13 22:05:46 +00:00
parent 5740e090f2
commit 673cba243d

View File

@ -136,6 +136,7 @@ struct video_adapter_softc {
int console;
intptr_t fb_addr;
intptr_t fb_paddr;
unsigned int fb_size;
unsigned int height;
@ -222,6 +223,7 @@ bcm_fb_init(void *arg)
fb_config->screen_size);
va_sc->fb_addr = (intptr_t)pmap_mapdev(fb_config->base, fb_config->screen_size);
va_sc->fb_paddr = fb_config->base;
va_sc->fb_size = fb_config->screen_size;
va_sc->depth = fb_config->bpp;
va_sc->stride = fb_config->pitch;
@ -795,7 +797,7 @@ bcmfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr,
* framebuffer, since it shouldn't be touched
*/
if (offset < sc->stride*sc->height) {
*paddr = sc->fb_addr + offset;
*paddr = sc->fb_paddr + offset;
return (0);
}
@ -805,6 +807,27 @@ bcmfb_mmap(video_adapter_t *adp, vm_ooffset_t offset, vm_paddr_t *paddr,
static int
bcmfb_ioctl(video_adapter_t *adp, u_long cmd, caddr_t data)
{
struct video_adapter_softc *sc;
struct fbtype *fb;
sc = (struct video_adapter_softc *)adp;
switch (cmd) {
case FBIOGTYPE:
fb = (struct fbtype *)data;
fb->fb_type = FBTYPE_PCIMISC;
fb->fb_height = sc->height;
fb->fb_width = sc->width;
fb->fb_depth = sc->depth;
if (sc->depth <= 1 || sc->depth > 8)
fb->fb_cmsize = 0;
else
fb->fb_cmsize = 1 << sc->depth;
fb->fb_size = sc->fb_size;
break;
default:
return (fb_commonioctl(adp, cmd, data));
}
return (0);
}