CVS commit: src/sys/dev/pci/voyager

2021-05-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 21 20:23:35 UTC 2021

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
fix wsdisplay attachment in the New Order Of Things


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2021-05-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 21 20:23:35 UTC 2021

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
fix wsdisplay attachment in the New Order Of Things


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.31 src/sys/dev/pci/voyager/voyagerfb.c:1.32
--- src/sys/dev/pci/voyager/voyagerfb.c:1.31	Fri May 21 20:22:15 2021
+++ src/sys/dev/pci/voyager/voyagerfb.c	Fri May 21 20:23:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.32 2021/05/21 20:23:35 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.32 2021/05/21 20:23:35 macallan Exp $");
 
 #include 
 #include 
@@ -363,7 +363,9 @@ voyagerfb_attach(device_t parent, device
 	aa.accessops = _accessops;
 	aa.accesscookie = >vd;
 
-	config_found(sc->sc_dev, , wsemuldisplaydevprint, CFARG_EOL);
+	config_found(sc->sc_dev, , wsemuldisplaydevprint,
+	CFARG_IATTR, "wsemuldisplaydev",
+	CFARG_EOL);
 }
 
 static int



CVS commit: src/sys/dev/pci/voyager

2021-05-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 21 20:22:15 UTC 2021

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use probed VRAM size to determine where to put the cursor instead of blindly
assuming 16MB
also make sure the glyph cache can't overlap with the cursor


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2021-05-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri May 21 20:22:15 UTC 2021

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use probed VRAM size to determine where to put the cursor instead of blindly
assuming 16MB
also make sure the glyph cache can't overlap with the cursor


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.30 src/sys/dev/pci/voyager/voyagerfb.c:1.31
--- src/sys/dev/pci/voyager/voyagerfb.c:1.30	Sat Apr 24 23:36:58 2021
+++ src/sys/dev/pci/voyager/voyagerfb.c	Fri May 21 20:22:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.30 2021/04/24 23:36:58 thorpej Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.30 2021/04/24 23:36:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.31 2021/05/21 20:22:15 macallan Exp $");
 
 #include 
 #include 
