Module Name:    src
Committed By:   macallan
Date:           Tue May  4 05:00:33 UTC 2010

Modified Files:
        src/sys/dev/pci: chipsfb.c pm2fb.c radeonfb.c voodoofb.c voyagerfb.c

Log Message:
use alternate font if available ( for autogenerated box drawing characters )


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/chipsfb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/pm2fb.c
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/pci/radeonfb.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/voodoofb.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/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/chipsfb.c
diff -u src/sys/dev/pci/chipsfb.c:1.20 src/sys/dev/pci/chipsfb.c:1.21
--- src/sys/dev/pci/chipsfb.c:1.20	Thu Aug 20 02:40:57 2009
+++ src/sys/dev/pci/chipsfb.c	Tue May  4 05:00:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: chipsfb.c,v 1.20 2009/08/20 02:40:57 macallan Exp $	*/
+/*	$NetBSD: chipsfb.c,v 1.21 2010/05/04 05:00:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2006 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.20 2009/08/20 02:40:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: chipsfb.c,v 1.21 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -682,6 +682,7 @@
 chipsfb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
 	struct rasops_info *ri = cookie;
+	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct vcons_screen *scr = ri->ri_hw;
 	struct chipsfb_softc *sc = scr->scr_cookie;
 
@@ -694,10 +695,10 @@
 		int fg, bg, uc;
 		int x, y, wi, he;
 
-		wi = ri->ri_font->fontwidth;
-		he = ri->ri_font->fontheight;
+		wi = font->fontwidth;
+		he = font->fontheight;
 
-		if (!CHAR_IN_FONT(c, ri->ri_font))
+		if (!CHAR_IN_FONT(c, font))
 			return;
 		bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
 		fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
@@ -706,11 +707,11 @@
 		if (c == 0x20) {
 			chipsfb_rectfill(sc, x, y, wi, he, bg);
 		} else {
-			uc = c-ri->ri_font->firstchar;
-			data = (uint8_t *)ri->ri_font->data + uc *
+			uc = c - font->firstchar;
+			data = (uint8_t *)font->data + uc *
 			    ri->ri_fontscale;
 			chipsfb_setup_mono(sc, x, y, wi, he, fg, bg);
-			chipsfb_feed(sc, ri->ri_font->stride * he, data);
+			chipsfb_feed(sc, font->stride * he, data);
 		}
 	}
 }

Index: src/sys/dev/pci/pm2fb.c
diff -u src/sys/dev/pci/pm2fb.c:1.3 src/sys/dev/pci/pm2fb.c:1.4
--- src/sys/dev/pci/pm2fb.c:1.3	Tue Mar 16 21:27:02 2010
+++ src/sys/dev/pci/pm2fb.c	Tue May  4 05:00:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pm2fb.c,v 1.3 2010/03/16 21:27:02 macallan Exp $	*/
+/*	$NetBSD: pm2fb.c,v 1.4 2010/05/04 05:00:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.3 2010/03/16 21:27:02 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pm2fb.c,v 1.4 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -676,6 +676,7 @@
 pm2fb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
 	struct rasops_info *ri = cookie;
+	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct vcons_screen *scr = ri->ri_hw;
 	struct pm2fb_softc *sc = scr->scr_cookie;
 	uint32_t mode;
@@ -686,10 +687,10 @@
 		int uc, i;
 		int x, y, wi, he;
 
-		wi = ri->ri_font->fontwidth;
-		he = ri->ri_font->fontheight;
+		wi = font->fontwidth;
+		he = font->fontheight;
 
-		if (!CHAR_IN_FONT(c, ri->ri_font))
+		if (!CHAR_IN_FONT(c, font))
 			return;
 		bg = ri->ri_devcmap[(attr >> 16) & 0xf];
 		fg = ri->ri_devcmap[(attr >> 24) & 0xf];
@@ -698,9 +699,8 @@
 		if (c == 0x20) {
 			pm2fb_rectfill(sc, x, y, wi, he, bg);
 		} else {
-			uc = c - ri->ri_font->firstchar;
-			data = (uint8_t *)ri->ri_font->data + uc * 
-			    ri->ri_fontscale;
+			uc = c - font->firstchar;
+			data = (uint8_t *)font->data + uc * ri->ri_fontscale;
 
 			mode = PM2RM_MASK_MIRROR;
 			switch (ri->ri_font->stride) {

Index: src/sys/dev/pci/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.34 src/sys/dev/pci/radeonfb.c:1.35
--- src/sys/dev/pci/radeonfb.c:1.34	Thu Jul 23 07:21:45 2009
+++ src/sys/dev/pci/radeonfb.c	Tue May  4 05:00:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.34 2009/07/23 07:21:45 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.35 2010/05/04 05:00:33 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.34 2009/07/23 07:21:45 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.35 2010/05/04 05:00:33 macallan Exp $");
 
 #define RADEONFB_DEFAULT_DEPTH 32
 
@@ -220,7 +220,7 @@
 	0, 0,		/* ncols, nrows */
 	NULL,		/* textops */
 	8, 16,		/* fontwidth, fontheight */
