Source-Changes-HG archive

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

[src/trunk]: src/sys/dev PR/19925: David Ferlier: Add scrolling support to ws...



details:   https://anonhg.NetBSD.org/src/rev/82db6bb04552
branches:  trunk
changeset: 567032:82db6bb04552
user:      christos <christos%NetBSD.org@localhost>
date:      Fri May 28 21:42:29 2004 +0000

description:
PR/19925: David Ferlier: Add scrolling support to wscons.

diffstat:

 sys/dev/ic/pcdisplay_subr.c   |    6 +-
 sys/dev/ic/pcdisplayvar.h     |    3 +-
 sys/dev/ic/vga.c              |   72 +++++++++++++++++++++++++++-
 sys/dev/wscons/files.wscons   |    4 +-
 sys/dev/wscons/wsconsio.h     |   34 +++++++++++++-
 sys/dev/wscons/wsdisplay.c    |   73 ++++++++++++++++++++++++++++-
 sys/dev/wscons/wsdisplayvar.h |   12 ++++-
 sys/dev/wscons/wskbd.c        |  105 +++++++++++++++++++++++++++++++++++++++++-
 sys/dev/wscons/wsksymdef.h    |    7 ++-
 9 files changed, 301 insertions(+), 15 deletions(-)

diffs (truncated from 632 to 300 lines):

diff -r 769896c6937a -r 82db6bb04552 sys/dev/ic/pcdisplay_subr.c
--- a/sys/dev/ic/pcdisplay_subr.c       Fri May 28 20:46:52 2004 +0000
+++ b/sys/dev/ic/pcdisplay_subr.c       Fri May 28 21:42:29 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcdisplay_subr.c,v 1.25 2002/08/25 19:11:16 thorpej Exp $ */
+/* $NetBSD: pcdisplay_subr.c,v 1.26 2004/05/28 21:42:29 christos Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcdisplay_subr.c,v 1.25 2002/08/25 19:11:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcdisplay_subr.c,v 1.26 2004/05/28 21:42:29 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -176,6 +176,8 @@
                                  c | (attr << 8));
        else
                scr->mem[off] = c | (attr << 8);
+
+       scr->visibleoffset = scr->dispoffset;
 }
 
 void
diff -r 769896c6937a -r 82db6bb04552 sys/dev/ic/pcdisplayvar.h
--- a/sys/dev/ic/pcdisplayvar.h Fri May 28 20:46:52 2004 +0000
+++ b/sys/dev/ic/pcdisplayvar.h Fri May 28 21:42:29 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcdisplayvar.h,v 1.12 2004/03/24 17:26:53 drochner Exp $ */
+/* $NetBSD: pcdisplayvar.h,v 1.13 2004/05/28 21:42:29 christos Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -43,6 +43,7 @@
        int cursorcol, cursorrow;       /* current cursor position */
 
        int dispoffset;         /* offset of displayed area in video mem */
+       int visibleoffset;
 };
 
 struct pcdisplay_handle {
diff -r 769896c6937a -r 82db6bb04552 sys/dev/ic/vga.c
--- a/sys/dev/ic/vga.c  Fri May 28 20:46:52 2004 +0000
+++ b/sys/dev/ic/vga.c  Fri May 28 21:42:29 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.71 2003/06/29 22:30:14 fvdl Exp $ */
+/* $NetBSD: vga.c,v 1.72 2004/05/28 21:42:29 christos Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.71 2003/06/29 22:30:14 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.72 2004/05/28 21:42:29 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -99,6 +99,8 @@
        /* palette */
 
        int mindispoffset, maxdispoffset;
+       int vga_rollover;
+       int visibleoffset;
 };
 
 static int vgaconsole, vga_console_type, vga_console_attached;
@@ -117,13 +119,15 @@
 static void vga_setfont(struct vga_config *, struct vgascreen *);
 
 static int vga_mapchar(void *, int, unsigned int *);
+void vga_putchar(void *, int, int, u_int, long);
 static int vga_allocattr(void *, int, int, int, long *);
 static void vga_copyrows(void *, int, int, int);
+void vga_scroll (void *, void *, int);
 
 const struct wsdisplay_emulops vga_emulops = {
        pcdisplay_cursor,
        vga_mapchar,
-       pcdisplay_putchar,
+       vga_putchar,
        pcdisplay_copycols,
        pcdisplay_erasecols,
        vga_copyrows,
@@ -269,7 +273,11 @@
        vga_free_screen,
        vga_show_screen,
        vga_load_font,
+#ifdef WSDISPLAY_SCROLLSUPPORT
+       vga_scroll,
+#else
        NULL,
+#endif
 #ifdef WSDISPLAY_CHARFUNCS
        vga_getwschar,
        vga_putwschar
@@ -454,6 +462,9 @@
                scr->pcs.dispoffset = scr->mindispoffset;
        }
 
