Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons bump character buffers and cache to 32bit per...



details:   https://anonhg.NetBSD.org/src/rev/89bc9fe82a8f
branches:  trunk
changeset: 772435:89bc9fe82a8f
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Jan 04 08:25:03 2012 +0000

description:
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

diffstat:

 sys/dev/wscons/wsdisplay_vcons.c    |  39 +++++++++++++++++++++++++-----------
 sys/dev/wscons/wsdisplay_vconsvar.h |   6 ++--
 2 files changed, 30 insertions(+), 15 deletions(-)

diffs (150 lines):

diff -r 684088354f7d -r 89bc9fe82a8f sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c  Wed Jan 04 07:56:35 2012 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c  Wed Jan 04 08:25:03 2012 +0000
@@ -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 @@
        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 @@
                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 @@
 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 @@
 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 @@
        struct lwp *l)
 {
        struct vcons_data *vd = v;
-       int error;
+       int error = 0;
+
 
        switch (cmd) {
        case WSDISPLAYIO_GETWSCHAR:
@@ -526,6 +527,20 @@
                        (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 @@
        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 @@
                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 @@
        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);
diff -r 684088354f7d -r 89bc9fe82a8f sys/dev/wscons/wsdisplay_vconsvar.h
--- a/sys/dev/wscons/wsdisplay_vconsvar.h       Wed Jan 04 07:56:35 2012 +0000
+++ b/sys/dev/wscons/wsdisplay_vconsvar.h       Wed Jan 04 08:25:03 2012 +0000
@@ -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_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 @@
 #ifdef VCONS_DRAW_INTR
        int cells;
        long *attrs;
-       uint16_t *chars;
+       uint32_t *chars;
        int cursor_offset;
        callout_t intr;
        int intr_valid;



Home | Main Index | Thread Index | Old Index