-	WSSCREEN_WSCOLORS, /* capabilities */
+	WSSCREEN_WSCOLORS | WSSCREEN_REVERSE, /* capabilities */
 	0,		/* modecookie */
 };
 
@@ -2169,7 +2169,7 @@
 	 * XXX: font selection should be based on properties, with some
 	 * normal/reasonable default.
 	 */
-	ri->ri_caps = WSSCREEN_WSCOLORS;
+	ri->ri_caps = WSSCREEN_WSCOLORS | WSSCREEN_REVERSE;
 
 	/* initialize and look for an initial font */
 	rasops_init(ri, dp->rd_virty/8, dp->rd_virtx/8);
@@ -2348,21 +2348,28 @@
 	struct rasops_info	*ri = cookie;
 	struct vcons_screen	*scr = ri->ri_hw;
 	struct radeonfb_display	*dp = scr->scr_cookie;
+	struct wsdisplay_font	*font = PICK_FONT(ri, c);
 	uint32_t		x, y, w, h;
-	uint32_t		bg, fg;
+	uint32_t		bg, fg, flg;
 	uint8_t			*data;
 
 	if (dp->rd_wsmode != WSDISPLAYIO_MODE_EMUL)
 		return;
 
-	if (!CHAR_IN_FONT(c, ri->ri_font))
+	if (!CHAR_IN_FONT(c, font))
 		return;
 
-	w = ri->ri_font->fontwidth;
-	h = ri->ri_font->fontheight;
+	w = font->fontwidth;
+	h = font->fontheight;
 
-	bg = ri->ri_devcmap[(attr >> 16) & 0xf];
-	fg = ri->ri_devcmap[(attr >> 24) & 0xf];
+	flg = attr & 0xff;
+	if (flg & WSATTR_REVERSE) {
+		fg = ri->ri_devcmap[(attr >> 16) & 0xf];
+		bg = ri->ri_devcmap[(attr >> 24) & 0xf];
+	} else {
+		bg = ri->ri_devcmap[(attr >> 16) & 0xf];
+		fg = ri->ri_devcmap[(attr >> 24) & 0xf];
+	}
 
 	x = ri->ri_xorigin + col * w;
 	y = ri->ri_yorigin + row * h;
