summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-12-03 17:10:42 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-12-03 17:10:42 +0000
commitd416916216cadd43ba5a7c7a8e063d9adda6115c (patch)
tree311da0c44ec74a4f9d0854fb12fb60b93f47e040 /sys/arch/sparc/dev
parentb7168af93fb78357d61a31778d0cf52690b1cb9a (diff)
Instead of invoking rasops_init with a wrong depth value to have some
values computed better, prefer invoking it with the real thing and recomputing what needs to be afterwards. No functional change, but this allows fb.c to assume a few things about its callers.
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r--sys/arch/sparc/dev/zx.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/sys/arch/sparc/dev/zx.c b/sys/arch/sparc/dev/zx.c
index 3deb53f5aeb..49e289bd687 100644
--- a/sys/arch/sparc/dev/zx.c
+++ b/sys/arch/sparc/dev/zx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zx.c,v 1.17 2006/12/02 11:24:02 miod Exp $ */
+/* $OpenBSD: zx.c,v 1.18 2006/12/03 17:10:40 miod Exp $ */
/* $NetBSD: zx.c,v 1.5 2002/10/02 16:52:46 thorpej Exp $ */
/*
@@ -254,18 +254,27 @@ zx_attach(struct device *parent, struct device *self, void *args)
ZX_OFF_SS0, round_page(sc->sc_sunfb.sf_fbsize));
ri->ri_hw = sc;
+ fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
+
/*
- * Watch out! rasops_init() invoked via fbwscons_init() would
- * not compute ri_bits correctly when centering the display, if
- * it had been tricked with the low depth value. So masquerade as
- * 32 bits for the call. This will invoke rasops32_init() instead
- * of rasops8_init(), but this doesn't matter as we will override
- * all the rasops functions below.
+ * Watch out! rasops_init() invoked via fbwscons_init() did not
+ * compute ri_bits correctly when centering the display, because
+ * it has been tricked with the low depth value.
+ * Recompute now.
*/
- sc->sc_sunfb.sf_depth = 32;
- fbwscons_init(&sc->sc_sunfb, isconsole ? 0 : RI_CLEAR);
- sc->sc_sunfb.sf_depth = ri->ri_depth = 8;
-
+ ri->ri_emustride = ri->ri_emuwidth * 4;
+ ri->ri_delta = ri->ri_stride - ri->ri_emustride;
+ ri->ri_pelbytes = 4;
+ ri->ri_xscale = ri->ri_font->fontwidth * 4;
+ ri->ri_bits = ri->ri_origbits;
+ ri->ri_bits += (((ri->ri_width * 4) - ri->ri_emustride) >> 1) & ~3;
+ ri->ri_bits += ((ri->ri_height - ri->ri_emuheight) >> 1) *
+ ri->ri_stride;
+ ri->ri_yorigin = (int)(ri->ri_bits - ri->ri_origbits)
+ / ri->ri_stride;
+ ri->ri_xorigin = (((int)(ri->ri_bits - ri->ri_origbits)
+ % ri->ri_stride) / 4);
+
ri->ri_ops.copyrows = zx_copyrows;
ri->ri_ops.copycols = zx_copycols;
ri->ri_ops.eraserows = zx_eraserows;