+       scr->pcs.visibleoffset = scr->pcs.dispoffset;
+       scr->vga_rollover = 0;
+
        scr->pcs.cursorrow = cpos / type->ncols;
        scr->pcs.cursorcol = cpos % type->ncols;
        pcdisplay_cursor_init(&scr->pcs, existing);
@@ -1306,6 +1317,61 @@
        return (res1);
 }
 
+#ifdef WSDISPLAY_SCROLLSUPPORT
+void
+vga_scroll(void *v, void *cookie, int lines)
+{
+       struct vga_config *vc = v;
+       struct vgascreen *scr = cookie;
+       struct vga_handle *vh = &vc->hdl;
+
+       if (lines == 0) {
+               if (scr->pcs.visibleoffset == scr->pcs.dispoffset)
+                       return;
+
+               scr->pcs.visibleoffset = scr->pcs.dispoffset;
+       }
+       else {
+               int vga_scr_end;
+               int margin = scr->pcs.type->ncols * 2;
+               int ul, we, p, st;
+
+               vga_scr_end = (scr->pcs.dispoffset + scr->pcs.type->ncols *
+                   scr->pcs.type->nrows * 2);
+               if (scr->vga_rollover > vga_scr_end + margin) {
+                       ul = vga_scr_end;
+                       we = scr->vga_rollover + scr->pcs.type->ncols * 2;
+               } else {
+                       ul = 0;
+                       we = 0x8000;
+               }
+               p = (scr->pcs.visibleoffset - ul + we) % we + lines *
+                   (scr->pcs.type->ncols * 2);
+               st = (scr->pcs.dispoffset - ul + we) % we;
+               if (p < margin)
+                       p = 0;
+               if (p > st - margin)
+                       p = st;
+               scr->pcs.visibleoffset = (p + ul) % we;
+       }
+       
+       vga_6845_write(vh, startadrh, scr->pcs.visibleoffset >> 9);
+       vga_6845_write(vh, startadrl, scr->pcs.visibleoffset >> 1);
+}
+#endif
+
+void
+vga_putchar(void *c, int row, int col, u_int uc, long attr)
+{
+       struct vgascreen *scr = c;
+
+       if (scr->pcs.visibleoffset != scr->pcs.dispoffset)
+               vga_scroll(scr->cfg, scr, WSDISPLAY_SCROLL_BACKWARD);
+
+       pcdisplay_putchar(c, row, col, uc, attr);
+}
+
+
 #ifdef WSDISPLAY_CHARFUNCS
 int
 vga_getwschar(void *cookie, struct wsdisplay_char *wschar)
diff -r 769896c6937a -r 82db6bb04552 sys/dev/wscons/files.wscons
--- a/sys/dev/wscons/files.wscons       Fri May 28 20:46:52 2004 +0000
+++ b/sys/dev/wscons/files.wscons       Fri May 28 21:42:29 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.29 2004/05/28 17:52:06 tsarna Exp $
+# $NetBSD: files.wscons,v 1.30 2004/05/28 21:42:29 christos Exp $
 
 #
 # "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@@ -16,6 +16,7 @@
 defflag        opt_wsemul.h            WSEMUL_NO_DUMB WSEMUL_SUN WSEMUL_VT100
 defparam opt_wskernattr.h      WS_KERNEL_FG WS_KERNEL_BG
                                WS_KERNEL_COLATTR WS_KERNEL_MONOATTR
+                               WSDISPLAY_SCROLLCOMBO
 defparam opt_wsemul.h          WSEMUL_VT100_HILIT_FG WSEMUL_VT100_UNDERLINE_FG
                                WSEMUL_VT100_HILIT_BG WSEMUL_VT100_UNDERLINE_BG
 defflag        opt_wsdisplay_compat.h  WSDISPLAY_COMPAT_USL
@@ -24,6 +25,7 @@
                                WSDISPLAY_CHARFUNCS
                                WSCONS_SUPPORT_PCVTFONTS
                                WSCONS_SUPPORT_ISO7FONTS
+                               WSDISPLAY_SCROLLSUPPORT
 defparam opt_wsdisplay_compat.h        WSCOMPAT_USL_SYNCTIMEOUT
                                WSDISPLAY_DEFAULTSCREENS
 
