summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-02-21 07:54:48 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-02-21 07:54:48 +0000
commitf790294098b7ae0f149597c86bfeb5e4ed9ef53c (patch)
treeac149e38a6f6d55828331478962d201c79caca12 /sys/arch
parent572ad364bdcb1c798ca887f9cb2757f3ca553490 (diff)
Re-initialize acceleration engine after leaving X.
ok miod@
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc64/dev/radeonfb.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/sys/arch/sparc64/dev/radeonfb.c b/sys/arch/sparc64/dev/radeonfb.c
index ea00505da67..78f91aa3cb1 100644
--- a/sys/arch/sparc64/dev/radeonfb.c
+++ b/sys/arch/sparc64/dev/radeonfb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeonfb.c,v 1.3 2011/01/04 19:21:51 kettenis Exp $ */
+/* $OpenBSD: radeonfb.c,v 1.4 2011/02/21 07:54:47 kettenis Exp $ */
/*
* Copyright (c) 2009 Mark Kettenis.
@@ -154,6 +154,7 @@ int radeonfb_erasecols(void *, int, int, int, long);
int radeonfb_copyrows(void *, int, int, int);
int radeonfb_eraserows(void *, int, int, long);
+void radeonfb_init(struct radeonfb_softc *);
void radeonfb_wait_fifo(struct radeonfb_softc *, int);
void radeonfb_wait(struct radeonfb_softc *);
void radeonfb_copyrect(struct radeonfb_softc *, int, int, int, int, int, int);
@@ -233,16 +234,7 @@ radeonfb_attach(struct device *parent, struct device *self, void *aux)
fbwscons_setcolormap(&sc->sc_sunfb, radeonfb_setcolor);
sc->sc_mode = WSDISPLAYIO_MODE_EMUL;
- /*
- * Setup acceleration engine.
- */
- radeonfb_wait_fifo(sc, 2);
- bus_space_write_4(sc->sc_mmiot, sc->sc_mmioh,
- RADEON_DEFAULT_PITCH_OFFSET,
- ((sc->sc_sunfb.sf_linebytes >> 6) << 22) | (sc->sc_memoff >> 10));
- bus_space_write_4(sc->sc_mmiot, sc->sc_mmioh,
- RADEON_DEFAULT_SC_BOTTOM_RIGHT, 0x1fff1fff);
-
+ radeonfb_init(sc);
ri->ri_ops.copyrows = radeonfb_copyrows;
ri->ri_ops.copycols = radeonfb_copycols;
ri->ri_ops.eraserows = radeonfb_eraserows;
@@ -273,7 +265,7 @@ radeonfb_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
fbwscons_setcolormap(&sc->sc_sunfb, radeonfb_setcolor);
/* Clear screen. */
- ri = &sc->sc_sunfb.sf_ro;
+ radeonfb_init(sc);
radeonfb_fillrect(sc, 0, 0, ri->ri_width,
ri->ri_height, ri->ri_devcmap[WSCOL_WHITE]);
}
@@ -543,6 +535,17 @@ radeonfb_eraserows(void *cookie, int row, int num, long attr)
}
void
+radeonfb_init(struct radeonfb_softc *sc)
+{
+ radeonfb_wait_fifo(sc, 2);
+ bus_space_write_4(sc->sc_mmiot, sc->sc_mmioh,
+ RADEON_DEFAULT_PITCH_OFFSET,
+ ((sc->sc_sunfb.sf_linebytes >> 6) << 22) | (sc->sc_memoff >> 10));
+ bus_space_write_4(sc->sc_mmiot, sc->sc_mmioh,
+ RADEON_DEFAULT_SC_BOTTOM_RIGHT, 0x1fff1fff);
+}
+
+void
radeonfb_wait_fifo(struct radeonfb_softc *sc, int n)
{
int i;