summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-11-29 19:11:18 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-11-29 19:11:18 +0000
commit50ee386b64c347a1453fc676e2725e0613e8c24a (patch)
treef9907f64ea3f674ebdfb026d21947be5b588ed6f /sys/dev/ic
parentf1383d2d04a9e6ec1da4df59ac0ff1478bb10f9b (diff)
Change the getchar wsdisplay_accessops function to not return a
display-dependent value, but instead fill a structure with the chaarcter and a valid attribute, suitable for use with unpack_attr. Adapt the wsmoused code to these changes, and remove all knowledge of the text-mode style pc video attributes in it. This will eventually allow wsmoused to be used on non-pcdisplay devices.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/pcdisplay_subr.c18
-rw-r--r--sys/dev/ic/pcdisplayvar.h5
-rw-r--r--sys/dev/ic/vga.c11
3 files changed, 22 insertions, 12 deletions
diff --git a/sys/dev/ic/pcdisplay_subr.c b/sys/dev/ic/pcdisplay_subr.c
index f615dfd73a6..8eefcb84a4f 100644
--- a/sys/dev/ic/pcdisplay_subr.c
+++ b/sys/dev/ic/pcdisplay_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcdisplay_subr.c,v 1.6 2006/09/29 19:46:02 miod Exp $ */
+/* $OpenBSD: pcdisplay_subr.c,v 1.7 2006/11/29 19:11:15 miod Exp $ */
/* $NetBSD: pcdisplay_subr.c,v 1.16 2000/06/08 07:01:19 cgd Exp $ */
/*
@@ -174,23 +174,31 @@ pcdisplay_putchar(id, row, col, c, attr)
scr->mem[off] = c | (attr << 8);
}
-u_int16_t
-pcdisplay_getchar(id, row, col)
+int
+pcdisplay_getchar(id, row, col, cell)
void *id;
int row, col;
+ struct wsdisplay_charcell *cell;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
int off;
+ u_int16_t data;
off = row * scr->type->ncols + col;
+ /* XXX bounds check? */
if (scr->active)
- return (bus_space_read_2(memt, memh,
+ data = (bus_space_read_2(memt, memh,
scr->dispoffset + off * 2));
else
- return (scr->mem[off]);
+ data = (scr->mem[off]);
+
+ cell->uc = data & 0xff;
+ cell->attr = data >> 8;
+
+ return (0);
}
void
diff --git a/sys/dev/ic/pcdisplayvar.h b/sys/dev/ic/pcdisplayvar.h
index 314ed8b8aca..4d5044ca7d9 100644
--- a/sys/dev/ic/pcdisplayvar.h
+++ b/sys/dev/ic/pcdisplayvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcdisplayvar.h,v 1.7 2006/09/29 19:46:02 miod Exp $ */
+/* $OpenBSD: pcdisplayvar.h,v 1.8 2006/11/29 19:11:15 miod Exp $ */
/* $NetBSD: pcdisplayvar.h,v 1.8 2000/01/25 02:44:03 ad Exp $ */
/*
@@ -89,7 +89,8 @@ unsigned int pcdisplay_mapchar_simple(void *, int);
#endif
int pcdisplay_mapchar(void *, int, unsigned int *);
void pcdisplay_putchar(void *, int, int, u_int, long);
-u_int16_t pcdisplay_getchar(void *, int, int);
+struct wsdisplay_charcell;
+int pcdisplay_getchar(void *, int, int, struct wsdisplay_charcell *);
void pcdisplay_copycols(void *, int, int, int,int);
void pcdisplay_erasecols(void *, int, int, int, long);
void pcdisplay_copyrows(void *, int, int, int);
diff --git a/sys/dev/ic/vga.c b/sys/dev/ic/vga.c
index d6a58b4b81d..a1560921ecc 100644
--- a/sys/dev/ic/vga.c
+++ b/sys/dev/ic/vga.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vga.c,v 1.41 2006/11/29 19:08:22 miod Exp $ */
+/* $OpenBSD: vga.c,v 1.42 2006/11/29 19:11:15 miod Exp $ */
/* $NetBSD: vga.c,v 1.28.2.1 2000/06/30 16:27:47 simonb Exp $ */
/*
@@ -238,7 +238,7 @@ int vga_show_screen(void *, void *, int,
int vga_load_font(void *, void *, struct wsdisplay_font *);
void vga_scrollback(void *, void *, int);
void vga_burner(void *v, u_int on, u_int flags);
-u_int16_t vga_getchar(void *, int, int);
+int vga_getchar(void *, int, int, struct wsdisplay_charcell *);
void vga_doswitch(struct vga_config *);
@@ -1319,14 +1319,15 @@ vga_burner(v, on, flags)
splx(s);
}
-u_int16_t
-vga_getchar(c, row, col)
+int
+vga_getchar(c, row, col, cell)
void *c;
int row, col;
+ struct wsdisplay_charcell *cell;
{
struct vga_config *vc = c;
- return (pcdisplay_getchar(vc->active, row, col));
+ return (pcdisplay_getchar(vc->active, row, col, cell));
}
struct cfdriver vga_cd = {