Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/hpcmips/dev update experimental HPCFB_JUMP codes.
details: https://anonhg.NetBSD.org/src/rev/0befb8868ced
branches: trunk
changeset: 499621:0befb8868ced
user: sato <sato%NetBSD.org@localhost>
date: Fri Nov 24 21:58:06 2000 +0000
description:
update experimental HPCFB_JUMP codes.
(but not completely yet)
diffstat:
sys/arch/hpcmips/dev/hpcfb.c | 568 +++++++++++++++++++++++++++++++++---------
1 files changed, 439 insertions(+), 129 deletions(-)
diffs (truncated from 1011 to 300 lines):
diff -r 3a90c9d3c1fa -r 0befb8868ced sys/arch/hpcmips/dev/hpcfb.c
--- a/sys/arch/hpcmips/dev/hpcfb.c Fri Nov 24 21:49:06 2000 +0000
+++ b/sys/arch/hpcmips/dev/hpcfb.c Fri Nov 24 21:58:06 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpcfb.c,v 1.15 2000/10/22 12:44:16 uch Exp $ */
+/* $NetBSD: hpcfb.c,v 1.16 2000/11/24 21:58:06 sato Exp $ */
/*-
* Copyright (c) 1999
@@ -37,7 +37,8 @@
*/
/*
- * multiscreen, virtual text vram and hpcfb_emulops functions
+ * jump scroll, scroll thread, multiscreen, virtual text vram
+ * and hpcfb_emulops functions
* written by SATO Kazumi.
*/
@@ -45,11 +46,17 @@
static const char _copyright[] __attribute__ ((unused)) =
"Copyright (c) 1999 Shin Takemura. All rights reserved.";
static const char _rcsid[] __attribute__ ((unused)) =
- "$Id: hpcfb.c,v 1.15 2000/10/22 12:44:16 uch Exp $";
+ "$Id: hpcfb.c,v 1.16 2000/11/24 21:58:06 sato Exp $";
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/signalvar.h>
+#include <sys/map.h>
+#include <sys/proc.h>
+#include <sys/kthread.h>
+#include <sys/lock.h>
+#include <sys/user.h>
#include <sys/device.h>
#include <sys/conf.h>
#include <sys/malloc.h>
@@ -83,6 +90,14 @@
#define DPRINTF(arg)
#endif
+#ifndef HPCFB_MAX_COLUMN
+#define HPCFB_MAX_COLUMN 130
+#endif /* HPCFB_MAX_COLUMN */
+#ifndef HPCFB_MAX_ROW
+#define HPCFB_MAX_ROW 80
+#endif /* HPCFB_MAX_ROW */
+
+#define HPCFB_TVOPTIM
/*
* currently experimental
#define HPCFB_JUMP
@@ -95,6 +110,14 @@
long attr;
};
+#ifdef HPCFB_TVOPTIM
+struct hpcfb_tvrow {
+ int maxcol;
+ int spacecol;
+ struct hpcfb_vchar col[HPCFB_MAX_COLUMN];
+};
+#endif /* HPCFB_TVOPTIM */
+
struct hpcfb_devconfig {
struct rasops_info dc_rinfo; /* rasops infomation */
@@ -102,23 +125,30 @@
struct hpcfb_softc *dc_sc;
int dc_rows;
int dc_cols;
+#ifdef HPCFB_TVOPTIM
+ struct hpcfb_tvrow *dc_tvram;
+#else /* HPCFB_TVOPTIM */
struct hpcfb_vchar *dc_tvram;
+#endif /* HPCFB_TVOPTIM */
int dc_curx;
int dc_cury;
#ifdef HPCFB_JUMP
int dc_min_row;
int dc_max_row;
int dc_scroll;
- struct callout *dc_scroll_ch;
+ struct callout dc_scroll_ch;
int dc_scroll_src;
int dc_scroll_dst;
int dc_scroll_num;
#endif /* HPCFB_JUMP */
int dc_state;
#define HPCFB_DC_CURRENT 0x80000000
-#define HPCFB_DC_DRAWING 0x01
-#define HPCFB_DC_SCROLLPENDING 0x02
-#define HPCFB_DC_UPDATE 0x04
+#define HPCFB_DC_DRAWING 0x01 /* drawing raster ops */
+#define HPCFB_DC_TDRAWING 0x02 /* drawing tvram */
+#define HPCFB_DC_SCROLLPENDING 0x04 /* scroll is pending */
+#define HPCFB_DC_UPDATE 0x08 /* tvram update */
+#define HPCFB_DC_SCRDELAY 0x10 /* scroll time but delay it */
+#define HPCFB_DC_SCRTHREAD 0x20 /* in scroll thread or callout */
#ifdef HPCFB_BSTORE
u_char *dc_bstore;
#endif /* HPCFB_BSTORE */
@@ -142,10 +172,15 @@
const struct hpcfb_accessops *sc_accessops;
void *sc_accessctx;
int nscreens;
- void *sc_powerhook; /* power management hook */
+ void *sc_powerhook; /* power management hook */
struct device *sc_wsdisplay;
int sc_screen_resumed;
+ int sc_polling;
+ int sc_mapping;
+ struct proc *sc_thread;
+ struct lock sc_lock;
};
+
/*
* function prototypes
*/
@@ -156,6 +191,12 @@
int hpcfb_ioctl __P((void *, u_long, caddr_t, int, struct proc *));
paddr_t hpcfb_mmap __P((void *, off_t, int));
void hpcfb_refresh_screen __P((struct hpcfb_softc *sc));
+
+#ifdef HPCFB_JUMP
+static void hpcfb_create_thread __P((void *));
+static void hpcfb_thread __P((void *));
+#endif /* HPCFB_JUMP */
+
static int hpcfb_init __P((struct hpcfb_fbconf *fbconf,
struct hpcfb_devconfig *dc));
static int hpcfb_alloc_screen __P((void *, const struct wsscreen_descr *,
@@ -163,6 +204,9 @@
static void hpcfb_free_screen __P((void *, void *));
static int hpcfb_show_screen __P((void *, void *, int,
void (*) (void *, int, int), void *));
+#ifdef notyet
+static void hpcfb_pollc __P((void *, int));
+#endif /* notyet */
static void hpcfb_power __P((int, void *));
static void hpcfb_cmap_reorder __P((struct hpcfb_fbconf *,
struct hpcfb_devconfig *));
@@ -176,11 +220,17 @@
int dstcol, int ncols));
void hpcfb_erasecols __P((void *c, int row, int startcol,
int ncols, long attr));
-void hpcfb_redraw __P((void *c, int row, int nrows));
+void hpcfb_redraw __P((void *c, int row, int nrows, int all));
void hpcfb_copyrows __P((void *c, int srcrow, int dstrow, int nrows));
void hpcfb_eraserows __P((void *c, int row, int nrows, long attr));
int hpcfb_alloc_attr __P((void *c, int fg, int bg, int flags, long *attr));
+#ifdef HPCFB_JUMP
+void hpcfb_scroll_update __P((void *));
+void hpcfb_do_scroll __P((void *));
+void hpcfb_check_scroll __P((void *));
+#endif /* HPCFB_JUMP */
+
struct wsdisplay_emulops hpcfb_emulops = {
hpcfb_cursor,
hpcfb_mapchar,
@@ -223,7 +273,10 @@
hpcfb_alloc_screen,
hpcfb_free_screen,
hpcfb_show_screen,
- 0 /* load_font */
+ 0 /* load_font */,
+#ifdef notyet
+ hpcfb_pollc
+#endif /* not yet */
};
void hpcfb_tv_putchar __P((struct hpcfb_devconfig *, int, int, u_int, long));
@@ -237,7 +290,11 @@
static int hpcfbconsole;
struct hpcfb_devconfig hpcfb_console_dc;
struct wsscreen_descr hpcfb_console_wsscreen;
+#ifdef HPCFB_TVOPTIM
+struct hpcfb_tvrow hpcfb_console_tvram[HPCFB_MAX_ROW];
+#else /* HPCFB_TVOPTIM */
struct hpcfb_vchar hpcfb_console_tvram[200*200];
+#endif /* HPCFB_TVOPTIM */
/*
* function bodies
@@ -258,10 +315,6 @@
struct cfdata *match;
void *aux;
{
-#if 0
- struct hpcfb_attach_args *ha = aux;
-#endif
-
return (1);
}
@@ -299,6 +352,8 @@
sc->sc_dc->dc_state |= HPCFB_DC_CURRENT;
sc->sc_dc->dc_sc = sc;
}
+ sc->sc_polling = 0; /* XXX */
+ sc->sc_mapping = 0; /* XXX */
hpcfb_stdscreen.nrows = sc->sc_dc->dc_rows;
hpcfb_stdscreen.ncols = sc->sc_dc->dc_cols;
hpcfb_stdscreen.capabilities = sc->sc_dc->dc_rinfo.ri_caps;
@@ -334,18 +389,61 @@
wa.accesscookie = sc;
sc->sc_wsdisplay = config_found(self, &wa, wsemuldisplaydevprint);
+
+#ifdef HPCFB_JUMP
+ /*
+ * Create a kernel thread to scroll,
+ */
+ kthread_create(hpcfb_create_thread, sc);
+#endif /* HPCFB_JUMP */
}
+#ifdef HPCFB_JUMP
+void
+hpcfb_create_thread(arg)
+ void *arg;
+{
+ struct hpcfb_softc *sc = arg;
+
+ if (kthread_create1(hpcfb_thread, sc, &sc->sc_thread,
+ "%s", sc->sc_dev.dv_xname) == 0)
+ return;
+
+ /*
+ * We were unable to create the HPCFB thread; bail out.
+ */
+ sc->sc_thread = 0;
+ printf("%s: unable to create thread, kernel hpcfb scroll support disabled\n",
+ sc->sc_dev.dv_xname);
+}
+
+void
+hpcfb_thread(arg)
+ void *arg;
+{
+ struct hpcfb_softc *sc = arg;
+
+ /*
+ * Loop forever, doing a periodic check for APM events.
+ */
+ for (;;) {
+ /* HPCFB_LOCK(apmsc); */
+ sc->sc_dc->dc_state |= HPCFB_DC_SCRTHREAD;
+ if (sc->sc_mapping)
+ hpcfb_scroll_update(sc->sc_dc);
+ sc->sc_dc->dc_state &= ~HPCFB_DC_SCRTHREAD;
+ /* APM_UNLOCK(apmsc); */
+ (void) tsleep(sc, PWAIT, "hpcfb", (8 * hz) / 7);
+ }
+}
+#endif /* HPCFB_JUMP */
+
/* Print function (for parent devices). */
int
hpcfbprint(aux, pnp)
void *aux;
const char *pnp;
{
-#if 0
- struct hpcfb_attach_args *ha = aux;
-#endif
-
if (pnp)
printf("hpcfb at %s", pnp);
@@ -406,7 +504,7 @@
#else
ri->ri_flg = RI_CURSOR;
#endif
- if (rasops_init(ri, 200, 200)) {
+ if (rasops_init(ri, HPCFB_MAX_ROW, HPCFB_MAX_COLUMN)) {
panic("%s(%d): rasops_init() failed!", __FILE__, __LINE__);
}
@@ -421,7 +519,7 @@
dc->dc_max_row = 0;
dc->dc_min_row = dc->dc_rows;
dc->dc_scroll = 0;
- callout_init(dc->dc_scroll_ch);
+ callout_init(&dc->dc_scroll_ch);
#endif /* HPCFB_JUMP */
dc->dc_tvram = hpcfb_console_tvram;
bzero(hpcfb_console_tvram, sizeof(hpcfb_console_tvram));
@@ -432,7 +530,7 @@
if (dc->dc_bstore == NULL) {
dc->dc_bstore =
malloc(dc->dc_memsize, M_DEVBUF, M_WAITOK);
- bzero(dc->dc_bsrore, dc->dc_memsize);
+ bzero(dc->dc_bstore, dc->dc_memsize);
}
#endif /* HPCFB_BSTORE */
#ifdef HPCFB_MULTI
@@ -530,7 +628,21 @@
Home |
Main Index |
Thread Index |
Old Index