diff options
author | Bruce Evans <bde@FreeBSD.org> | 2017-04-23 08:59:35 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2017-04-23 08:59:35 +0000 |
commit | bfbcb15f76a9f3751adb3b8e61742b6d7e5a32a3 (patch) | |
tree | 23cfec728d950592350bfb10383c143e1ad1263a /sys/dev/syscons | |
parent | 25ada637362d970f4a984ef6afa9a9c8d721c58f (diff) |
Change the drawing method for the mouse cursor in planar mode to support
colors.
Colors are still hard-coded as 15 (normally lightwhite) for the interior
and 0 (normally black) for the border, but these are now values used in
2 expressions instead of built in to the algorithm. The algorithm used
a fancy and/or method, but this gives no control over the colors except
and'ing all color planes off gives black and or'ing all color planes on
gives lightwhite. Just draw the border and interior in separate colors
using the same method as for characters, including its complications to
optimize for VGA adaptors. Optimization is not really needed here, but
for the VGA case it avoids being slower than the and/or method. The
optimization is worth about 30%.
Notes
Notes:
svn path=/head/; revision=317334
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r-- | sys/dev/syscons/scvgarndr.c | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/sys/dev/syscons/scvgarndr.c b/sys/dev/syscons/scvgarndr.c index 69e831c4e8cb..7cecae9db1cb 100644 --- a/sys/dev/syscons/scvgarndr.c +++ b/sys/dev/syscons/scvgarndr.c @@ -1009,23 +1009,34 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y) yoff = y - rounddown(y, line_width); ymax = imin(y + mdp->md_height, scp->ypixel); - outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ - outw(GDCIDX, 0x0001); /* set/reset enable */ - outw(GDCIDX, 0xff08); /* bit mask */ - outw(GDCIDX, 0x0803); /* data rotate/function select (and) */ + if (scp->sc->adp->va_type == KD_VGA) { + outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */ + outw(GDCIDX, 0xff08); /* bit mask */ + } else + outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ + outw(GDCIDX, 0x0003); /* data rotate/function select */ + outw(GDCIDX, 0x0f01); /* set/reset enable */ + + outw(GDCIDX, (0 << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { - m = ~(mdp->md_border[j] << 8 >> xoff); + m = mdp->md_border[j] << 8 >> xoff; for (k = 0; k < 3; ++k) { m1 = m >> (8 * (2 - k)); - if (m1 != 0xff && x + 8 * k < scp->xpixel) { + if (m1 != 0 && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m1); - } + if (scp->sc->adp->va_type == KD_VGA) + writeb(p + k, m1); + else { + /* bit mask: */ + outw(GDCIDX, (m1 << 8) | 0x08); + writeb(p + k, 0); + } + } } p += line_width; } - outw(GDCIDX, 0x1003); /* data rotate/function select (or) */ + outw(GDCIDX, (15 << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { m = mdp->md_interior[j] << 8 >> xoff; @@ -1033,12 +1044,23 @@ draw_pxlmouse_planar(scr_stat *scp, int x, int y) m1 = m >> (8 * (2 - k)); if (m1 != 0 && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m1); + if (scp->sc->adp->va_type == KD_VGA) + writeb(p + k, m1); + else { + /* bit mask: */ + outw(GDCIDX, (m1 << 8) | 0x08); + writeb(p + k, 0); + } } } p += line_width; } - outw(GDCIDX, 0x0003); /* data rotate/function select */ + if (scp->sc->adp->va_type == KD_VGA) + outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ + else + outw(GDCIDX, 0xff08); /* bit mask */ + outw(GDCIDX, 0x0000); /* set/reset */ + outw(GDCIDX, 0x0001); /* set/reset enable */ } static void |