Module Name:    src
Committed By:   macallan
Date:           Tue Nov  2 14:32:58 UTC 2010

Modified Files:
        src/sys/dev/pci: radeonfb.c radeonfbvar.h

Log Message:
when drawing characters by software make sure the engine is idle before
accessing video memory


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/radeonfb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/radeonfbvar.h

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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.37 src/sys/dev/pci/radeonfb.c:1.38
--- src/sys/dev/pci/radeonfb.c:1.37	Tue Aug 24 12:47:17 2010
+++ src/sys/dev/pci/radeonfb.c	Tue Nov  2 14:32:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.37 2010/08/24 12:47:17 macallan Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.38 2010/11/02 14:32:58 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.37 2010/08/24 12:47:17 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.38 2010/11/02 14:32:58 macallan Exp $");
 
 #define RADEONFB_DEFAULT_DEPTH 8
 
@@ -163,6 +163,7 @@
 static void radeonfb_copycols(void *, int, int, int, int);
 static void radeonfb_cursor(void *, int, int, int);
 static void radeonfb_putchar(void *, int, int, unsigned, long);
+static void radeonfb_putchar_wrapper(void *, int, int, unsigned, long);
 static int radeonfb_allocattr(void *, int, int, int, long *);
 
 static int radeonfb_get_backlight(struct radeonfb_display *);
@@ -2206,6 +2207,7 @@
 		    dp->rd_virtx / ri->ri_font->fontwidth);
 
 	/* enable acceleration */
+	dp->rd_putchar = ri->ri_ops.putchar;
 	ri->ri_ops.copyrows = radeonfb_copyrows;
 	ri->ri_ops.copycols = radeonfb_copycols;
 	ri->ri_ops.eraserows = radeonfb_eraserows;
@@ -2213,6 +2215,8 @@
 	ri->ri_ops.allocattr = radeonfb_allocattr;
 	if (!IS_R300(dp->rd_softc)) {
 		ri->ri_ops.putchar = radeonfb_putchar;
+	} else {
+		ri->ri_ops.putchar = radeonfb_putchar_wrapper;
 	}
 	ri->ri_ops.cursor = radeonfb_cursor;
 }
@@ -2430,6 +2434,22 @@
 	}
 }
 
+/*
+ * wrapper for software character drawing
+ * just sync the engine and call rasops*_putchar()
+ */
+
+static void
+radeonfb_putchar_wrapper(void *cookie, int row, int col, u_int c, long attr)
+{
+	struct rasops_info	*ri = cookie;
+	struct vcons_screen	*scr = ri->ri_hw;
+	struct radeonfb_display	*dp = scr->scr_cookie;
+
+	radeonfb_engine_idle(dp->rd_softc);
+	dp->rd_putchar(ri, row, col, c, attr);
+}
+	
 static void
 radeonfb_eraserows(void *cookie, int row, int nrows, long fillattr)
 {

Index: src/sys/dev/pci/radeonfbvar.h
diff -u src/sys/dev/pci/radeonfbvar.h:1.8 src/sys/dev/pci/radeonfbvar.h:1.9
--- src/sys/dev/pci/radeonfbvar.h:1.8	Tue Aug 17 18:53:16 2010
+++ src/sys/dev/pci/radeonfbvar.h	Tue Nov  2 14:32:58 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: radeonfbvar.h,v 1.8 2010/08/17 18:53:16 macallan Exp $ */
+/* $NetBSD: radeonfbvar.h,v 1.9 2010/11/02 14:32:58 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -190,7 +190,7 @@
 	struct wsscreen_descr	*rd_wsscreens;
 	struct vcons_screen	rd_vscreen;
 	struct vcons_data	rd_vd;
-
+	void (*rd_putchar)(void *, int, int, u_int, long);
 
 #if 0
 	uint8_t			rd_cmap_red[256];

Reply via email to