summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-08-11 18:33:14 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-08-11 18:33:14 +0000
commit7b06209c7db4e6573ad0731517e7f24fa240dbb4 (patch)
tree55ad49d90ea1577fdfb21ca82dd743e381be45bb /sys
parenta9c4489cb4e7b31aaeab53291a7012251f86ce12 (diff)
Let the windowmove() callbacks return whether they could perform the operation
or not, so that we can always feed them the complex operations before falling back to rasops; and then topcat can perform coloured solid fills in erase{cols,rows}.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hp300/dev/diofb.c60
-rw-r--r--sys/arch/hp300/dev/diofb_mono.c9
-rw-r--r--sys/arch/hp300/dev/diofbvar.h10
-rw-r--r--sys/arch/hp300/dev/dvbox.c16
-rw-r--r--sys/arch/hp300/dev/gbox.c16
-rw-r--r--sys/arch/hp300/dev/rbox.c16
-rw-r--r--sys/arch/hp300/dev/topcat.c19
7 files changed, 83 insertions, 63 deletions
diff --git a/sys/arch/hp300/dev/diofb.c b/sys/arch/hp300/dev/diofb.c
index b3376daed79..56057bcdaa8 100644
--- a/sys/arch/hp300/dev/diofb.c
+++ b/sys/arch/hp300/dev/diofb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diofb.c,v 1.13 2006/08/09 21:23:51 miod Exp $ */
+/* $OpenBSD: diofb.c,v 1.14 2006/08/11 18:33:13 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -208,7 +208,7 @@ diofb_fbsetup(struct diofb *fb)
}
/* Clear entire display, including non visible areas */
- (*fb->bmv)(fb, 0, 0, 0, 0, fb->fbwidth, fb->fbheight, RR_CLEAR);
+ (*fb->bmv)(fb, 0, 0, 0, 0, fb->fbwidth, fb->fbheight, RR_CLEAR, 0xff);
strlcpy(fb->wsd.name, "std", sizeof(fb->wsd.name));
fb->wsd.ncols = ri->ri_cols;
@@ -350,7 +350,7 @@ diofb_copycols(void *cookie, int row, int src, int dst, int n)
(*fb->bmv)(fb, ri->ri_xorigin + src, ri->ri_yorigin + row,
ri->ri_xorigin + dst, ri->ri_yorigin + row,
- n, ri->ri_font->fontheight, RR_COPY);
+ n, ri->ri_font->fontheight, RR_COPY, 0xff);
}
void
@@ -365,7 +365,7 @@ diofb_copyrows(void *cookie, int src, int dst, int n)
(*fb->bmv)(fb, ri->ri_xorigin, ri->ri_yorigin + src,
ri->ri_xorigin, ri->ri_yorigin + dst,
- ri->ri_emuwidth, n, RR_COPY);
+ ri->ri_emuwidth, n, RR_COPY, 0xff);
}
void
@@ -374,25 +374,21 @@ diofb_erasecols(void *cookie, int row, int col, int num, long attr)
struct rasops_info *ri = cookie;
struct diofb *fb = ri->ri_hw;
int fg, bg;
+ int snum, scol, srow;
rasops_unpack_attr(attr, &fg, &bg, NULL);
+ snum = num * ri->ri_font->fontwidth;
+ scol = col * ri->ri_font->fontwidth + ri->ri_xorigin;
+ srow = row * ri->ri_font->fontheight + ri->ri_yorigin;
+
/*
- * If the background color is not black, this is a bit too tricky
- * for the simple raster ops engine, so pass the fun to rasops.
+ * If this is too tricky for the simple raster ops engine,
+ * pass the fun to rasops.
*/
- if (ri->ri_devcmap[bg] != 0) {
+ if ((*fb->bmv)(fb, scol, srow, scol, srow, snum,
+ ri->ri_font->fontheight, RR_CLEAR, 0xff ^ bg) != 0)
rasops_erasecols(cookie, row, col, num, attr);
- return;
- }
-
- num *= ri->ri_font->fontwidth;
- col *= ri->ri_font->fontwidth;
- row *= ri->ri_font->fontheight;
-
- (*fb->bmv)(fb, ri->ri_xorigin + col, ri->ri_yorigin + row,
- ri->ri_xorigin + col, ri->ri_yorigin + row,
- num, ri->ri_font->fontheight, RR_CLEAR);
}
void
@@ -401,29 +397,23 @@ diofb_eraserows(void *cookie, int row, int num, long attr)
struct rasops_info *ri = cookie;
struct diofb *fb = ri->ri_hw;
int fg, bg;
+ int srow, snum;
+ int rc;
rasops_unpack_attr(attr, &fg, &bg, NULL);
+ bg ^= 0xff;
- /*
- * If the background color is not black, this is a bit too tricky
- * for the simple raster ops engine, so pass the fun to rasops.
- */
- if (ri->ri_devcmap[bg] != 0) {
- rasops_eraserows(cookie, row, num, attr);
- return;
- }
-
- /* As an exception, hunt the mouse all over the screen if necessary */
if (num == ri->ri_rows && (ri->ri_flg & RI_FULLCLEAR)) {
- (*fb->bmv)(fb, 0, 0, 0, 0,
- ri->ri_width, ri->ri_height, RR_CLEAR);
+ rc = (*fb->bmv)(fb, 0, 0, 0, 0, ri->ri_width, ri->ri_height,
+ RR_CLEAR, bg);
} else {
- row *= ri->ri_font->fontheight;
- num *= ri->ri_font->fontheight;
- (*fb->bmv)(fb, ri->ri_xorigin, ri->ri_yorigin + row,
- ri->ri_xorigin, ri->ri_yorigin + row,
- ri->ri_emuwidth, num, RR_CLEAR);
+ srow = row * ri->ri_font->fontheight + ri->ri_yorigin;
+ snum = num * ri->ri_font->fontheight;
+ rc = (*fb->bmv)(fb, ri->ri_xorigin, srow, ri->ri_xorigin,
+ srow, ri->ri_emuwidth, snum, RR_CLEAR, bg);
}
+ if (rc != 0)
+ rasops_eraserows(cookie, row, num, attr);
}
void
@@ -435,7 +425,7 @@ diofb_do_cursor(struct rasops_info *ri)
x = ri->ri_ccol * ri->ri_font->fontwidth + ri->ri_xorigin;
y = ri->ri_crow * ri->ri_font->fontheight + ri->ri_yorigin;
(*fb->bmv)(fb, x, y, x, y, ri->ri_font->fontwidth,
- ri->ri_font->fontheight, RR_INVERT);
+ ri->ri_font->fontheight, RR_INVERT, 0xff);
}
/*
diff --git a/sys/arch/hp300/dev/diofb_mono.c b/sys/arch/hp300/dev/diofb_mono.c
index 81e36986ca9..7b7790e5e44 100644
--- a/sys/arch/hp300/dev/diofb_mono.c
+++ b/sys/arch/hp300/dev/diofb_mono.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diofb_mono.c,v 1.2 2006/08/05 09:58:56 miod Exp $ */
+/* $OpenBSD: diofb_mono.c,v 1.3 2006/08/11 18:33:13 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
@@ -84,9 +84,10 @@
#include <dev/rasops/rasops_masks.h>
#include <hp300/dev/maskbits.h>
-void
+int
diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
+ int16_t planemask /* ignored */)
{
int width; /* add to get to same position in next line */
@@ -239,4 +240,6 @@ diofb_mono_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
}
}
}
+
+ return (0);
}
diff --git a/sys/arch/hp300/dev/diofbvar.h b/sys/arch/hp300/dev/diofbvar.h
index 9d11b22fd36..013fe7f33fb 100644
--- a/sys/arch/hp300/dev/diofbvar.h
+++ b/sys/arch/hp300/dev/diofbvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: diofbvar.h,v 1.9 2006/08/09 21:23:51 miod Exp $ */
+/* $OpenBSD: diofbvar.h,v 1.10 2006/08/11 18:33:13 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -97,8 +97,8 @@ struct diofb {
u_int mapmode;
/* blockmove routine */
- void (*bmv)(struct diofb *, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+ int (*bmv)(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
};
/* Replacement Rules (rops) */
@@ -124,8 +124,8 @@ paddr_t diofb_mmap(void *, off_t, int);
int diofb_show_screen(void *, void *, int, void (*)(void *, int, int),
void *);
-void diofb_mono_windowmove(struct diofb *, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+int diofb_mono_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
/* Console support */
void dvboxcninit(void);
diff --git a/sys/arch/hp300/dev/dvbox.c b/sys/arch/hp300/dev/dvbox.c
index 3d6d75e3d61..1607cda0379 100644
--- a/sys/arch/hp300/dev/dvbox.c
+++ b/sys/arch/hp300/dev/dvbox.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dvbox.c,v 1.12 2005/12/31 18:13:41 miod Exp $ */
+/* $OpenBSD: dvbox.c,v 1.13 2006/08/11 18:33:13 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -119,8 +119,8 @@ int dvbox_reset(struct diofb *, int, struct diofbreg *);
void dvbox_restore(struct diofb *);
void dvbox_setcolor(struct diofb *, u_int,
u_int8_t, u_int8_t, u_int8_t);
-void dvbox_windowmove(struct diofb *, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+int dvbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
int dvbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
void dvbox_burner(void *, u_int, u_int);
@@ -394,12 +394,16 @@ dvbox_burner(void *v, u_int on, u_int flags)
db->dispen = 0x00;
}
-void
+int
dvbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
+ int16_t planemask)
{
volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva;
+ if (planemask != 0xff)
+ return (EINVAL);
+
db_waitbusy(db);
db->rep_rule = DVBOX_DUALROP(rop);
@@ -412,6 +416,8 @@ dvbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
db->wmove = 1;
db_waitbusy(db);
+
+ return (0);
}
/*
diff --git a/sys/arch/hp300/dev/gbox.c b/sys/arch/hp300/dev/gbox.c
index bb35fa3da72..f6068d66a21 100644
--- a/sys/arch/hp300/dev/gbox.c
+++ b/sys/arch/hp300/dev/gbox.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gbox.c,v 1.13 2005/12/31 18:13:41 miod Exp $ */
+/* $OpenBSD: gbox.c,v 1.14 2006/08/11 18:33:13 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -123,8 +123,8 @@ int gbox_reset(struct diofb *, int, struct diofbreg *);
void gbox_restore(struct diofb *);
int gbox_setcmap(struct diofb *, struct wsdisplay_cmap *);
void gbox_setcolor(struct diofb *, u_int);
-void gbox_windowmove(struct diofb *, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+int gbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
int gbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
void gbox_burner(void *, u_int, u_int);
@@ -405,13 +405,17 @@ gbox_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
return (0);
}
-void
+int
gbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
+ int16_t planemask)
{
volatile struct gboxfb *gb = (struct gboxfb *)fb->regkva;
int src, dest;
+ if (planemask != 0xff)
+ return (EINVAL);
+
src = (sy * 1024) + sx; /* upper left corner in pixels */
dest = (dy * 1024) + dx;
@@ -432,6 +436,8 @@ gbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
FBBASE(fb)[dest] = FBBASE(fb)[src];
tile_mover_waitbusy(gb);
+
+ return (0);
}
/*
diff --git a/sys/arch/hp300/dev/rbox.c b/sys/arch/hp300/dev/rbox.c
index 92951682cbc..b18db52aaaf 100644
--- a/sys/arch/hp300/dev/rbox.c
+++ b/sys/arch/hp300/dev/rbox.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rbox.c,v 1.13 2005/12/31 18:13:41 miod Exp $ */
+/* $OpenBSD: rbox.c,v 1.14 2006/08/11 18:33:13 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat
@@ -119,8 +119,8 @@ int rbox_reset(struct diofb *, int, struct diofbreg *);
void rbox_restore(struct diofb *);
void rbox_setcolor(struct diofb *, u_int,
u_int8_t, u_int8_t, u_int8_t);
-void rbox_windowmove(struct diofb *, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+int rbox_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
int rbox_ioctl(void *, u_long, caddr_t, int, struct proc *);
void rbox_burner(void *, u_int, u_int);
@@ -357,12 +357,16 @@ rbox_burner(void *v, u_int on, u_int flags)
}
}
-void
+int
rbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
+ int16_t planemask)
{
volatile struct rboxfb *rb = (struct rboxfb *)fb->regkva;
+ if (planemask != 0xff)
+ return (EINVAL);
+
rb_waitbusy(rb);
rb->rep_rule = RBOX_DUALROP(rop);
@@ -375,6 +379,8 @@ rbox_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
rb->wmove = 1;
rb_waitbusy(rb);
+
+ return (0);
}
/*
diff --git a/sys/arch/hp300/dev/topcat.c b/sys/arch/hp300/dev/topcat.c
index 8ad9c6a8425..051c990ea47 100644
--- a/sys/arch/hp300/dev/topcat.c
+++ b/sys/arch/hp300/dev/topcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: topcat.c,v 1.14 2005/12/31 18:13:41 miod Exp $ */
+/* $OpenBSD: topcat.c,v 1.15 2006/08/11 18:33:13 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
@@ -122,8 +122,8 @@ int topcat_reset(struct diofb *, int, struct diofbreg *);
void topcat_restore(struct diofb *);
int topcat_setcmap(struct diofb *, struct wsdisplay_cmap *);
void topcat_setcolor(struct diofb *, u_int);
-void topcat_windowmove(struct diofb *, u_int16_t, u_int16_t,
- u_int16_t, u_int16_t, u_int16_t, u_int16_t, int);
+int topcat_windowmove(struct diofb *, u_int16_t, u_int16_t, u_int16_t,
+ u_int16_t, u_int16_t, u_int16_t, int16_t, int16_t);
int topcat_ioctl(void *, u_long, caddr_t, int, struct proc *);
void topcat_burner(void *, u_int, u_int);
@@ -475,15 +475,22 @@ topcat_setcmap(struct diofb *fb, struct wsdisplay_cmap *cm)
* Accelerated routines
*/
-void
+int
topcat_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
- u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int rop)
+ u_int16_t dx, u_int16_t dy, u_int16_t cx, u_int16_t cy, int16_t rop,
+ int16_t planemask)
{
volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
tc_waitbusy(tc, fb->planemask);
+ tc->wen = planemask;
tc->wmrr = rop;
+ if (planemask != 0xff) {
+ tc->wen = planemask ^ 0xff;
+ tc->wmrr = rop ^ 0x0f;
+ tc->wen = fb->planemask;
+ }
tc->source_y = sy;
tc->source_x = sx;
tc->dest_y = dy;
@@ -493,6 +500,8 @@ topcat_windowmove(struct diofb *fb, u_int16_t sx, u_int16_t sy,
tc->wmove = fb->planemask;
tc_waitbusy(tc, fb->planemask);
+
+ return (0);
}
/*