@@ -328,7 +328,8 @@ voyagerfb_attach(device_t parent, device
 			(*ri->ri_ops.allocattr)(ri, 0, 0, 0, );
 	}
 	glyphcache_init(>sc_gc, sc->sc_height,
-			(sc->sc_fbsize / sc->sc_stride) - sc->sc_height,
+			((sc->sc_fbsize - 16 * 64) / sc->sc_stride) - 
+			sc->sc_height,
 			sc->sc_width,
 			ri->ri_font->fontwidth,
 			ri->ri_font->fontheight,
@@ -780,7 +781,7 @@ voyagerfb_init(struct voyagerfb_softc *s
 	reg);
 
 	/* put the cursor at the end of video memory */
-	sc->sc_cursor_addr = 16 * 1024 * 1024 - 16 * 64;	/* XXX */
+	sc->sc_cursor_addr = sc->sc_fbsize - 16 * 64;	/* XXX */
 	DPRINTF("%s: %08x\n", __func__, sc->sc_cursor_addr); 
 	sc->sc_cursor = (uint32_t *)((uint8_t *)bus_space_vaddr(sc->sc_memt,
 			 sc->sc_fbh) + sc->sc_cursor_addr);



CVS commit: src/sys/dev/pci/voyager

2018-01-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 19 23:37:36 UTC 2018

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
enable font loading


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.28 src/sys/dev/pci/voyager/voyagerfb.c:1.29
--- src/sys/dev/pci/voyager/voyagerfb.c:1.28	Wed Jan 13 15:56:05 2016
+++ src/sys/dev/pci/voyager/voyagerfb.c	Fri Jan 19 23:37:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.28 2016/01/13 15:56:05 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.29 2018/01/19 23:37:36 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.28 2016/01/13 15:56:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.29 2018/01/19 23:37:36 macallan Exp $");
 
 #include 
 #include 
@@ -287,7 +287,8 @@ voyagerfb_attach(device_t parent, device
 		0, 0,
 		NULL,
 		8, 16,
-		WSSCREEN_WSCOLORS | WSSCREEN_HILIT,
+		WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
+		WSSCREEN_RESIZE,
 		NULL
 	};
 	sc->sc_screens[0] = >sc_defaultscreen_descr;
@@ -298,6 +299,8 @@ voyagerfb_attach(device_t parent, device
 	vcons_init(>vd, sc, >sc_defaultscreen_descr,
 	_accessops);
 	sc->vd.init_screen = voyagerfb_init_screen;
+	sc->vd.show_screen_cookie = >sc_gc;
+	sc->vd.show_screen_cb = glyphcache_adapt;
 
 	/* backlight control */
 	voyagerfb_setup_backlight(sc);
@@ -586,7 +589,7 @@ voyagerfb_init_screen(void *cookie, stru
 	if (sc->sc_depth == 8) {
 		ri->ri_flg |= RI_8BIT_IS_RGB;
 #ifdef VOYAGERFB_ANTIALIAS
-		ri->ri_flg |= RI_ENABLE_ALPHA;
+		ri->ri_flg |= RI_ENABLE_ALPHA | RI_PREFER_ALPHA;
 #endif
 	}
 	if (sc->sc_depth == 32) {
@@ -602,8 +605,11 @@ voyagerfb_init_screen(void *cookie, stru
 		ri->ri_bpos = 0;
 	}
 
+	scr->scr_flags |= VCONS_LOADFONT;
+
 	rasops_init(ri, 0, 0);
-	ri->ri_caps = WSSCREEN_WSCOLORS;
+	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_UNDERLINE |
+		  WSSCREEN_RESIZE;
 
 	rasops_reconfig(ri, sc->sc_height / ri->ri_font->fontheight,
 		sc->sc_width / ri->ri_font->fontwidth);



CVS commit: src/sys/dev/pci/voyager

2018-01-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jan 19 23:37:36 UTC 2018

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
enable font loading


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2016-01-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 13 15:56:05 UTC 2016

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
some trivial fixes:
- rearrange dmesg output so all values are printed properly
- use aprint_*
- support WSDISPLAYIO_GET_FBINFO


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.27 src/sys/dev/pci/voyager/voyagerfb.c:1.28
--- src/sys/dev/pci/voyager/voyagerfb.c:1.27	Tue Mar 11 08:19:45 2014
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Jan 13 15:56:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.27 2014/03/11 08:19:45 mrg Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.28 2016/01/13 15:56:05 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.27 2014/03/11 08:19:45 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.28 2016/01/13 15:56:05 macallan Exp $");
 
 #include 
 #include 
@@ -269,19 +269,19 @@ voyagerfb_attach(device_t parent, device
 	sc->sc_depth = 8;
 #endif
 
-	printf("%s: %d x %d, %d bit, stride %d\n", device_xname(self), 
-		sc->sc_width, sc->sc_height, sc->sc_depth, sc->sc_stride);
-
 	/*
 	 * XXX yeah, casting the fb address to uint32_t is formally wrong
 	 * but as far as I know there are no SM502 with 64bit BARs
 	 */
-	aprint_normal("%s: %d MB video memory at 0x%08x\n", device_xname(self),
+	aprint_normal_dev(self, "%d MB video memory at 0x%08x\n",
 	(int)(sc->sc_fbsize >> 20), (uint32_t)sc->sc_fb);
 
 	/* init engine here */
 	voyagerfb_init(sc);
 
+	aprint_normal_dev(self, "%d x %d, %d bit, stride %d\n", 
+		sc->sc_width, sc->sc_height, sc->sc_depth, sc->sc_stride);
+
 	sc->sc_defaultscreen_descr = (struct wsscreen_descr){
 		"default",
 		0, 0,
@@ -515,6 +515,12 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 			cu = (struct wsdisplay_cursor *)data;
 			return voyagerfb_scursor(sc, cu);
 		}
+
+	case WSDISPLAYIO_GET_FBINFO:
+		{
+			struct wsdisplayio_fbinfo *fbi = data;
+			return wsdisplayio_get_fbinfo(>scr_ri, fbi);
+		}
 	}
 	return EPASSTHROUGH;
 }



CVS commit: src/sys/dev/pci/voyager

2016-01-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 13 15:56:05 UTC 2016

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
some trivial fixes:
- rearrange dmesg output so all values are printed properly
- use aprint_*
- support WSDISPLAYIO_GET_FBINFO


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2013-05-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 14 09:19:37 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
found the missing commit so put this back
am I the only one here with a Gdium?


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.9 src/sys/dev/pci/voyager/pwmclock.c:1.10
--- src/sys/dev/pci/voyager/pwmclock.c:1.9	Mon May 13 16:01:31 2013
+++ src/sys/dev/pci/voyager/pwmclock.c	Tue May 14 09:19:36 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.9 2013/05/13 16:01:31 christos Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.10 2013/05/14 09:19:36 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.9 2013/05/13 16:01:31 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.10 2013/05/14 09:19:36 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -77,6 +77,7 @@ static u_int get_pwmclock_timecount(stru
 
 struct pwmclock_softc *pwmclock;
 extern void (*initclocks_ptr)(void);
+extern struct clockframe cf;
 
 /* 0, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1 */
 static int scale_m[] = {1, 1, 3, 1, 5, 3, 7, 1};
@@ -305,14 +306,8 @@ pwmclock_intr(void *cookie)
 	if (sc-sc_step_wanted != sc-sc_step) {
 		sc-sc_step = sc-sc_step_wanted;
 	}
-#ifdef notyet
-	struct clockframe cf;
 		 
-	cf.pc = pc;
-	cf.sr = status;
-	cf.intr = (curcpu()-ci_idepth  1);
 	hardclock(cf);
-#endif
 
 	return 1;
 }



CVS commit: src/sys/dev/pci/voyager

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 16:01:31 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
make this compile again; macallan, please commit the right fix!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.8 src/sys/dev/pci/voyager/pwmclock.c:1.9
--- src/sys/dev/pci/voyager/pwmclock.c:1.8	Tue Apr 16 05:04:24 2013
+++ src/sys/dev/pci/voyager/pwmclock.c	Mon May 13 12:01:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.8 2013/04/16 09:04:24 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.9 2013/05/13 16:01:31 christos Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.8 2013/04/16 09:04:24 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.9 2013/05/13 16:01:31 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -77,7 +77,6 @@ static u_int get_pwmclock_timecount(stru
 
 struct pwmclock_softc *pwmclock;
 extern void (*initclocks_ptr)(void);
-extern struct clockframe cf;
 
 /* 0, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1 */
 static int scale_m[] = {1, 1, 3, 1, 5, 3, 7, 1};
@@ -306,7 +305,14 @@ pwmclock_intr(void *cookie)
 	if (sc-sc_step_wanted != sc-sc_step) {
 		sc-sc_step = sc-sc_step_wanted;
 	}
+#ifdef notyet
+	struct clockframe cf;
+		 
+	cf.pc = pc;
+	cf.sr = status;
+	cf.intr = (curcpu()-ci_idepth  1);
 	hardclock(cf);
+#endif
 
 	return 1;
 }



CVS commit: src/sys/dev/pci/voyager

2013-05-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 13 16:01:31 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
make this compile again; macallan, please commit the right fix!


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2013-04-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 16 09:04:24 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
unscrew this again


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.7 src/sys/dev/pci/voyager/pwmclock.c:1.8
--- src/sys/dev/pci/voyager/pwmclock.c:1.7	Mon Apr 15 19:46:16 2013
+++ src/sys/dev/pci/voyager/pwmclock.c	Tue Apr 16 09:04:24 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.7 2013/04/15 19:46:16 christos Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.8 2013/04/16 09:04:24 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.7 2013/04/15 19:46:16 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.8 2013/04/16 09:04:24 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -157,10 +157,9 @@ pwmclock_attach(device_t parent, device_
 	/* ok, let's see how far the cycle counter gets between interrupts */
 	DPRINTF(calibrating CPU timer...\n);
 	for (clk = 1; clk  8; clk++) {
-#if 0
+
 		REGVAL(LS2F_CHIPCFG0) =
 		(REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | clk;
-#endif
 		bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PWM1,
 		sc-sc_reg);
 		acc = 0;
@@ -236,10 +235,8 @@ pwmclock_shutdown(void *cookie)
 	/* just in case the interrupt handler runs again after this */
 	sc-sc_step_wanted = 7;
 	/* set the clock to full speed */
-#if 0
 	REGVAL(LS2F_CHIPCFG0) =
 	(REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | 7;
-#endif
 }
 
 void
@@ -296,11 +293,10 @@ pwmclock_intr(void *cookie)
 	 *   we only change sc_step after doing that
 	 */
 	if (sc-sc_step_wanted != sc-sc_step) {
-#if 0
+
 		REGVAL(LS2F_CHIPCFG0) =
 		(REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) |
 		 sc-sc_step_wanted;
-#endif
 	}
 
 	now = mips3_cp0_count_read();		



CVS commit: src/sys/dev/pci/voyager

2013-04-16 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 16 09:04:24 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
unscrew this again


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2013-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 15 19:46:16 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
make this compile again; macallan, please commit the right fix!


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.6 src/sys/dev/pci/voyager/pwmclock.c:1.7
--- src/sys/dev/pci/voyager/pwmclock.c:1.6	Sat Jun  2 17:36:45 2012
+++ src/sys/dev/pci/voyager/pwmclock.c	Mon Apr 15 15:46:16 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.6 2012/06/02 21:36:45 dsl Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.7 2013/04/15 19:46:16 christos Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.6 2012/06/02 21:36:45 dsl Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.7 2013/04/15 19:46:16 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -157,8 +157,10 @@ pwmclock_attach(device_t parent, device_
 	/* ok, let's see how far the cycle counter gets between interrupts */
 	DPRINTF(calibrating CPU timer...\n);
 	for (clk = 1; clk  8; clk++) {
+#if 0
 		REGVAL(LS2F_CHIPCFG0) =
 		(REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | clk;
+#endif
 		bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PWM1,
 		sc-sc_reg);
 		acc = 0;
@@ -234,8 +236,10 @@ pwmclock_shutdown(void *cookie)
 	/* just in case the interrupt handler runs again after this */
 	sc-sc_step_wanted = 7;
 	/* set the clock to full speed */
+#if 0
 	REGVAL(LS2F_CHIPCFG0) =
 	(REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | 7;
+#endif
 }
 
 void
@@ -292,9 +296,11 @@ pwmclock_intr(void *cookie)
 	 *   we only change sc_step after doing that
 	 */
 	if (sc-sc_step_wanted != sc-sc_step) {
+#if 0
 		REGVAL(LS2F_CHIPCFG0) =
 		(REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) |
 		 sc-sc_step_wanted;
+#endif
 	}
 
 	now = mips3_cp0_count_read();		



CVS commit: src/sys/dev/pci/voyager

2013-04-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 15 19:46:16 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
make this compile again; macallan, please commit the right fix!


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2013-03-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar 19 16:49:56 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
rearrange things a little bit to avoid showing garbled VRAM content while
switching colour depth


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.24 src/sys/dev/pci/voyager/voyagerfb.c:1.25
--- src/sys/dev/pci/voyager/voyagerfb.c:1.24	Wed Mar 13 21:35:18 2013
+++ src/sys/dev/pci/voyager/voyagerfb.c	Tue Mar 19 16:49:56 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.24 2013/03/13 21:35:18 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.25 2013/03/19 16:49:56 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.24 2013/03/13 21:35:18 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.25 2013/03/19 16:49:56 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -269,9 +269,6 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_depth = 8;
 #endif
 
-	/* init engine here */
-	voyagerfb_init(sc);
-
 	printf(%s: %d x %d, %d bit, stride %d\n, device_xname(self), 
 		sc-sc_width, sc-sc_height, sc-sc_depth, sc-sc_stride);
 
@@ -282,6 +279,9 @@ voyagerfb_attach(device_t parent, device
 	aprint_normal(%s: %d MB video memory at 0x%08x\n, device_xname(self),
 	(int)(sc-sc_fbsize  20), (uint32_t)sc-sc_fb);
 
+	/* init engine here */
+	voyagerfb_init(sc);
+
 	sc-sc_defaultscreen_descr = (struct wsscreen_descr){
 		default,
 		0, 0,
@@ -758,6 +758,11 @@ voyagerfb_init(struct voyagerfb_softc *s
 	}
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_FB_OFFSET,
 	(sc-sc_stride  16) | sc-sc_stride);
+
+	/* clear the screen... */
+	voyagerfb_rectfill(sc, 0, 0, sc-sc_width, sc-sc_height, 0);
+
+	/* ...and then switch colour depth. For aesthetic reasons. */
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_DISP_CTRL,
 	reg);
 
@@ -786,7 +791,7 @@ voyagerfb_init(struct voyagerfb_softc *s
 #else
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
 	sc-sc_cursor_addr);
-#endif	
+#endif
 }
 
 static void



CVS commit: src/sys/dev/pci/voyager

2013-03-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar 19 16:49:56 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
rearrange things a little bit to avoid showing garbled VRAM content while
switching colour depth


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2013-03-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 13 21:28:12 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
support anti-aliased fonts in 8bit
while there, use the DRAM config register to figure out how much video
memory we have instead of guessing


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.22 src/sys/dev/pci/voyager/voyagerfb.c:1.23
--- src/sys/dev/pci/voyager/voyagerfb.c:1.22	Wed May 30 08:05:12 2012
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Mar 13 21:28:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.22 2012/05/30 08:05:12 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.23 2013/03/13 21:28:12 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.22 2012/05/30 08:05:12 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.23 2013/03/13 21:28:12 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -144,6 +144,7 @@ static void	voyagerfb_bitblt(void *, int
 static void	voyagerfb_cursor(void *, int, int, int);
 static void	voyagerfb_putchar_mono(void *, int, int, u_int, long);
 static void	voyagerfb_putchar_aa32(void *, int, int, u_int, long);
+static void	voyagerfb_putchar_aa8(void *, int, int, u_int, long);
 static void	voyagerfb_copycols(void *, int, int, int, int);
 static void	voyagerfb_erasecols(void *, int, int, int, long);
 static void	voyagerfb_copyrows(void *, int, int, int);
@@ -206,8 +207,10 @@ voyagerfb_attach(device_t parent, device
 	struct wsemuldisplaydev_attach_args aa;
 	prop_dictionary_t	dict;
 	unsigned long		defattr;
+	uint32_t		reg;
 	bool			is_console;
 	int i, j;
+	uint8_t			cmap[768];
 
 	sc-sc_pc = vaa-vaa_pc;
 	sc-sc_pcitag = vaa-vaa_pcitag;
@@ -221,7 +224,6 @@ voyagerfb_attach(device_t parent, device
 
 	sc-sc_fb = vaa-vaa_mem_pa;
 	sc-sc_fbh = vaa-vaa_memh;
-	sc-sc_fbsize = 16 * 1024 * 1024;
 	sc-sc_fbaddr = bus_space_vaddr(sc-sc_memt, sc-sc_fbh);
 
 	sc-sc_reg = vaa-vaa_reg_pa;
@@ -230,12 +232,36 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_dataport = bus_space_vaddr(sc-sc_memt, sc-sc_regh);
 	sc-sc_dataport += SM502_DATAPORT;
 
+	sc-sc_gpio_cookie = device_private(parent);
+
+	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_DRAM_CONTROL);
+	switch(reg  0xe000) {
+		case SM502_MEM_2M:
+			sc-sc_fbsize = 2 * 1024 * 1024;
+			break;
+		case SM502_MEM_4M:
+			sc-sc_fbsize = 4 * 1024 * 1024;
+			break;
+		case SM502_MEM_8M:
+			sc-sc_fbsize = 8 * 1024 * 1024;
+			break;
+		case SM502_MEM_16M:
+			sc-sc_fbsize = 16 * 1024 * 1024;
+			break;
+		case SM502_MEM_32M:
+			sc-sc_fbsize = 32 * 1024 * 1024;
+			break;
+		case SM502_MEM_64M:
+			sc-sc_fbsize = 64 * 1024 * 1024;
+			break;
+	}
+
 	sc-sc_width = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
 		SM502_PANEL_FB_WIDTH)  SM502_FBW_WIN_WIDTH_MASK)  16;
 	sc-sc_height = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
 		SM502_PANEL_FB_HEIGHT)  SM502_FBH_WIN_HEIGHT_MASK)  16;
 
-#ifdef VOYAGERFB_ANTIALIAS
+#ifdef VOYAGERFB_DEPTH_32
 	sc-sc_depth = 32;
 #else
 	sc-sc_depth = 8;
@@ -251,7 +277,7 @@ voyagerfb_attach(device_t parent, device
 	 * XXX yeah, casting the fb address to uint32_t is formally wrong
 	 * but as far as I know there are no SM502 with 64bit BARs
 	 */
-	aprint_normal(%s: %d MB aperture at 0x%08x\n, device_xname(self),
+	aprint_normal(%s: %d MB video memory at 0x%08x\n, device_xname(self),
 	(int)(sc-sc_fbsize  20), (uint32_t)sc-sc_fb);
 
 	sc-sc_defaultscreen_descr = (struct wsscreen_descr){
@@ -272,7 +298,6 @@ voyagerfb_attach(device_t parent, device
 	sc-vd.init_screen = voyagerfb_init_screen;
 
 	/* backlight control */
-	sc-sc_gpio_cookie = device_private(parent);
 	voyagerfb_setup_backlight(sc);
 
 	ri = sc-sc_console_screen.scr_ri;
@@ -305,15 +330,16 @@ voyagerfb_attach(device_t parent, device
 		wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, 0,
 		defattr);
 
+	rasops_get_cmap(ri, cmap, sizeof(cmap));
 	j = 0;
 	if (sc-sc_depth = 8) {
-		for (i = 0; i  (1  sc-sc_depth); i++) {
+		for (i = 0; i  256; i++) {
 
-			sc-sc_cmap_red[i] = rasops_cmap[j];
-			sc-sc_cmap_green[i] = rasops_cmap[j + 1];
-			sc-sc_cmap_blue[i] = rasops_cmap[j + 2];
-			voyagerfb_putpalreg(sc, i, rasops_cmap[j],
-			rasops_cmap[j + 1], rasops_cmap[j + 2]);
+			sc-sc_cmap_red[i] = cmap[j];
+			sc-sc_cmap_green[i] = cmap[j + 1];
+			sc-sc_cmap_blue[i] = cmap[j + 2];
+			voyagerfb_putpalreg(sc, i, cmap[j], cmap[j + 1],
+			cmap[j + 2]);
 			j += 3;
 		}
 	}
@@ -384,7 +410,7 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 		if (new_mode != sc-sc_mode) {
 			sc-sc_mode = new_mode;
 			if(new_mode == WSDISPLAYIO_MODE_EMUL) {
-#ifdef VOYAGERFB_ANTIALIAS
+#ifdef 

CVS commit: src/sys/dev/pci/voyager

2013-03-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 13 21:29:06 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: files.voyager

Log Message:
defflag VOYAGERFB_DEPTH_32


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/voyager/files.voyager

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/files.voyager
diff -u src/sys/dev/pci/voyager/files.voyager:1.5 src/sys/dev/pci/voyager/files.voyager:1.6
--- src/sys/dev/pci/voyager/files.voyager:1.5	Tue Feb 21 15:26:20 2012
+++ src/sys/dev/pci/voyager/files.voyager	Wed Mar 13 21:29:05 2013
@@ -7,6 +7,7 @@ device	voyagerfb: wsemuldisplaydev, raso
 attach	voyagerfb at voyagerbus
 file	dev/pci/voyager/voyagerfb.c		voyagerfb needs-flag
 defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG VOYAGERFB_ANTIALIAS
+defflag	opt_voyagerfb.h	VOYAGERFB_DEPTH_32
 
 # a clock timer
 defflag opt_pwmclock.h PWMCLOCK_DEBUG



CVS commit: src/sys/dev/pci/voyager

2013-03-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 13 21:35:18 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
break a bunch of long lines


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.23 src/sys/dev/pci/voyager/voyagerfb.c:1.24
--- src/sys/dev/pci/voyager/voyagerfb.c:1.23	Wed Mar 13 21:28:12 2013
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Mar 13 21:35:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.23 2013/03/13 21:28:12 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.24 2013/03/13 21:35:18 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.23 2013/03/13 21:28:12 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.24 2013/03/13 21:35:18 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -151,8 +151,10 @@ static void	voyagerfb_copyrows(void *, i
 static void	voyagerfb_eraserows(void *, int, int, long);
 
 static int	voyagerfb_set_curpos(struct voyagerfb_softc *, int, int);
-static int	voyagerfb_gcursor(struct voyagerfb_softc *, struct wsdisplay_cursor *);
-static int	voyagerfb_scursor(struct voyagerfb_softc *, struct wsdisplay_cursor *);
+static int	voyagerfb_gcursor(struct voyagerfb_softc *,
+		 struct wsdisplay_cursor *);
+static int	voyagerfb_scursor(struct voyagerfb_softc *,
+		 struct wsdisplay_cursor *);
 
 struct wsdisplay_accessops voyagerfb_accessops = {
 	voyagerfb_ioctl,
@@ -317,7 +319,8 @@ voyagerfb_attach(device_t parent, device
 	} else {
 		if (sc-sc_console_screen.scr_ri.ri_rows == 0) {
 			/* do some minimal setup to avoid weirdness later */
-			vcons_init_screen(sc-vd, sc-sc_console_screen, 1, defattr);
+			vcons_init_screen(sc-vd, sc-sc_console_screen, 1,
+			defattr);
 		}
 	}
 	glyphcache_init(sc-sc_gc, sc-sc_height,
@@ -532,8 +535,8 @@ voyagerfb_mmap(void *v, void *vs, off_t 
 	/*
 	 * restrict all other mappings to processes with privileges
 	 */
-	if (kauth_authorize_machdep(kauth_cred_get(), KAUTH_MACHDEP_UNMANAGEDMEM,
-	NULL, NULL, NULL, NULL) != 0) {
+	if (kauth_authorize_machdep(kauth_cred_get(),
+	KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL) != 0) {
 		aprint_normal(%s: mmap() rejected.\n,
 		device_xname(sc-sc_dev));
 		return -1;
@@ -761,12 +764,15 @@ voyagerfb_init(struct voyagerfb_softc *s
 	/* put the cursor at the end of video memory */
 	sc-sc_cursor_addr = 16 * 1024 * 1024 - 16 * 64;	/* XXX */
 	DPRINTF(%s: %08x\n, __func__, sc-sc_cursor_addr); 
-	sc-sc_cursor = (uint32_t *)((uint8_t *)bus_space_vaddr(sc-sc_memt, sc-sc_fbh)
-			 + sc-sc_cursor_addr);
+	sc-sc_cursor = (uint32_t *)((uint8_t *)bus_space_vaddr(sc-sc_memt,
+			 sc-sc_fbh) + sc-sc_cursor_addr);
 #ifdef VOYAGERFB_DEBUG
-	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_XY, 0x00100010);
-	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL12, 0x);
-	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL3, 0xf800);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_XY,
+			 0x00100010);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL12,
+			 0x);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL3,
+			 0xf800);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
 	SM502_CRSR_ENABLE | sc-sc_cursor_addr);
 	sc-sc_cursor[0] = 0x;
@@ -1008,7 +1014,8 @@ voyagerfb_putchar_aa32(void *cookie, int
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_CONTROL, cmd);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_SRC, 0);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_DST, (x  16) | y);
-	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_DIMENSION, (wi  16) | he);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_DIMENSION,
+	(wi  16) | he);
 	rf = (fg  16)  0xff;
 	rb = (bg  16)  0xff;
 	gf = (fg  8)  0xff;
@@ -1097,7 +1104,8 @@ voyagerfb_putchar_aa8(void *cookie, int 
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_CONTROL, cmd);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_SRC, 0);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_DST, (x  16) | y);
-	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_DIMENSION, (wi  16) | he);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_DIMENSION,
+	(wi  16) | he);
 
 	/*
 	 * we need the RGB colours here, so get offsets into rasops_cmap
@@ -1286,9 +1294,11 @@ voyagerfb_set_backlight(struct voyagerfb
 		/* in these cases bypass the PWM and use the gpio */
 		voyager_control_gpio(sc-sc_gpio_cookie, ~GPIO_BACKLIGHT, 0);
 		if (level == 0) {
-			voyager_write_gpio(sc-sc_gpio_cookie, ~GPIO_BACKLIGHT, 0);
+			voyager_write_gpio(sc-sc_gpio_cookie,
+			

CVS commit: src/sys/dev/pci/voyager

2013-03-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 13 21:28:12 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
support anti-aliased fonts in 8bit
while there, use the DRAM config register to figure out how much video
memory we have instead of guessing


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2013-03-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 13 21:29:06 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: files.voyager

Log Message:
defflag VOYAGERFB_DEPTH_32


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/voyager/files.voyager

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2013-03-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 13 21:35:18 UTC 2013

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
break a bunch of long lines


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2012-05-30 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed May 30 08:05:12 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
fix some comments


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.21 src/sys/dev/pci/voyager/voyagerfb.c:1.22
--- src/sys/dev/pci/voyager/voyagerfb.c:1.21	Wed May 23 18:39:30 2012
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed May 30 08:05:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.21 2012/05/23 18:39:30 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.22 2012/05/30 08:05:12 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.21 2012/05/23 18:39:30 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.22 2012/05/30 08:05:12 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -68,7 +68,7 @@ __KERNEL_RCSID(0, $NetBSD: voyagerfb.c,
 #define DPRINTF while (0) printf
 #endif
 
-/* there are probably gdium-specific */
+/* XXX these are gdium-specific */
 #define GPIO_BACKLIGHT	0x2000
 
 struct voyagerfb_softc {
@@ -291,7 +291,7 @@ voyagerfb_attach(device_t parent, device
 		sc-sc_defaultscreen_descr.ncols = ri-ri_cols;
 	} else {
 		if (sc-sc_console_screen.scr_ri.ri_rows == 0) {
-			/* do some minimal setup to avoid weirdnesses later */
+			/* do some minimal setup to avoid weirdness later */
 			vcons_init_screen(sc-vd, sc-sc_console_screen, 1, defattr);
 		}
 	}
@@ -347,7 +347,7 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 		*(u_int *)data = WSDISPLAY_TYPE_PCIMISC;
 		return 0;
 
-	/* PCI config read/write passthrough. */
+	/* PCI config read/write pass through. */
 	case PCI_IOC_CFGREAD:
 	case PCI_IOC_CFGWRITE:
 		return pci_devioctl(sc-sc_pc, sc-sc_pcitag,
@@ -504,8 +504,7 @@ voyagerfb_mmap(void *v, void *vs, off_t 
 	}
 
 	/*
-	 * restrict all other mappings to processes with superuser privileges
-	 * or the kernel itself
+	 * restrict all other mappings to processes with privileges
 	 */
 	if (kauth_authorize_machdep(kauth_cred_get(), KAUTH_MACHDEP_UNMANAGEDMEM,
 	NULL, NULL, NULL, NULL) != 0) {



CVS commit: src/sys/dev/pci/voyager

2012-04-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 19 09:03:02 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
glyphcache_init() works best with its parameters in the right order. Doh.
While there request an RGB devcmap.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.19 src/sys/dev/pci/voyager/voyagerfb.c:1.20
--- src/sys/dev/pci/voyager/voyagerfb.c:1.19	Tue Mar 20 14:59:36 2012
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Apr 19 09:03:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.19 2012/03/20 14:59:36 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.20 2012/04/19 09:03:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.19 2012/03/20 14:59:36 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.20 2012/04/19 09:03:01 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -297,8 +297,8 @@ voyagerfb_attach(device_t parent, device
 		(*ri-ri_ops.allocattr)(ri, 0, 0, 0, defattr);
 	}
 	glyphcache_init(sc-sc_gc, sc-sc_height,
-			sc-sc_width,
 			(sc-sc_fbsize / sc-sc_stride) - sc-sc_height,
+			sc-sc_width,
 			ri-ri_font-fontwidth,
 			ri-ri_font-fontheight,
 			defattr);
@@ -548,10 +548,19 @@ voyagerfb_init_screen(void *cookie, stru
 	if (existing) {
 		ri-ri_flg |= RI_CLEAR;
 	}
+
+	if (sc-sc_depth == 32) {
 #ifdef VOYAGERFB_ANTIALIAS
-	if (sc-sc_depth == 32)
 		ri-ri_flg |= RI_ENABLE_ALPHA;
 #endif
+		/* we always run in RGB */
+		ri-ri_rnum = 8;
+		ri-ri_gnum = 8;
+		ri-ri_bnum = 8;
+		ri-ri_rpos = 16;
+		ri-ri_gpos = 8;
+		ri-ri_bpos = 0;
+	}
 
 	rasops_init(ri, 0, 0);
 	ri-ri_caps = WSSCREEN_WSCOLORS;



CVS commit: src/sys/dev/pci/voyager

2012-04-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 19 09:03:02 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
glyphcache_init() works best with its parameters in the right order. Doh.
While there request an RGB devcmap.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2012-03-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar 20 14:59:36 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
split voyagerfb_putchar() into one method for mono fonts and one for
anti-aliased fonts


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2012-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 23 07:37:17 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
set the CPU clock back to full speed on shutdown
this is necessary because PMON does not touch the clock scaling register on
reboot but still reports full CPU speed which confuses the clock code


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.3 src/sys/dev/pci/voyager/pwmclock.c:1.4
--- src/sys/dev/pci/voyager/pwmclock.c:1.3	Tue Feb 14 22:27:20 2012
+++ src/sys/dev/pci/voyager/pwmclock.c	Thu Feb 23 07:37:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.3 2012/02/14 22:27:20 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.3 2012/02/14 22:27:20 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -63,6 +63,7 @@ struct pwmclock_softc {
 	uint32_t sc_count;	/* should probably be 64 bit */
 	int sc_step;
 	int sc_step_wanted;
+	void *sc_shutdown_cookie;
 };
 
 static int	pwmclock_match(device_t, cfdata_t, void *);
@@ -89,6 +90,8 @@ static int  pwmclock_cpuspeed_temp(SYSCT
 static int  pwmclock_cpuspeed_cur(SYSCTLFN_ARGS);
 static int  pwmclock_cpuspeed_available(SYSCTLFN_ARGS);
 
+static void pwmclock_shutdown(void *);
+
 static struct timecounter pwmclock_timecounter = {
 	get_pwmclock_timecount,	/* get_timecount */
 	0,			/* no poll_pps */
@@ -140,6 +143,15 @@ pwmclock_attach(device_t parent, device_
 	pwmclock = sc;
 	initclocks_ptr = pwmclock_start;
 
+	/*
+	 * Establish a hook so on shutdown we can set the CPU clock back to
+	 * full speed. This is necessary because PMON doesn't change the 
+	 * clock scale register on a warm boot, the MIPS clock code gets
+	 * confused if we're too slow and the loongson-specific bits run
+	 * too late in the boot process
+	 */
+	sc-sc_shutdown_cookie = shutdownhook_establish(pwmclock_shutdown, sc);
+
 	/* ok, let's see how far the cycle counter gets between interrupts */
 	DPRINTF(calibrating CPU timer...\n);
 	for (clk = 1; clk  8; clk++) {
@@ -204,6 +216,17 @@ pwmclock_attach(device_t parent, device_
 		aprint_error_dev(sc-sc_dev, couldn't create 'available' node\n);
 }
 
+static void
+pwmclock_shutdown(void *cookie)
+{
+	struct pwmclock_softc *sc = cookie;
+
+	/* just in case the interrupt handler runs again after this */
+	sc-sc_step_wanted = 7;
+	/* set the clock to full speed */
+	REGVAL(LS2F_CHIPCFG0) = (REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | 7;
+}
+
 void
 pwmclock_set_speed(struct pwmclock_softc *sc, int speed)
 {



CVS commit: src/sys/dev/pci/voyager

2012-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 23 07:49:42 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
break long lines


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.4 src/sys/dev/pci/voyager/pwmclock.c:1.5
--- src/sys/dev/pci/voyager/pwmclock.c:1.4	Thu Feb 23 07:37:16 2012
+++ src/sys/dev/pci/voyager/pwmclock.c	Thu Feb 23 07:49:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.5 2012/02/23 07:49:42 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.5 2012/02/23 07:49:42 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -117,7 +117,8 @@ pwmclock_wait_edge(struct pwmclock_softc
 {
 	/* clear interrupt */
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PWM1, sc-sc_reg);
-	while ((bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_PWM1)  SM502_PWM_INTR_PENDING) == 0);
+	while ((bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_PWM1) 
+	SM502_PWM_INTR_PENDING) == 0);
 	return mips3_cp0_count_read();
 }
 
@@ -138,7 +139,8 @@ pwmclock_attach(device_t parent, device_
 
 	voyager_establish_intr(parent, 22, pwmclock_intr, sc);
 	reg = voyager_set_pwm(100, 100); /* 100Hz, 10% duty cycle */
-	reg |= SM502_PWM_ENABLE | SM502_PWM_ENABLE_INTR | SM502_PWM_INTR_PENDING;
+	reg |= SM502_PWM_ENABLE | SM502_PWM_ENABLE_INTR |
+	   SM502_PWM_INTR_PENDING;
 	sc-sc_reg = reg;
 	pwmclock = sc;
 	initclocks_ptr = pwmclock_start;
@@ -155,8 +157,10 @@ pwmclock_attach(device_t parent, device_
 	/* ok, let's see how far the cycle counter gets between interrupts */
 	DPRINTF(calibrating CPU timer...\n);
 	for (clk = 1; clk  8; clk++) {
-		REGVAL(LS2F_CHIPCFG0) = (REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | clk;
-		bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PWM1, sc-sc_reg);
+		REGVAL(LS2F_CHIPCFG0) =
+		(REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | clk;
+		bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PWM1,
+		sc-sc_reg);
 		acc = 0;
 		last = pwmclock_wait_edge(sc);
 		for (i = 0; i  16; i++) {
@@ -169,7 +173,8 @@ pwmclock_attach(device_t parent, device_
 	}
 #ifdef PWMCLOCK_DEBUG
 	for (clk = 1; clk  8; clk++) {
-		aprint_normal_dev(sc-sc_dev, %d/8: %d\n, clk + 1, sc-sc_scale[clk]);
+		aprint_normal_dev(sc-sc_dev, %d/8: %d\n, clk + 1,
+		sc-sc_scale[clk]);
 	}
 #endif
 	sc-sc_step = 7;
@@ -180,13 +185,15 @@ pwmclock_attach(device_t parent, device_
 	me, 
 	CTLFLAG_READWRITE, CTLTYPE_NODE, loongson, NULL, NULL,
 	0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL) != 0)
-		aprint_error_dev(sc-sc_dev, couldn't create 'loongson' node\n);
-	
+		aprint_error_dev(sc-sc_dev,
+		couldn't create 'loongson' node\n);
+
 	if (sysctl_createv(NULL, 0, NULL, 
 	freq, 
-	CTLFLAG_READWRITE, CTLTYPE_NODE, frequency, NULL, NULL,
-	0, NULL, 0, CTL_MACHDEP, me-sysctl_num, CTL_CREATE, CTL_EOL) != 0)
-		aprint_error_dev(sc-sc_dev, couldn't create 'frequency' node\n);
+	CTLFLAG_READWRITE, CTLTYPE_NODE, frequency, NULL, NULL, 0, NULL,
+	0, CTL_MACHDEP, me-sysctl_num, CTL_CREATE, CTL_EOL) != 0)
+		aprint_error_dev(sc-sc_dev,
+		couldn't create 'frequency' node\n);
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	sysctl_node, 
@@ -195,7 +202,8 @@ pwmclock_attach(device_t parent, device_
 	0, sc, 0, CTL_MACHDEP, me-sysctl_num, freq-sysctl_num, 
 	CTL_CREATE, CTL_EOL) == 0) {
 	} else
-		aprint_error_dev(sc-sc_dev, couldn't create 'target' node\n);
+		aprint_error_dev(sc-sc_dev,
+		couldn't create 'target' node\n);
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	sysctl_node, 
@@ -204,7 +212,8 @@ pwmclock_attach(device_t parent, device_
 	1, sc, 0, CTL_MACHDEP, me-sysctl_num, freq-sysctl_num, 
 	CTL_CREATE, CTL_EOL) == 0) {
 	} else
-		aprint_error_dev(sc-sc_dev, couldn't create 'current' node\n);
+		aprint_error_dev(sc-sc_dev,
+		couldn't create 'current' node\n);
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	sysctl_node, 
@@ -213,7 +222,8 @@ pwmclock_attach(device_t parent, device_
 	2, sc, 0, CTL_MACHDEP, me-sysctl_num, freq-sysctl_num, 
 	CTL_CREATE, CTL_EOL) == 0) {
 	} else
-		aprint_error_dev(sc-sc_dev, couldn't create 'available' node\n);
+		aprint_error_dev(sc-sc_dev,
+		couldn't create 'available' node\n);
 }
 
 static void
@@ -224,7 +234,8 @@ pwmclock_shutdown(void *cookie)
 	/* just in case the interrupt handler runs again after this */
 	sc-sc_step_wanted = 7;
 	/* set the clock to full speed */
-	REGVAL(LS2F_CHIPCFG0) = (REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) 

CVS commit: src/sys/dev/pci/voyager

2012-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 23 07:37:17 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
set the CPU clock back to full speed on shutdown
this is necessary because PMON does not touch the clock scaling register on
reboot but still reports full CPU speed which confuses the clock code


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2012-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 23 07:49:42 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
break long lines


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2012-02-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 21 15:26:20 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: files.voyager voyagerfb.c

Log Message:
use glyphcache for anti-aliased fonts


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/files.voyager
diff -u src/sys/dev/pci/voyager/files.voyager:1.4 src/sys/dev/pci/voyager/files.voyager:1.5
--- src/sys/dev/pci/voyager/files.voyager:1.4	Thu Dec 22 05:05:24 2011
+++ src/sys/dev/pci/voyager/files.voyager	Tue Feb 21 15:26:20 2012
@@ -3,7 +3,7 @@
 define voyagerbus {}
 
 # the graphics part
-device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, rasops32, vcons, videomode, iic, i2c_bitbang
+device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, rasops32, vcons, videomode, iic, i2c_bitbang, glyphcache
 attach	voyagerfb at voyagerbus
 file	dev/pci/voyager/voyagerfb.c		voyagerfb needs-flag
 defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG VOYAGERFB_ANTIALIAS

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.16 src/sys/dev/pci/voyager/voyagerfb.c:1.17
--- src/sys/dev/pci/voyager/voyagerfb.c:1.16	Wed Jan 11 16:07:29 2012
+++ src/sys/dev/pci/voyager/voyagerfb.c	Tue Feb 21 15:26:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.16 2012/01/11 16:07:29 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.17 2012/02/21 15:26:20 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.16 2012/01/11 16:07:29 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.17 2012/02/21 15:26:20 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -58,6 +58,7 @@ __KERNEL_RCSID(0, $NetBSD: voyagerfb.c,
 
 #include dev/i2c/i2cvar.h
 #include dev/pci/voyagervar.h
+#include dev/wscons/wsdisplay_glyphcachevar.h
 
 #include opt_voyagerfb.h
 
@@ -107,6 +108,8 @@ struct voyagerfb_softc {
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
+
+	glyphcache sc_gc;
 };
 
 static int	voyagerfb_match(device_t, cfdata_t, void *);
@@ -135,7 +138,7 @@ static void	voyagerfb_init(struct voyage
 
 static void	voyagerfb_rectfill(struct voyagerfb_softc *, int, int, int, int,
 			uint32_t);
-static void	voyagerfb_bitblt(struct voyagerfb_softc *, int, int, int, int,
+static void	voyagerfb_bitblt(void *, int, int, int, int,
 			int, int, int);
 
 static void	voyagerfb_cursor(void *, int, int, int);
@@ -273,6 +276,9 @@ voyagerfb_attach(device_t parent, device
 
 	ri = sc-sc_console_screen.scr_ri;
 
+	sc-sc_gc.gc_bitblt = voyagerfb_bitblt;
+	sc-sc_gc.gc_blitcookie = sc;
+	sc-sc_gc.gc_rop = ROP_COPY;
 	if (is_console) {
 		vcons_init_screen(sc-vd, sc-sc_console_screen, 1,
 		defattr);
@@ -282,8 +288,6 @@ voyagerfb_attach(device_t parent, device
 		sc-sc_defaultscreen_descr.capabilities = ri-ri_caps;
 		sc-sc_defaultscreen_descr.nrows = ri-ri_rows;
 		sc-sc_defaultscreen_descr.ncols = ri-ri_cols;
-		wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, 0,
-		defattr);
 	} else {
 		/*
 		 * since we're not the console we can postpone the rest
@@ -291,6 +295,15 @@ voyagerfb_attach(device_t parent, device
 		 */
 		(*ri-ri_ops.allocattr)(ri, 0, 0, 0, defattr);
 	}
+	glyphcache_init(sc-sc_gc, sc-sc_height,
+			sc-sc_width,
+			(sc-sc_fbsize / sc-sc_stride) - sc-sc_height,
+			ri-ri_font-fontwidth,
+			ri-ri_font-fontheight,
+			defattr);
+	if (is_console)
+		wsdisplay_cnattach(sc-sc_defaultscreen_descr, ri, 0, 0,
+		defattr);
 
 	j = 0;
 	if (sc-sc_depth = 8) {
@@ -376,6 +389,7 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 #else
 sc-sc_depth = 8;
 #endif
+glyphcache_wipe(sc-sc_gc);
 voyagerfb_init(sc);
 voyagerfb_restore_palette(sc);
 vcons_redraw_screen(ms);
@@ -736,9 +750,10 @@ voyagerfb_rectfill(struct voyagerfb_soft
 }
 
 static void
-voyagerfb_bitblt(struct voyagerfb_softc *sc, int xs, int ys, int xd, int yd,
+voyagerfb_bitblt(void *cookie, int xs, int ys, int xd, int yd,
 int wi, int he, int rop)
 {
+	struct voyagerfb_softc *sc = cookie;
 	uint32_t cmd;
 
 	cmd = (rop  0xf) | SM502_CTRL_USE_ROP2 | SM502_CTRL_CMD_BITBLT |
@@ -841,6 +856,7 @@ voyagerfb_putchar(void *cookie, int row,
 	int fg, bg;
 	uint8_t *data;
 	int x, y, wi, he;
+	int rv;
 
 	if (sc-sc_mode != WSDISPLAYIO_MODE_EMUL)
 		return;
@@ -859,6 +875,7 @@ voyagerfb_putchar(void *cookie, int row,
 		voyagerfb_rectfill(sc, x, y, wi, he, bg);
 		return;
 	}
+
 	data = WSFONT_GLYPH(c, font);
 	if (!FONT_IS_ALPHA(font)) {
 		/* this is a mono font */
@@ -902,6 +919,10 @@ voyagerfb_putchar(void *cookie, int row,
 		int rf, gf, bf, rb, gb, bb;
 		uint32_t pixel;
 
+		rv = glyphcache_try(sc-sc_gc, c, x, y, attr);
+		if (rv == GC_OK)
+			

CVS commit: src/sys/dev/pci/voyager

2012-02-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 21 15:26:20 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: files.voyager voyagerfb.c

Log Message:
use glyphcache for anti-aliased fonts


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2012-02-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 14 22:27:20 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
another blah() - blah(void)
ok riz


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.2 src/sys/dev/pci/voyager/pwmclock.c:1.3
--- src/sys/dev/pci/voyager/pwmclock.c:1.2	Tue Dec 13 14:46:07 2011
+++ src/sys/dev/pci/voyager/pwmclock.c	Tue Feb 14 22:27:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.2 2011/12/13 14:46:07 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.3 2012/02/14 22:27:20 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.2 2011/12/13 14:46:07 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.3 2012/02/14 22:27:20 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -276,7 +276,7 @@ pwmclock_intr(void *cookie)
 }
 
 static void
-pwmclock_start()
+pwmclock_start(void)
 {
 	struct pwmclock_softc *sc = pwmclock;
 	sc-sc_count = 0;



CVS commit: src/sys/dev/pci/voyager

2012-02-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Feb 14 22:27:20 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
another blah() - blah(void)
ok riz


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2012-01-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 11 16:07:29 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use rasops_init(0,0), WSFONT_GLYPH(), FONT_IS_ALPHA()


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.15 src/sys/dev/pci/voyager/voyagerfb.c:1.16
--- src/sys/dev/pci/voyager/voyagerfb.c:1.15	Wed Dec 28 18:23:01 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Jan 11 16:07:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.15 2011/12/28 18:23:01 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.16 2012/01/11 16:07:29 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.15 2011/12/28 18:23:01 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.16 2012/01/11 16:07:29 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -537,7 +537,7 @@ voyagerfb_init_screen(void *cookie, stru
 	ri-ri_flg |= RI_ENABLE_ALPHA;
 #endif
 
-	rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8);
+	rasops_init(ri, 0, 0);
 	ri-ri_caps = WSSCREEN_WSCOLORS;
 
 	rasops_reconfig(ri, sc-sc_height / ri-ri_font-fontheight,
@@ -838,7 +838,7 @@ voyagerfb_putchar(void *cookie, int row,
 	struct vcons_screen *scr = ri-ri_hw;
 	struct voyagerfb_softc *sc = scr-scr_cookie;
 	uint32_t cmd;
-	int fg, bg, uc;
+	int fg, bg;
 	uint8_t *data;
 	int x, y, wi, he;
 
@@ -859,9 +859,8 @@ voyagerfb_putchar(void *cookie, int row,
 		voyagerfb_rectfill(sc, x, y, wi, he, bg);
 		return;
 	}
-	uc = c - font-firstchar;
-	data = (uint8_t *)font-data + uc * ri-ri_fontscale;
-	if (font-stride  font-fontwidth) {
+	data = WSFONT_GLYPH(c, font);
+	if (!FONT_IS_ALPHA(font)) {
 		/* this is a mono font */
 		cmd = ROP_COPY |
 		  SM502_CTRL_USE_ROP2 |



CVS commit: src/sys/dev/pci/voyager

2012-01-11 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 11 16:07:29 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use rasops_init(0,0), WSFONT_GLYPH(), FONT_IS_ALPHA()


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 18:23:01 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
make anti-aliased fonts with odd widths work
The drawing engine needs lines padded to 64bit when doing colour host blits
which is of course not mentioned anywhere in the manual.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.14 src/sys/dev/pci/voyager/voyagerfb.c:1.15
--- src/sys/dev/pci/voyager/voyagerfb.c:1.14	Tue Dec 27 07:05:53 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Dec 28 18:23:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.15 2011/12/28 18:23:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.15 2011/12/28 18:23:01 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -838,49 +838,51 @@ voyagerfb_putchar(void *cookie, int row,
 	struct vcons_screen *scr = ri-ri_hw;
 	struct voyagerfb_softc *sc = scr-scr_cookie;
 	uint32_t cmd;
+	int fg, bg, uc;
+	uint8_t *data;
+	int x, y, wi, he;
 
-	if (sc-sc_mode == WSDISPLAYIO_MODE_EMUL) {
-		int fg, bg, uc;
-		uint8_t *data;
-		int x, y, wi, he;
-		wi = font-fontwidth;
-		he = font-fontheight;
-
-		if (!CHAR_IN_FONT(c, font))
-			return;
-		bg = ri-ri_devcmap[(attr  16)  0x0f];
-		fg = ri-ri_devcmap[(attr  24)  0x0f];
-		x = ri-ri_xorigin + col * wi;
-		y = ri-ri_yorigin + row * he;
-		if (c == 0x20) {
-			voyagerfb_rectfill(sc, x, y, wi, he, bg);
-			return;
-		}
-		uc = c - font-firstchar;
-		data = (uint8_t *)font-data + uc * ri-ri_fontscale;
-		if (font-stride  font-fontwidth) {
-			/* this is a mono font */
-			cmd = ROP_COPY |
-			  SM502_CTRL_USE_ROP2 |
-			  SM502_CTRL_CMD_HOSTWRT |
-			  SM502_CTRL_HOSTBLT_MONO |
-			  SM502_CTRL_QUICKSTART_E | 
-			  SM502_CTRL_MONO_PACK_32BIT;
-			voyagerfb_ready(sc);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_CONTROL, cmd);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			SM502_FOREGROUND, fg);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
-			SM502_BACKGROUND, bg);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_SRC, 0);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_DST, (x  16) | y);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_DIMENSION, (wi  16) | he);
-			/* now feed the data, padded to 32bit */
-			switch (ri-ri_font-stride) {
+	if (sc-sc_mode != WSDISPLAYIO_MODE_EMUL)
+		return;
+		
+	if (!CHAR_IN_FONT(c, font))
+		return;
+
+	wi = font-fontwidth;
+	he = font-fontheight;
+
+	bg = ri-ri_devcmap[(attr  16)  0x0f];
+	fg = ri-ri_devcmap[(attr  24)  0x0f];
+	x = ri-ri_xorigin + col * wi;
+	y = ri-ri_yorigin + row * he;
+	if (c == 0x20) {
+		voyagerfb_rectfill(sc, x, y, wi, he, bg);
+		return;
+	}
+	uc = c - font-firstchar;
+	data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+	if (font-stride  font-fontwidth) {
+		/* this is a mono font */
+		cmd = ROP_COPY |
+		  SM502_CTRL_USE_ROP2 |
+		  SM502_CTRL_CMD_HOSTWRT |
+		  SM502_CTRL_HOSTBLT_MONO |
+		  SM502_CTRL_QUICKSTART_E | 
+		  SM502_CTRL_MONO_PACK_32BIT;
+		voyagerfb_ready(sc);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh,
+		SM502_CONTROL, cmd);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh, 
+		SM502_FOREGROUND, fg);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh, 
+		SM502_BACKGROUND, bg);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_SRC, 0);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh,
+		SM502_DST, (x  16) | y);
+		bus_space_write_4(sc-sc_memt, sc-sc_regh,
+		SM502_DIMENSION, (wi  16) | he);
+		/* now feed the data, padded to 32bit */
+		switch (ri-ri_font-stride) {
 			case 1:
 voyagerfb_feed8(sc, data, ri-ri_fontscale);
 break;
@@ -889,38 +891,40 @@ voyagerfb_putchar(void *cookie, int row,
 ri-ri_fontscale);
 break;
 			
-			}	
-		} else {
-			/*
-			 * alpha font
-			 * we can't accelerate the actual alpha blending but
-			 * we can at least use a host blit to go through the
-			 * pipeline instead of having to sync the engine
-			 */
-			int i, r, g, b, aval;
-			int rf, gf, bf, rb, gb, bb;
-			uint32_t pixel;
-
-			cmd = ROP_COPY |
-			  SM502_CTRL_USE_ROP2 |
-			  SM502_CTRL_CMD_HOSTWRT |
-			  SM502_CTRL_QUICKSTART_E;
-			voyagerfb_ready(sc);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_CONTROL, cmd);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_SRC, 0);
-			bus_space_write_4(sc-sc_memt, sc-sc_regh,
-			SM502_DST, (x  16) | y);
-			

CVS commit: src/sys/dev/pci/voyager

2011-12-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 28 18:23:01 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
make anti-aliased fonts with odd widths work
The drawing engine needs lines padded to 64bit when doing colour host blits
which is of course not mentioned anywhere in the manual.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-26 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec 27 07:05:53 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
add fastpaths for alpha == 0 and alpha == 255 - no need to do the six
multiplications dance there, just use background or foreground colour


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.13 src/sys/dev/pci/voyager/voyagerfb.c:1.14
--- src/sys/dev/pci/voyager/voyagerfb.c:1.13	Sat Dec 24 02:28:50 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Tue Dec 27 07:05:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.13 2011/12/24 02:28:50 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.13 2011/12/24 02:28:50 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.14 2011/12/27 07:05:53 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -923,12 +923,18 @@ voyagerfb_putchar(void *cookie, int row,
 			for (i = 0; i  wi * he; i++) {
 aval = *data;
 data++;
-r = aval * rf + (255 - aval) * rb;
-g = aval * gf + (255 - aval) * gb;
-b = aval * bf + (255 - aval) * bb;
-pixel = (r  0xff00)  8 |
-(g  0xff00) |
-(b  0xff00)  8;
+if (aval == 0) {
+	pixel = bg;
+} else if (aval == 255) {
+	pixel = fg;
+} else {
+	r = aval * rf + (255 - aval) * rb;
+	g = aval * gf + (255 - aval) * gb;
+	b = aval * bf + (255 - aval) * bb;
+	pixel = (r  0xff00)  8 |
+	(g  0xff00) |
+	(b  0xff00)  8;
+}
 bus_space_write_4(sc-sc_memt, sc-sc_regh,
 SM502_DATAPORT, pixel);
 			}



CVS commit: src/sys/dev/pci/voyager

2011-12-26 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec 27 07:05:53 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
add fastpaths for alpha == 0 and alpha == 255 - no need to do the six
multiplications dance there, just use background or foreground colour


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Dec 24 02:28:50 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't put alpha values in a variable named alpha since alpha doesn't like
variables conflicting with platform names
( just in case someone figures out how to stick an sm50x into an alpha )


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.12 src/sys/dev/pci/voyager/voyagerfb.c:1.13
--- src/sys/dev/pci/voyager/voyagerfb.c:1.12	Thu Dec 22 07:42:43 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Sat Dec 24 02:28:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.12 2011/12/22 07:42:43 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.13 2011/12/24 02:28:50 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.12 2011/12/22 07:42:43 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.13 2011/12/24 02:28:50 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -897,7 +897,7 @@ voyagerfb_putchar(void *cookie, int row,
 			 * we can at least use a host blit to go through the
 			 * pipeline instead of having to sync the engine
 			 */
-			int i, r, g, b, alpha;
+			int i, r, g, b, aval;
 			int rf, gf, bf, rb, gb, bb;
 			uint32_t pixel;
 
@@ -921,11 +921,11 @@ voyagerfb_putchar(void *cookie, int row,
 			bf =  fg  0xff;
 			bb =  bg  0xff;
 			for (i = 0; i  wi * he; i++) {
-alpha = *data;
+aval = *data;
 data++;
-r = alpha * rf + (255 - alpha) * rb;
-g = alpha * gf + (255 - alpha) * gb;
-b = alpha * bf + (255 - alpha) * bb;
+r = aval * rf + (255 - aval) * rb;
+g = aval * gf + (255 - aval) * gb;
+b = aval * bf + (255 - aval) * bb;
 pixel = (r  0xff00)  8 |
 (g  0xff00) |
 (b  0xff00)  8;



CVS commit: src/sys/dev/pci/voyager

2011-12-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Dec 24 02:28:50 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't put alpha values in a variable named alpha since alpha doesn't like
variables conflicting with platform names
( just in case someone figures out how to stick an sm50x into an alpha )


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 05:05:24 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: files.voyager voyagerfb.c

Log Message:
support running in 32bit colour with anti-aliased fonts
enable with options VOYAGERFB_ANTIALIAS


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/files.voyager
diff -u src/sys/dev/pci/voyager/files.voyager:1.3 src/sys/dev/pci/voyager/files.voyager:1.4
--- src/sys/dev/pci/voyager/files.voyager:1.3	Tue Dec 13 14:46:07 2011
+++ src/sys/dev/pci/voyager/files.voyager	Thu Dec 22 05:05:24 2011
@@ -3,10 +3,10 @@
 define voyagerbus {}
 
 # the graphics part
-device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, vcons, videomode, iic, i2c_bitbang
+device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, rasops32, vcons, videomode, iic, i2c_bitbang
 attach	voyagerfb at voyagerbus
 file	dev/pci/voyager/voyagerfb.c		voyagerfb needs-flag
-defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG
+defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG VOYAGERFB_ANTIALIAS
 
 # a clock timer
 defflag opt_pwmclock.h PWMCLOCK_DEBUG

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.9 src/sys/dev/pci/voyager/voyagerfb.c:1.10
--- src/sys/dev/pci/voyager/voyagerfb.c:1.9	Tue Nov  8 07:05:06 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Dec 22 05:05:24 2011
@@ -1,7 +1,7 @@
-/*	$NetBSD: voyagerfb.c,v 1.9 2011/11/08 07:05:06 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $	*/
 
 /*
- * Copyright (c) 2009 Michael Lorenz
+ * Copyright (c) 2009, 2011 Michael Lorenz
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.9 2011/11/08 07:05:06 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -59,6 +59,8 @@ __KERNEL_RCSID(0, $NetBSD: voyagerfb.c,
 #include dev/i2c/i2cvar.h
 #include dev/pci/voyagervar.h
 
+#include opt_voyagerfb.h
+
 #ifdef VOYAGERFB_DEBUG
 #define DPRINTF aprint_error
 #else
@@ -276,8 +278,13 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_gpio_cookie = device_private(parent);
 	voyagerfb_setup_backlight(sc);
 
-	/* init engine here */
+#ifdef VOYAGERFB_ANTIALIAS
+	sc-sc_depth = 32;
+#else
 	sc-sc_depth = 8;
+#endif
+
+	/* init engine here */
 	voyagerfb_init(sc);
 
 	ri = sc-sc_console_screen.scr_ri;
@@ -538,6 +545,9 @@ voyagerfb_init_screen(void *cookie, stru
 	if (existing) {
 		ri-ri_flg |= RI_CLEAR;
 	}
+#ifdef VOYAGERFB_ANTIALIAS
+	ri-ri_flg |= RI_ENABLE_ALPHA;
+#endif
 
 	rasops_init(ri, sc-sc_height / 8, sc-sc_width / 8);
 	ri-ri_caps = WSSCREEN_WSCOLORS;
@@ -715,7 +725,7 @@ voyagerfb_init(struct voyagerfb_softc *s
 #else
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
 	sc-sc_cursor_addr);
-#endif
+#endif	
 }
 
 static void
@@ -856,9 +866,12 @@ voyagerfb_putchar(void *cookie, int row,
 		y = ri-ri_yorigin + row * he;
 		if (c == 0x20) {
 			voyagerfb_rectfill(sc, x, y, wi, he, bg);
-		} else {
-			uc = c - font-firstchar;
-			data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+			return;
+		}
+		uc = c - font-firstchar;
+		data = (uint8_t *)font-data + uc * ri-ri_fontscale;
+		if (font-stride  font-fontwidth) {
+			/* this is a mono font */
 			cmd = ROP_COPY |
 			  SM502_CTRL_USE_ROP2 |
 			  SM502_CTRL_CMD_HOSTWRT |
@@ -889,6 +902,48 @@ voyagerfb_putchar(void *cookie, int row,
 break;
 			
 			}	
+		} else {
+			/*
+			 * alpha font
+			 * we can't accelerate the actual alpha blending but
+			 * we can at least use a host blit to go through the
+			 * pipeline instead of having to sync the engine
+			 */
+			int i, r, g, b, alpha;
+			int rf, gf, bf, rb, gb, bb;
+			uint32_t pixel;
+
+			cmd = ROP_COPY |
+			  SM502_CTRL_USE_ROP2 |
+			  SM502_CTRL_CMD_HOSTWRT |
+			  SM502_CTRL_QUICKSTART_E;
+			voyagerfb_ready(sc);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_CONTROL, cmd);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_SRC, 0);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_DST, (x  16) | y);
+			bus_space_write_4(sc-sc_memt, sc-sc_regh,
+			SM502_DIMENSION, (wi  16) | he);
+			rf = (fg  16)  0xff;
+			rb = (bg  16)  0xff;
+			gf = (fg  8)  0xff;
+			gb = (bg  8)  0xff;
+			bf =  fg  0xff;
+			bb =  bg  0xff;
+			for (i = 0; i  wi * he; i++) {
+alpha = *data;
+data++;
+r = alpha * rf + (255 - alpha) * rb;
+g = alpha * gf + (255 - alpha) * gb;
+b = alpha * bf + (255 - alpha) * bb;
+pixel = (r  0xff00)  8 |
+(g  0xff00) |
+(b  0xff00)  8;
+

CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 07:32:34 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't switch to 8 bit for WSDISPLAYIO_MODE_EMUL if VOYAGERFB_ANTIALIAS
is defined


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.10 src/sys/dev/pci/voyager/voyagerfb.c:1.11
--- src/sys/dev/pci/voyager/voyagerfb.c:1.10	Thu Dec 22 05:05:24 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Dec 22 07:32:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.10 2011/12/22 05:05:24 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -387,7 +387,11 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 		if (new_mode != sc-sc_mode) {
 			sc-sc_mode = new_mode;
 			if(new_mode == WSDISPLAYIO_MODE_EMUL) {
+#ifdef VOYAGERFB_ANTIALIAS
+sc-sc_depth = 32;
+#else
 sc-sc_depth = 8;
+#endif
 voyagerfb_init(sc);
 voyagerfb_restore_palette(sc);
 vcons_redraw_screen(ms);



CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 07:42:43 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't probe colour depth on attach - we're going to change it anyway


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.11 src/sys/dev/pci/voyager/voyagerfb.c:1.12
--- src/sys/dev/pci/voyager/voyagerfb.c:1.11	Thu Dec 22 07:32:33 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Dec 22 07:42:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.12 2011/12/22 07:42:43 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009, 2011 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.11 2011/12/22 07:32:33 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.12 2011/12/22 07:42:43 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -202,7 +202,6 @@ voyagerfb_attach(device_t parent, device
 	struct wsemuldisplaydev_attach_args aa;
 	prop_dictionary_t	dict;
 	unsigned long		defattr;
-	uint32_t		reg;
 	bool			is_console;
 	int i, j;
 
@@ -227,29 +226,23 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_dataport = bus_space_vaddr(sc-sc_memt, sc-sc_regh);
 	sc-sc_dataport += SM502_DATAPORT;
 
-	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_DISP_CTRL);
-	switch (reg  SM502_PDC_DEPTH_MASK) {
-		case SM502_PDC_8BIT:
-			sc-sc_depth = 8;
-			break;
-		case SM502_PDC_16BIT:
-			sc-sc_depth = 16;
-			break;
-		case SM502_PDC_32BIT:
-			sc-sc_depth = 24;
-			break;
-		default:
-			panic(%s: unsupported depth, device_xname(self));
-	}
-	sc-sc_stride = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
-		SM502_PANEL_FB_OFFSET)  SM502_FBA_WIN_STRIDE_MASK)  16;
 	sc-sc_width = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
 		SM502_PANEL_FB_WIDTH)  SM502_FBW_WIN_WIDTH_MASK)  16;
 	sc-sc_height = (bus_space_read_4(sc-sc_memt, sc-sc_regh, 	
 		SM502_PANEL_FB_HEIGHT)  SM502_FBH_WIN_HEIGHT_MASK)  16;
 
+#ifdef VOYAGERFB_ANTIALIAS
+	sc-sc_depth = 32;
+#else
+	sc-sc_depth = 8;
+#endif
+
+	/* init engine here */
+	voyagerfb_init(sc);
+
 	printf(%s: %d x %d, %d bit, stride %d\n, device_xname(self), 
 		sc-sc_width, sc-sc_height, sc-sc_depth, sc-sc_stride);
+
 	/*
 	 * XXX yeah, casting the fb address to uint32_t is formally wrong
 	 * but as far as I know there are no SM502 with 64bit BARs
@@ -278,15 +271,6 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_gpio_cookie = device_private(parent);
 	voyagerfb_setup_backlight(sc);
 
-#ifdef VOYAGERFB_ANTIALIAS
-	sc-sc_depth = 32;
-#else
-	sc-sc_depth = 8;
-#endif
-
-	/* init engine here */
-	voyagerfb_init(sc);
-
 	ri = sc-sc_console_screen.scr_ri;
 
 	if (is_console) {



CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 05:05:24 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: files.voyager voyagerfb.c

Log Message:
support running in 32bit colour with anti-aliased fonts
enable with options VOYAGERFB_ANTIALIAS


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 07:32:34 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't switch to 8 bit for WSDISPLAYIO_MODE_EMUL if VOYAGERFB_ANTIALIAS
is defined


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-21 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Dec 22 07:42:43 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
don't probe colour depth on attach - we're going to change it anyway


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec 13 14:39:37 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: files.voyager
Added Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
an alternative clock implementation for Loongson2F and SM502, mostly
Gdium-specific.
This supports Loongson2F frequency scaling. The problem is that Gdium has
no CPU clock independent high resolution timer we can use as a timecounter
so we use one of the SM502's PWMs to generate a 100Hz timer interrupt, use
the cp0 counter to measure time and adjust for frequency changes.
Other Loongson-based machines will need something similar but hopefully
less hackish.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/files.voyager
diff -u src/sys/dev/pci/voyager/files.voyager:1.1 src/sys/dev/pci/voyager/files.voyager:1.2
--- src/sys/dev/pci/voyager/files.voyager:1.1	Wed Aug 31 16:47:31 2011
+++ src/sys/dev/pci/voyager/files.voyager	Tue Dec 13 14:39:37 2011
@@ -3,7 +3,17 @@
 define voyagerbus {}
 
 # the graphics part
-device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, rasops32, vcons, videomode, iic, i2c_bitbang
+device	voyagerfb: wsemuldisplaydev, rasops8, rasops16, vcons, videomode, iic, i2c_bitbang
 attach	voyagerfb at voyagerbus
-file	dev/pci/voyager/voyagerfb.c		voyagerfb
+file	dev/pci/voyager/voyagerfb.c		voyagerfb needs-flag
 defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG
+
+# a clock timer
+device 	pwmclock
+attach 	pwmclock at voyagerbus
+file	dev/pci/voyager/pwmclock.c		pwmclock needs-flag
+
+# the audio part
+device 	vac: audiobus, auconv, mulaw
+attach 	vac at voyagerbus
+file 	dev/pci/voyager/vac.c			vac needs-flag

Added files:

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u /dev/null src/sys/dev/pci/voyager/pwmclock.c:1.1
--- /dev/null	Tue Dec 13 14:39:37 2011
+++ src/sys/dev/pci/voyager/pwmclock.c	Tue Dec 13 14:39:37 2011
@@ -0,0 +1,355 @@
+/*	$NetBSD: pwmclock.c,v 1.1 2011/12/13 14:39:37 macallan Exp $	*/
+
+/*
+ * Copyright (c) 2011 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.1 2011/12/13 14:39:37 macallan Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/device.h
+#include sys/cpu.h
+#include sys/timetc.h
+#include sys/sysctl.h
+
+#include dev/pci/voyagervar.h
+#include dev/ic/sm502reg.h
+
+#include mips/mips3_clock.h
+#include mips/locore.h
+#include mips/bonito/bonitoreg.h
+#include mips/bonito/bonitovar.h
+
+#ifdef PWMCLOCK_DEBUG
+#define DPRINTF aprint_error
+#else
+#define DPRINTF while (0) printf
+#endif
+
+int pwmclock_intr(void *);
+
+struct pwmclock_softc {
+	device_t sc_dev;
+	bus_space_tag_t sc_memt;
+	bus_space_handle_t sc_regh;
+	uint32_t sc_reg, sc_last;
+	uint32_t sc_scale[8];
+	uint32_t sc_count;	/* should probably be 64 bit */
+	int sc_step;
+	int sc_step_wanted;
+};
+
+static int	pwmclock_match(device_t, cfdata_t, void *);
+static void	pwmclock_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(pwmclock, sizeof(struct pwmclock_softc),
+pwmclock_match, pwmclock_attach, NULL, NULL);
+
+static void pwmclock_start(void);
+static u_int get_pwmclock_timecount(struct timecounter *);
+
+struct pwmclock_softc *pwmclock;
+extern void (*initclocks_ptr)(void);
+extern struct clockframe cf;
+
+/* 0, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1 */
+static int scale_m[] = {1, 1, 3, 1, 5, 3, 7, 1};
+static int scale_d[] = {0, 4, 8, 2, 8, 4, 8, 1};
+
+#define 

CVS commit: src/sys/dev/pci/voyager

2011-12-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec 13 14:46:07 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: files.voyager pwmclock.c

Log Message:
define and use PWMCLOCK_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/files.voyager
diff -u src/sys/dev/pci/voyager/files.voyager:1.2 src/sys/dev/pci/voyager/files.voyager:1.3
--- src/sys/dev/pci/voyager/files.voyager:1.2	Tue Dec 13 14:39:37 2011
+++ src/sys/dev/pci/voyager/files.voyager	Tue Dec 13 14:46:07 2011
@@ -9,6 +9,7 @@ file	dev/pci/voyager/voyagerfb.c		voyage
 defflag	opt_voyagerfb.h	VOYAGERFB_DEBUG
 
 # a clock timer
+defflag opt_pwmclock.h PWMCLOCK_DEBUG
 device 	pwmclock
 attach 	pwmclock at voyagerbus
 file	dev/pci/voyager/pwmclock.c		pwmclock needs-flag

Index: src/sys/dev/pci/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.1 src/sys/dev/pci/voyager/pwmclock.c:1.2
--- src/sys/dev/pci/voyager/pwmclock.c:1.1	Tue Dec 13 14:39:37 2011
+++ src/sys/dev/pci/voyager/pwmclock.c	Tue Dec 13 14:46:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.1 2011/12/13 14:39:37 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.2 2011/12/13 14:46:07 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.1 2011/12/13 14:39:37 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: pwmclock.c,v 1.2 2011/12/13 14:46:07 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -44,6 +44,8 @@ __KERNEL_RCSID(0, $NetBSD: pwmclock.c,v
 #include mips/bonito/bonitoreg.h
 #include mips/bonito/bonitovar.h
 
+#include opt_pwmclock.h
+
 #ifdef PWMCLOCK_DEBUG
 #define DPRINTF aprint_error
 #else
@@ -139,7 +141,7 @@ pwmclock_attach(device_t parent, device_
 	initclocks_ptr = pwmclock_start;
 
 	/* ok, let's see how far the cycle counter gets between interrupts */
-	aprint_normal_dev(sc-sc_dev, calibrating CPU timer...\n);
+	DPRINTF(calibrating CPU timer...\n);
 	for (clk = 1; clk  8; clk++) {
 		REGVAL(LS2F_CHIPCFG0) = (REGVAL(LS2F_CHIPCFG0)  ~LS2FCFG_FREQSCALE_MASK) | clk;
 		bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PWM1, sc-sc_reg);
@@ -153,9 +155,11 @@ pwmclock_attach(device_t parent, device_
 		}
 		sc-sc_scale[clk] = (acc  4) / 5000;
 	}
+#ifdef PWMCLOCK_DEBUG
 	for (clk = 1; clk  8; clk++) {
 		aprint_normal_dev(sc-sc_dev, %d/8: %d\n, clk + 1, sc-sc_scale[clk]);
 	}
+#endif
 	sc-sc_step = 7;
 	sc-sc_step_wanted = 7;
 



CVS commit: src/sys/dev/pci/voyager

2011-12-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec 13 14:39:37 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: files.voyager
Added Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
an alternative clock implementation for Loongson2F and SM502, mostly
Gdium-specific.
This supports Loongson2F frequency scaling. The problem is that Gdium has
no CPU clock independent high resolution timer we can use as a timecounter
so we use one of the SM502's PWMs to generate a 100Hz timer interrupt, use
the cp0 counter to measure time and adjust for frequency changes.
Other Loongson-based machines will need something similar but hopefully
less hackish.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-12-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec 13 14:46:07 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: files.voyager pwmclock.c

Log Message:
define and use PWMCLOCK_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/voyager/files.voyager
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/voyager/pwmclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-11-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov  8 06:56:08 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
run the console in 8 bit colour for additional speed
( on Gdium this scrolls more than twice as fast as the 16bit default mode )


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.7 src/sys/dev/pci/voyager/voyagerfb.c:1.8
--- src/sys/dev/pci/voyager/voyagerfb.c:1.7	Tue Oct 18 17:59:01 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Tue Nov  8 06:56:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.7 2011/10/18 17:59:01 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.8 2011/11/08 06:56:07 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.7 2011/10/18 17:59:01 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.8 2011/11/08 06:56:07 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -225,7 +225,7 @@ voyagerfb_attach(device_t parent, device
 	sc-sc_dataport = bus_space_vaddr(sc-sc_memt, sc-sc_regh);
 	sc-sc_dataport += SM502_DATAPORT;
 
-	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_DISP_CRTL);
+	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_DISP_CTRL);
 	switch (reg  SM502_PDC_DEPTH_MASK) {
 		case SM502_PDC_8BIT:
 			sc-sc_depth = 8;
@@ -277,6 +277,7 @@ voyagerfb_attach(device_t parent, device
 	voyagerfb_setup_backlight(sc);
 
 	/* init engine here */
+	sc-sc_depth = 8;
 	voyagerfb_init(sc);
 
 	ri = sc-sc_console_screen.scr_ri;
@@ -639,6 +640,7 @@ voyagerfb_putpalreg(struct voyagerfb_sof
 static void
 voyagerfb_init(struct voyagerfb_softc *sc)
 {
+	int reg;
 
 	voyagerfb_wait(sc);
 	/* disable colour compare */
@@ -657,21 +659,35 @@ voyagerfb_init(struct voyagerfb_softc *s
 	/* window is screen width */
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_WINDOW_WIDTH,
 	sc-sc_width | (sc-sc_width  16));
+	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_DISP_CTRL);
+	reg = ~SM502_PDC_DEPTH_MASK;
+	
 	switch (sc-sc_depth) {
 		case 8:
 			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
 			SM502_STRETCH, SM502_STRETCH_8BIT);
+			sc-sc_stride = sc-sc_width;
+			reg |= SM502_PDC_8BIT;
 			break;
 		case 16:
 			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
 			SM502_STRETCH, SM502_STRETCH_16BIT);
+			sc-sc_stride = sc-sc_width  1;
+			reg |= SM502_PDC_16BIT;
 			break;
 		case 24:
 		case 32:
 			bus_space_write_4(sc-sc_memt, sc-sc_regh, 
 			SM502_STRETCH, SM502_STRETCH_32BIT);
+			sc-sc_stride = sc-sc_width  2;
+			reg |= SM502_PDC_32BIT;
 			break;
 	}
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_FB_OFFSET,
+	(sc-sc_stride  16) | sc-sc_stride);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_DISP_CTRL,
+	reg);
+
 	/* put the cursor at the end of video memory */
 	sc-sc_cursor_addr = 16 * 1024 * 1024 - 16 * 64;	/* XXX */
 	DPRINTF(%s: %08x\n, __func__, sc-sc_cursor_addr); 



CVS commit: src/sys/dev/pci/voyager

2011-11-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov  8 07:05:06 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
switch to 32bit colour for X, switch back to 8 bit for console emulation


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.8 src/sys/dev/pci/voyager/voyagerfb.c:1.9
--- src/sys/dev/pci/voyager/voyagerfb.c:1.8	Tue Nov  8 06:56:07 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Tue Nov  8 07:05:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.8 2011/11/08 06:56:07 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.9 2011/11/08 07:05:06 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.8 2011/11/08 06:56:07 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.9 2011/11/08 07:05:06 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -359,7 +359,7 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 		wdf = (void *)data;
 		wdf-height = ms-scr_ri.ri_height;
 		wdf-width = ms-scr_ri.ri_width;
-		wdf-depth = ms-scr_ri.ri_depth;
+		wdf-depth = 32;
 		wdf-cmsize = 256;
 		return 0;
 
@@ -380,8 +380,13 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 		if (new_mode != sc-sc_mode) {
 			sc-sc_mode = new_mode;
 			if(new_mode == WSDISPLAYIO_MODE_EMUL) {
+sc-sc_depth = 8;
+voyagerfb_init(sc);
 voyagerfb_restore_palette(sc);
 vcons_redraw_screen(ms);
+			} else {
+sc-sc_depth = 32;
+voyagerfb_init(sc);
 			}
 		}
 		}



CVS commit: src/sys/dev/pci/voyager

2011-11-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov  8 06:56:08 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
run the console in 8 bit colour for additional speed
( on Gdium this scrolls more than twice as fast as the 16bit default mode )


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-11-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Nov  8 07:05:06 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
switch to 32bit colour for X, switch back to 8 bit for console emulation


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-10-18 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Oct 18 17:59:01 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
add backlight control via sm502 PWM


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-09-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 28 02:36:37 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
support a hardware cursor - now X with wsfb on gdium is a little less annoying


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.5 src/sys/dev/pci/voyager/voyagerfb.c:1.6
--- src/sys/dev/pci/voyager/voyagerfb.c:1.5	Thu Sep 22 06:16:13 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Wed Sep 28 02:36:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.5 2011/09/22 06:16:13 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.6 2011/09/28 02:36:37 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.5 2011/09/22 06:16:13 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.6 2011/09/28 02:36:37 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -59,6 +59,12 @@ __KERNEL_RCSID(0, $NetBSD: voyagerfb.c,
 #include dev/i2c/i2cvar.h
 #include dev/pci/voyagervar.h
 
+#ifdef VOYAGERFB_DEBUG
+#define DPRINTF aprint_error
+#else
+#define DPRINTF while (0) printf
+#endif
+
 /* there are probably gdium-specific */
 #define GPIO_BACKLIGHT	0x2000
 
@@ -86,6 +92,16 @@ struct voyagerfb_softc {
 	int sc_mode;
 	int sc_bl_on, sc_bl_level;
 	void *sc_gpio_cookie;
+
+	/* cursor stuff */
+	int sc_cur_x;
+	int sc_cur_y;
+	int sc_hot_x;
+	int sc_hot_y;
+	uint32_t sc_cursor_addr;
+	uint32_t *sc_cursor;
+ 
+	/* colour map */
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
@@ -127,6 +143,10 @@ static void	voyagerfb_erasecols(void *, 
 static void	voyagerfb_copyrows(void *, int, int, int);
 static void	voyagerfb_eraserows(void *, int, int, long);
 
+static int	voyagerfb_set_curpos(struct voyagerfb_softc *, int, int);
+static int	voyagerfb_gcursor(struct voyagerfb_softc *, struct wsdisplay_cursor *);
+static int	voyagerfb_scursor(struct voyagerfb_softc *, struct wsdisplay_cursor *);
+
 struct wsdisplay_accessops voyagerfb_accessops = {
 	voyagerfb_ioctl,
 	voyagerfb_mmap,
@@ -410,6 +430,51 @@ voyagerfb_ioctl(void *v, void *vs, u_lon
 			return 0;
 		}
 		return EPASSTHROUGH;
+
+	case WSDISPLAYIO_GCURPOS:
+		{
+			struct wsdisplay_curpos *pos;
+
+			pos = (struct wsdisplay_curpos *)data;
+			pos-x = sc-sc_cur_x;
+			pos-y = sc-sc_cur_y;
+		}
+		return 0;
+
+	case WSDISPLAYIO_SCURPOS:
+		{
+			struct wsdisplay_curpos *pos;
+
+			pos = (struct wsdisplay_curpos *)data;
+			voyagerfb_set_curpos(sc, pos-x, pos-y);
+		}
+		return 0;
+
+	case WSDISPLAYIO_GCURMAX:
+		{
+			struct wsdisplay_curpos *pos;
+
+			pos = (struct wsdisplay_curpos *)data;
+			pos-x = 64;
+			pos-y = 64;
+		}
+		return 0;
+
+	case WSDISPLAYIO_GCURSOR:
+		{
+			struct wsdisplay_cursor *cu;
+
+			cu = (struct wsdisplay_cursor *)data;
+			return voyagerfb_gcursor(sc, cu);
+		}
+
+	case WSDISPLAYIO_SCURSOR:
+		{
+			struct wsdisplay_cursor *cu;
+
+			cu = (struct wsdisplay_cursor *)data;
+			return voyagerfb_scursor(sc, cu);
+		}
 	}
 	return EPASSTHROUGH;
 }
@@ -612,6 +677,29 @@ voyagerfb_init(struct voyagerfb_softc *s
 			SM502_STRETCH, SM502_STRETCH_32BIT);
 			break;
 	}
+	/* put the cursor at the end of video memory */
+	sc-sc_cursor_addr = 16 * 1024 * 1024 - 16 * 64;	/* XXX */
+	DPRINTF(%s: %08x\n, __func__, sc-sc_cursor_addr); 
+	sc-sc_cursor = (uint32_t *)((uint8_t *)bus_space_vaddr(sc-sc_memt, sc-sc_fbh)
+			 + sc-sc_cursor_addr);
+#ifdef VOYAGERFB_DEBUG
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_XY, 0x00100010);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL12, 0x);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_COL3, 0xf800);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
+	SM502_CRSR_ENABLE | sc-sc_cursor_addr);
+	sc-sc_cursor[0] = 0x;
+	sc-sc_cursor[1] = 0x;
+	sc-sc_cursor[2] = 0x;
+	sc-sc_cursor[3] = 0x;
+	sc-sc_cursor[4] = 0x;
+	sc-sc_cursor[5] = 0x;
+	sc-sc_cursor[6] = 0x;
+	sc-sc_cursor[7] = 0x;
+#else
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_ADDR,
+	sc-sc_cursor_addr);
+#endif
 }
 
 static void
@@ -930,3 +1018,115 @@ voyagerfb_brightness_down(device_t dev)
 
 	voyagerfb_set_backlight(sc, sc-sc_bl_level - 8);
 }
+
+static int
+voyagerfb_set_curpos(struct voyagerfb_softc *sc, int x, int y)
+{
+	uint32_t val;
+	int xx, yy;
+
+	sc-sc_cur_x = x;
+	sc-sc_cur_y = y;
+
+	xx = x - sc-sc_hot_x;
+	yy = y - sc-sc_hot_y;
+	
+	if (xx  0) xx = abs(xx) | 0x800;
+	if (yy  0) yy = abs(yy) | 0x800;
+	
+	val = (xx  0x) | (yy  16);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, SM502_PANEL_CRSR_XY, val);
+
+	return 0;
+}
+

CVS commit: src/sys/dev/pci/voyager

2011-09-27 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Sep 28 02:36:37 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
support a hardware cursor - now X with wsfb on gdium is a little less annoying


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-09-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep 22 06:16:13 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use BUS_SPACE_MAP_PREFETCHABLE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.4 src/sys/dev/pci/voyager/voyagerfb.c:1.5
--- src/sys/dev/pci/voyager/voyagerfb.c:1.4	Tue Sep 20 06:15:02 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Thu Sep 22 06:16:13 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.4 2011/09/20 06:15:02 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.5 2011/09/22 06:16:13 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.4 2011/09/20 06:15:02 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.5 2011/09/22 06:16:13 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -424,7 +424,7 @@
 	/* 'regular' framebuffer mmap()ing */
 	if (offset  sc-sc_fbsize) {
 		pa = bus_space_mmap(sc-sc_memt, sc-sc_fb + offset, 0, prot,
-		BUS_SPACE_MAP_LINEAR);
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE);
 		return pa;
 	}
 
@@ -441,14 +441,13 @@
 
 	if ((offset = sc-sc_fb)  (offset  (sc-sc_fb + sc-sc_fbsize))) {
 		pa = bus_space_mmap(sc-sc_memt, offset, 0, prot,
-		BUS_SPACE_MAP_LINEAR);
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE);
 		return pa;
 	}
 
 	if ((offset = sc-sc_reg)  
 	(offset  (sc-sc_reg + sc-sc_regsize))) {
-		pa = bus_space_mmap(sc-sc_memt, offset, 0, prot,
-		BUS_SPACE_MAP_LINEAR);
+		pa = bus_space_mmap(sc-sc_memt, offset, 0, prot, 0);
 		return pa;
 	}
 



CVS commit: src/sys/dev/pci/voyager

2011-09-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep 22 06:16:13 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
use BUS_SPACE_MAP_PREFETCHABLE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep 20 06:15:02 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
support ioctl(WSDISPLAYIO_SVIDEO) and friends so wsfb can turn the backlight
off


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.3 src/sys/dev/pci/voyager/voyagerfb.c:1.4
--- src/sys/dev/pci/voyager/voyagerfb.c:1.3	Tue Sep  6 06:27:14 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Tue Sep 20 06:15:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.3 2011/09/06 06:27:14 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.4 2011/09/20 06:15:02 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.3 2011/09/06 06:27:14 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.4 2011/09/20 06:15:02 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -371,6 +371,18 @@
 		}
 		return 0;
 
+	case WSDISPLAYIO_GVIDEO:
+		*(int *)data = sc-sc_bl_on ? WSDISPLAYIO_VIDEO_ON :
+	  WSDISPLAYIO_VIDEO_OFF;
+		return 0;
+
+	case WSDISPLAYIO_SVIDEO: {
+			int new_bl = *(int *)data;
+
+			voyagerfb_switch_backlight(sc,  new_bl);
+		}
+		return 0;
+
 	case WSDISPLAYIO_GETPARAM:
 		param = (struct wsdisplay_param *)data;
 		switch (param-param) {



CVS commit: src/sys/dev/pci/voyager

2011-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep 20 06:15:02 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
support ioctl(WSDISPLAYIO_SVIDEO) and friends so wsfb can turn the backlight
off


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-09-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep  6 06:27:15 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
add simple backlight control support, only on/off for now


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/voyager/voyagerfb.c
diff -u src/sys/dev/pci/voyager/voyagerfb.c:1.2 src/sys/dev/pci/voyager/voyagerfb.c:1.3
--- src/sys/dev/pci/voyager/voyagerfb.c:1.2	Tue Sep  6 03:31:37 2011
+++ src/sys/dev/pci/voyager/voyagerfb.c	Tue Sep  6 06:27:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.2 2011/09/06 03:31:37 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.3 2011/09/06 06:27:14 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.2 2011/09/06 03:31:37 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: voyagerfb.c,v 1.3 2011/09/06 06:27:14 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -59,6 +59,9 @@
 #include dev/i2c/i2cvar.h
 #include dev/pci/voyagervar.h
 
+/* there are probably gdium-specific */
+#define GPIO_BACKLIGHT	0x2000
+
 struct voyagerfb_softc {
 	device_t sc_dev;
 
@@ -81,6 +84,8 @@
 	struct vcons_data vd;
 	uint8_t *sc_dataport;
 	int sc_mode;
+	int sc_bl_on, sc_bl_level;
+	void *sc_gpio_cookie;
 	u_char sc_cmap_red[256];
 	u_char sc_cmap_green[256];
 	u_char sc_cmap_blue[256];
@@ -133,6 +138,13 @@
 	NULL	/* scroll */
 };
 
+static void	voyagerfb_brightness_up(device_t);
+static void	voyagerfb_brightness_down(device_t);
+/* set backlight level */
+static void	voyagerfb_set_backlight(struct voyagerfb_softc *, int);
+/* turn backlight on and off without messing with the level */
+static void	voyagerfb_switch_backlight(struct voyagerfb_softc *, int);
+
 /* wait for FIFO empty so we can feed it another command */
 static inline void
 voyagerfb_ready(struct voyagerfb_softc *sc)
@@ -239,6 +251,16 @@
 	voyagerfb_accessops);
 	sc-vd.init_screen = voyagerfb_init_screen;
 
+	/* backlight control */
+	sc-sc_gpio_cookie = device_private(parent);
+	voyager_write_gpio(sc-sc_gpio_cookie, 0x, GPIO_BACKLIGHT);
+	sc-sc_bl_on = 1;
+	sc-sc_bl_level = 255;
+	pmf_event_register(sc-sc_dev, PMFE_DISPLAY_BRIGHTNESS_UP,
+	voyagerfb_brightness_up, TRUE);
+	pmf_event_register(sc-sc_dev, PMFE_DISPLAY_BRIGHTNESS_DOWN,
+	voyagerfb_brightness_down, TRUE);
+
 	/* init engine here */
 	voyagerfb_init(sc);
 
@@ -298,6 +320,7 @@
 	struct voyagerfb_softc *sc = vd-cookie;
 	struct wsdisplay_fbinfo *wdf;
 	struct vcons_screen *ms = vd-active;
+	struct wsdisplay_param  *param;
 
 	switch (cmd) {
 	case WSDISPLAYIO_GTYPE:
@@ -347,6 +370,34 @@
 		}
 		}
 		return 0;
+
+	case WSDISPLAYIO_GETPARAM:
+		param = (struct wsdisplay_param *)data;
+		switch (param-param) {
+		case WSDISPLAYIO_PARAM_BRIGHTNESS:
+			param-min = 0;
+			param-max = 255;
+			param-curval = sc-sc_bl_level;
+			return 0;
+		case WSDISPLAYIO_PARAM_BACKLIGHT:
+			param-min = 0;
+			param-max = 1;
+			param-curval = sc-sc_bl_on;
+			return 0;
+		}
+		return EPASSTHROUGH;
+
+	case WSDISPLAYIO_SETPARAM:
+		param = (struct wsdisplay_param *)data;
+		switch (param-param) {
+		case WSDISPLAYIO_PARAM_BRIGHTNESS:
+			voyagerfb_set_backlight(sc, param-curval);
+			return 0;
+		case WSDISPLAYIO_PARAM_BACKLIGHT:
+			voyagerfb_switch_backlight(sc,  param-curval);
+			return 0;
+		}
+		return EPASSTHROUGH;
 	}
 	return EPASSTHROUGH;
 }
@@ -818,3 +869,53 @@
 		voyagerfb_rectfill(sc, x, y, width, height, ri-ri_devcmap[bg]);
 	}
 }
+
+/* backlight control */
+static void
+voyagerfb_set_backlight(struct voyagerfb_softc *sc, int level)
+{
+
+	/*
+	 * should we do nothing when backlight is off, should we just store the
+	 * level and use it when turning back on or should we just flip sc_bl_on
+	 * and turn the backlight on?
+	 * For now turn it on so a crashed screensaver can't get the user stuck
+	 * with a dark screen as long as hotkeys work
+	 */
+	if (level  255) level = 255;
+	if (level  0) level = 0;
+	if (level == sc-sc_bl_level)
+		return;
+	sc-sc_bl_level = level;
+	if (sc-sc_bl_on == 0)
+		sc-sc_bl_on = 1;
+	level = 255 - level;
+	/* and here we would actually muck with the hardware */
+}
+
+static void
+voyagerfb_switch_backlight(struct voyagerfb_softc *sc, int on)
+{
+
+	if (on == sc-sc_bl_on)
+		return;
+	sc-sc_bl_on = on;
+	voyager_write_gpio(sc-sc_gpio_cookie, ~GPIO_BACKLIGHT, on ? GPIO_BACKLIGHT : 0);
+}
+	
+
+static void
+voyagerfb_brightness_up(device_t dev)
+{
+	struct voyagerfb_softc *sc = device_private(dev);
+
+	voyagerfb_set_backlight(sc, sc-sc_bl_level + 8);
+}
+
+static void
+voyagerfb_brightness_down(device_t dev)
+{
+	struct voyagerfb_softc *sc = device_private(dev);
+
+	voyagerfb_set_backlight(sc, sc-sc_bl_level - 8);
+}



CVS commit: src/sys/dev/pci/voyager

2011-09-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep  6 06:27:15 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
add simple backlight control support, only on/off for now


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/pci/voyager

2011-09-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Sep  6 03:31:37 UTC 2011

Modified Files:
src/sys/dev/pci/voyager: voyagerfb.c

Log Message:
wsdisplayio_busid_pci() needs out parent since we don't attach directly
to a PCI bus anymore


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/voyager/voyagerfb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.