diff -r 769896c6937a -r 82db6bb04552 sys/dev/wscons/wsconsio.h
--- a/sys/dev/wscons/wsconsio.h Fri May 28 20:46:52 2004 +0000
+++ b/sys/dev/wscons/wsconsio.h Fri May 28 21:42:29 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsconsio.h,v 1.61 2004/03/19 09:00:38 petrov Exp $ */
+/* $NetBSD: wsconsio.h,v 1.62 2004/05/28 21:42:29 christos Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -104,6 +104,21 @@
        u_int   period;                         /* period, in milliseconds */
        u_int   volume;                         /* percentage of max volume */
 };
+/* Manipulate the scrolling modifiers and mode */
+struct wskbd_scroll_data {
+       u_int           which;
+       u_int           mode;
+       u_int           modifier;
+};
+
+/* Manipulate the scrolling values (how many lines to scroll) */
+
+struct wsdisplay_scroll_data {
+       u_int           which;
+       u_int           fastlines;
+       u_int           slowlines;
+};
+
 #define                WSKBD_BELL_DOPITCH      0x1             /* get/set pitch */
 #define                WSKBD_BELL_DOPERIOD     0x2             /* get/set period */
 #define                WSKBD_BELL_DOVOLUME     0x4             /* get/set volume */
@@ -160,6 +175,15 @@
 #define        WSKBDIO_SETKEYCLICK     _IOW('W', 21, int)
 #define        WSKBDIO_GETKEYCLICK     _IOR('W', 22, int)
 
+#define WSKBDIO_GETSCROLL              _IOR('W', 23, struct wskbd_scroll_data)
+#define WSKBDIO_SETSCROLL              _IOW('W', 24, struct wskbd_scroll_data)
+
+#define                WSKBD_SCROLL_MODE_NORMAL        0x00
+#define                WSKBD_SCROLL_MODE_HOLD          0x01
+#define                WSKBD_SCROLL_DOMODIFIER         0x01
+#define                WSKBD_SCROLL_DOMODE                     0x02
+#define                WSKBD_SCROLL_DOALL                      0x03
+
 /*
  * Mouse ioctls (32 - 63)
  */
@@ -315,6 +339,11 @@
 #define                WSDISPLAY_CURSOR_DOSHAPE        0x10    /* get/set img/mask */
 #define                WSDISPLAY_CURSOR_DOALL          0x1f    /* all of the above */
 
+#define                WSDISPLAY_SCROLL_DOFASTLINES    0x01
+#define                WSDISPLAY_SCROLL_DOSLOWLINES    0x02
+#define                WSDISPLAY_SCROLL_DOALL                  0x03
+
+
 /* Cursor control: get and set position */
 #define        WSDISPLAYIO_GCURPOS     _IOR('W', 70, struct wsdisplay_curpos)
 #define        WSDISPLAYIO_SCURPOS     _IOW('W', 71, struct wsdisplay_curpos)
@@ -397,6 +426,9 @@
 #define        WSDISPLAYIO_GETPARAM    _IOWR('W', 82, struct wsdisplay_param)
 #define        WSDISPLAYIO_SETPARAM    _IOWR('W', 83, struct wsdisplay_param)
 
+#define WSDISPLAYIO_DGSCROLL           _IOR('W', 84, struct wsdisplay_scroll_data)
+#define WSDISPLAYIO_DSSCROLL           _IOW('W', 85, struct wsdisplay_scroll_data)
+
 #define        WSDISPLAYIO_GETACTIVESCREEN     _IOR('W', 84, int)
 
 /* Character functions */
diff -r 769896c6937a -r 82db6bb04552 sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c        Fri May 28 20:46:52 2004 +0000
+++ b/sys/dev/wscons/wsdisplay.c        Fri May 28 21:42:29 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.76 2003/09/21 18:47:59 manu Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.77 2004/05/28 21:42:29 christos Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.76 2003/09/21 18:47:59 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.77 2004/05/28 21:42:29 christos Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "opt_compat_netbsd.h"
@@ -114,6 +114,9 @@
        void    *sc_accesscookie;
 
        const struct wsscreen_list *sc_scrdata;
+#ifdef WSDISPLAY_SCROLLSUPPORT
+       struct wsdisplay_scroll_data sc_scroll_values;
+#endif
 
        struct wsscreen *sc_scr[WSDISPLAY_MAXSCREEN];
        int sc_focusidx;        /* available only if sc_focus isn't null */
@@ -135,6 +138,15 @@
 #endif /* NWSKBD > 0 */
 };
 
+#ifdef WSDISPLAY_SCROLLSUPPORT
+



Home | Main Index | Thread Index | Old Index