Author: ray
Date: Sun Jan 13 22:05:46 2013
New Revision: 245389
URL: http://svnweb.freebsd.org/changeset/base/245389

Log:
  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

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fb.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Sun Jan 13 21:32:40 2013        
(r245388)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Sun Jan 13 22:05:46 2013        
(r245389)
@@ -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_ooff
         * 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_ooff
 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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to