@@ -2370,8 +2377,8 @@
 	if (c == 0x20) {
 		radeonfb_rectfill(dp, x, y, w, h, bg);
 	} else {
-		data = (uint8_t *)ri->ri_font->data +
-		    (c - ri->ri_font->firstchar) * ri->ri_fontscale;
+		data = (uint8_t *)font->data +
+		    (c - font->firstchar) * ri->ri_fontscale;
 
 		radeonfb_setup_mono(dp, x, y, w, h, fg, bg);
 		radeonfb_feed_bytes(dp, ri->ri_fontscale, data);

Index: src/sys/dev/pci/voodoofb.c
diff -u src/sys/dev/pci/voodoofb.c:1.21 src/sys/dev/pci/voodoofb.c:1.22
--- src/sys/dev/pci/voodoofb.c:1.21	Thu Nov 26 15:17:10 2009
+++ src/sys/dev/pci/voodoofb.c	Tue May  4 05:00:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: voodoofb.c,v 1.21 2009/11/26 15:17:10 njoly Exp $	*/
+/*	$NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.21 2009/11/26 15:17:10 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voodoofb.c,v 1.22 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -670,6 +670,7 @@
 voodoofb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
 	struct rasops_info *ri = cookie;
+	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct vcons_screen *scr = ri->ri_hw;
 	struct voodoofb_softc *sc = scr->scr_cookie;
 
@@ -678,10 +679,10 @@
 		int fg, bg, uc, i;
 		int x, y, wi, he;
 
-		wi = ri->ri_font->fontwidth;
-		he = ri->ri_font->fontheight;
+		wi = font->fontwidth;
+		he = font->fontheight;
 
-		if (!CHAR_IN_FONT(c, ri->ri_font))
+		if (!CHAR_IN_FONT(c, font))
 			return;
 		bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xf];
 		fg = (u_char)ri->ri_devcmap[(attr >> 24) & 0xf];
@@ -690,14 +691,13 @@
 		if (c == 0x20) {
 			voodoofb_rectfill(sc, x, y, wi, he, bg);
 		} else {
-			uc = c-ri->ri_font->firstchar;
-			data = (uint8_t *)ri->ri_font->data + uc * 
+			uc = c - font->firstchar;
+			data = (uint8_t *)font->data + uc * 
 			    ri->ri_fontscale;
 				voodoofb_setup_mono(sc, x, y, wi, he, fg, bg);		
 			for (i = 0; i < he; i++) {
-				voodoofb_feed_line(sc, 
-				    ri->ri_font->stride, data);
-				data += ri->ri_font->stride;
+				voodoofb_feed_line(sc, font->stride, data);
+				data += font->stride;
 			}
 		}
 	}

Index: src/sys/dev/pci/voyagerfb.c
diff -u src/sys/dev/pci/voyagerfb.c:1.2 src/sys/dev/pci/voyagerfb.c:1.3
--- src/sys/dev/pci/voyagerfb.c:1.2	Thu Aug 20 02:40:57 2009
+++ src/sys/dev/pci/voyagerfb.c	Tue May  4 05:00:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: voyagerfb.c,v 1.2 2009/08/20 02:40:57 macallan Exp $	*/
+/*	$NetBSD: voyagerfb.c,v 1.3 2010/05/04 05:00:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2009 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.2 2009/08/20 02:40:57 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: voyagerfb.c,v 1.3 2010/05/04 05:00:33 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -679,6 +679,7 @@
 voyagerfb_putchar(void *cookie, int row, int col, u_int c, long attr)
 {
 	struct rasops_info *ri = cookie;
+	struct wsdisplay_font *font = PICK_FONT(ri, c);
 	struct vcons_screen *scr = ri->ri_hw;
 	struct voyagerfb_softc *sc = scr->scr_cookie;
 	uint32_t cmd;
@@ -687,10 +688,10 @@
 		int fg, bg, uc;
 		uint8_t *data;
 		int x, y, wi, he;
-		wi = ri->ri_font->fontwidth;
-		he = ri->ri_font->fontheight;
+		wi = font->fontwidth;
+		he = font->fontheight;
 
-		if (!CHAR_IN_FONT(c, ri->ri_font))
+		if (!CHAR_IN_FONT(c, font))
 			return;
 		bg = ri->ri_devcmap[(attr >> 16) & 0x0f];
 		fg = ri->ri_devcmap[(attr >> 24) & 0x0f];
@@ -699,9 +700,8 @@
 		if (c == 0x20) {
 			voyagerfb_rectfill(sc, x, y, wi, he, bg);
 		} else {
-			uc = c - ri->ri_font->firstchar;
-			data = (uint8_t *)ri->ri_font->data + uc * 
-			    ri->ri_fontscale;
+			uc = c - font->firstchar;
+			data = (uint8_t *)font->data + uc * ri->ri_fontscale;
 			cmd = ROP_COPY |
 			      SM502_CTRL_USE_ROP2 |
 			      SM502_CTRL_CMD_HOSTWRT |

Reply via email to