Module Name:    src
Committed By:   macallan
Date:           Wed Jan  4 08:25:03 UTC 2012

Modified Files:
        src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h

Log Message:
bump character buffers and cache to 32bit per character so flags we store
in the upper bits don't get lost
now autogenerated line drawing characters work with VCONS_DRAW_INTR and don't
get lost when switching screens


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/wscons/wsdisplay_vconsvar.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.26 src/sys/dev/wscons/wsdisplay_vcons.c:1.27
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.26	Wed May 25 06:13:29 2011
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Wed Jan  4 08:25:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.26 2011/05/25 06:13:29 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.27 2012/01/04 08:25:03 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.26 2011/05/25 06:13:29 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.27 2012/01/04 08:25:03 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -282,11 +282,11 @@ vcons_init_screen(struct vcons_data *vd,
 	cnt = ri->ri_rows * ri->ri_cols;
 #endif
 	scr->scr_attrs = (long *)malloc(cnt * (sizeof(long) + 
-	    sizeof(uint16_t)), M_DEVBUF, M_WAITOK);
+	    sizeof(uint32_t)), M_DEVBUF, M_WAITOK);
 	if (scr->scr_attrs == NULL)
 		return ENOMEM;
 
-	scr->scr_chars = (uint16_t *)&scr->scr_attrs[cnt];
+	scr->scr_chars = (uint32_t *)&scr->scr_attrs[cnt];
 
 	ri->ri_ops.allocattr(ri, WS_DEFAULT_FG, WS_DEFAULT_BG, 0, defattr);
 	scr->scr_defattr = *defattr;
@@ -310,7 +310,7 @@ vcons_init_screen(struct vcons_data *vd,
 		if (vd->chars != NULL) free(vd->chars, M_DEVBUF);
 		if (vd->attrs != NULL) free(vd->attrs, M_DEVBUF);
 		vd->cells = size;
-		vd->chars = malloc(size * sizeof(uint16_t), M_DEVBUF, M_WAITOK);
+		vd->chars = malloc(size * sizeof(uint32_t), M_DEVBUF, M_WAITOK);
 		vd->attrs = malloc(size * sizeof(long), M_DEVBUF, M_WAITOK);
 		vcons_invalidate_cache(vd);
 	}
@@ -402,7 +402,7 @@ vcons_do_switch(void *arg)
 void
 vcons_redraw_screen(struct vcons_screen *scr)
 {
-	uint16_t *charptr = scr->scr_chars;
+	uint32_t *charptr = scr->scr_chars;
 	long *attrptr = scr->scr_attrs;
 	struct rasops_info *ri = &scr->scr_ri;
 	struct vcons_data *vd = scr->scr_vd;
@@ -457,7 +457,7 @@ vcons_redraw_screen(struct vcons_screen 
 void
 vcons_update_screen(struct vcons_screen *scr)
 {
-	uint16_t *charptr = scr->scr_chars;
+	uint32_t *charptr = scr->scr_chars;
 	long *attrptr = scr->scr_attrs;
 	struct rasops_info *ri = &scr->scr_ri;
 	struct vcons_data *vd = scr->scr_vd;
@@ -513,7 +513,8 @@ vcons_ioctl(void *v, void *vs, u_long cm
 	struct lwp *l)
 {
 	struct vcons_data *vd = v;
-	int error;
+	int error = 0;
+
 
 	switch (cmd) {
 	case WSDISPLAYIO_GETWSCHAR:
@@ -526,6 +527,20 @@ vcons_ioctl(void *v, void *vs, u_long cm
 			(struct wsdisplay_char *)data);
 		break;
 
+	case WSDISPLAYIO_SET_POLLING: {
+		int poll = *(int *)data;
+
+		/* first call the driver's ioctl handler */
+		if (vd->ioctl != NULL)
+			error = (*vd->ioctl)(v, vs, cmd, data, flag, l);
+		if (poll) {
+			vcons_enable_polling(vd);
+			vcons_hard_switch(LIST_FIRST(&vd->screens));
+		} else
+			vcons_disable_polling(vd);
+		}
+		break;
+
 	default:
 		if (vd->ioctl != NULL)
 			error = (*vd->ioctl)(v, vs, cmd, data, flag, l);
@@ -641,12 +656,12 @@ vcons_copycols_buffer(void *cookie, int 
 	memmove(&scr->scr_attrs[offset + to], &scr->scr_attrs[offset + from],
 	    ncols * sizeof(long));
 	memmove(&scr->scr_chars[offset + to], &scr->scr_chars[offset + from],
-	    ncols * sizeof(uint16_t));
+	    ncols * sizeof(uint32_t));
 #else
 	memmove(&scr->scr_attrs[to], &scr->scr_attrs[from],
 	    ncols * sizeof(long));
 	memmove(&scr->scr_chars[to], &scr->scr_chars[from],
-	    ncols * sizeof(uint16_t));
+	    ncols * sizeof(uint32_t));
 #endif
 
 #ifdef VCONS_DRAW_INTR
@@ -799,7 +814,7 @@ vcons_copyrows_buffer(void *cookie, int 
 		memmove(&scr->scr_attrs[to], &scr->scr_attrs[from],
 		    scr->scr_offset_to_zero * sizeof(long));
 		memmove(&scr->scr_chars[to], &scr->scr_chars[from],
-		    scr->scr_offset_to_zero * sizeof(uint16_t));
+		    scr->scr_offset_to_zero * sizeof(uint32_t));
 	}
 	from = ri->ri_cols * srcrow + offset;
 	to = ri->ri_cols * dstrow + offset;
@@ -813,7 +828,7 @@ vcons_copyrows_buffer(void *cookie, int 
 	memmove(&scr->scr_attrs[to], &scr->scr_attrs[from],
 	    len * sizeof(long));
 	memmove(&scr->scr_chars[to], &scr->scr_chars[from],
-	    len * sizeof(uint16_t));
+	    len * sizeof(uint32_t));
 
 #ifdef VCONS_DRAW_INTR
 	atomic_inc_uint(&scr->scr_dirty);

Index: src/sys/dev/wscons/wsdisplay_vconsvar.h
diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.20 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.21
--- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.20	Wed May 25 06:13:30 2011
+++ src/sys/dev/wscons/wsdisplay_vconsvar.h	Wed Jan  4 08:25:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vconsvar.h,v 1.20 2011/05/25 06:13:30 macallan Exp $ */
+/*	$NetBSD: wsdisplay_vconsvar.h,v 1.21 2012/01/04 08:25:03 macallan Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -41,7 +41,7 @@ struct vcons_screen {
 	struct vcons_data *scr_vd;
 	struct vcons_data *scr_origvd;
 	const struct wsscreen_descr *scr_type;
-	uint16_t *scr_chars;
+	uint32_t *scr_chars;
 	long *scr_attrs;
 	long scr_defattr;
 	/* static flags set by the driver */
@@ -124,7 +124,7 @@ struct vcons_data {
 #ifdef VCONS_DRAW_INTR
 	int cells;
 	long *attrs;
-	uint16_t *chars;
+	uint32_t *chars;
 	int cursor_offset;
 	callout_t intr;
 	int intr_valid;

Reply via email to