Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci add methods to map/unmap video memory and regist...



details:   https://anonhg.NetBSD.org/src/rev/b96759ff1682
branches:  trunk
changeset: 777666:b96759ff1682
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Feb 28 20:23:51 2012 +0000

description:
add methods to map/unmap video memory and registers when entering/leaving X
so DRI has a fighting chance of working

diffstat:

 sys/dev/pci/radeonfb.c |  30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diffs (63 lines):

diff -r ddf31b0f31b5 -r b96759ff1682 sys/dev/pci/radeonfb.c
--- a/sys/dev/pci/radeonfb.c    Tue Feb 28 20:21:16 2012 +0000
+++ b/sys/dev/pci/radeonfb.c    Tue Feb 28 20:23:51 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeonfb.c,v 1.55 2012/02/28 20:21:16 macallan Exp $ */
+/*     $NetBSD: radeonfb.c,v 1.56 2012/02/28 20:23:51 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.55 2012/02/28 20:21:16 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.56 2012/02/28 20:23:51 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -947,6 +947,29 @@
                bus_space_unmap(sc->sc_memt, sc->sc_memh, sc->sc_memsz);
 }
 
+static void
+radeonfb_map(struct radeonfb_softc *sc)
+{
+       if (bus_space_map(sc->sc_regt, sc->sc_regaddr, sc->sc_regsz, 0,
+           &sc->sc_regh) != 0) {
+               aprint_error("%s: unable to map registers!\n", XNAME(sc));
+               return;
+       }
+       if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
+               BUS_SPACE_MAP_LINEAR, &sc->sc_memh) != 0) {
+               sc->sc_memsz = 0;
+               aprint_error("%s: Unable to map frame buffer\n", XNAME(sc));
+               return;
+       }
+}
+
+static void
+radeonfb_unmap(struct radeonfb_softc *sc)
+{
+       bus_space_unmap(sc->sc_regt, sc->sc_regh, sc->sc_regsz);
+       bus_space_unmap(sc->sc_memt, sc->sc_memh, sc->sc_memsz);
+}
+
 static int
 radeonfb_drm_print(void *aux, const char *pnp)
 {
@@ -1021,11 +1044,14 @@
                        dp->rd_wsmode = *(int *)d;
                        if ((dp->rd_wsmode == WSDISPLAYIO_MODE_EMUL) &&
                            (dp->rd_vd.active)) {
+                               radeonfb_map(sc);
                                radeonfb_engine_init(dp);
                                glyphcache_wipe(&dp->rd_gc);
                                radeonfb_init_palette(sc, dp == &sc->sc_displays[0] ? 0 : 1);
                                radeonfb_modeswitch(dp);
                                vcons_redraw_screen(dp->rd_vd.active);
+                       } else {
+                               radeonfb_unmap(sc);
                        }
                }
                return 0;



Home | Main Index | Thread Index | Old Index