Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/dev be lazy about clearing the cursor since m...



details:   https://anonhg.NetBSD.org/src/rev/17446cdbde55
branches:  trunk
changeset: 366405:17446cdbde55
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed May 25 21:01:04 2022 +0000

description:
be lazy about clearing the cursor since most likely we're going to overwrite
it anyway. Same logic as in cgsix.

diffstat:

 sys/arch/sparc/dev/cgfourteen.c |  66 ++++++++++++++++++++++++++++++++--------
 1 files changed, 53 insertions(+), 13 deletions(-)

diffs (147 lines):

diff -r 7e1919d877f6 -r 17446cdbde55 sys/arch/sparc/dev/cgfourteen.c
--- a/sys/arch/sparc/dev/cgfourteen.c   Wed May 25 20:44:01 2022 +0000
+++ b/sys/arch/sparc/dev/cgfourteen.c   Wed May 25 21:01:04 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgfourteen.c,v 1.92 2021/12/17 19:27:57 macallan Exp $ */
+/*     $NetBSD: cgfourteen.c,v 1.93 2022/05/25 21:01:04 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -1485,6 +1485,10 @@
        if (!CHAR_IN_FONT(c, font))
                return;
 
+       if (row == ri->ri_crow && col == ri->ri_ccol) {
+               ri->ri_flg &= ~RI_CURSOR;
+       }
+
        wi = font->fontwidth;
        he = font->fontheight;
 
@@ -1538,6 +1542,23 @@
 }
 
 static void
+cg14_nuke_cursor(struct rasops_info *ri)
+{
+       struct vcons_screen *scr = ri->ri_hw;
+       struct cgfourteen_softc *sc = scr->scr_cookie;
+       int wi, he, x, y;
+               
+       if (ri->ri_flg & RI_CURSOR) {
+               wi = ri->ri_font->fontwidth;
+               he = ri->ri_font->fontheight;
+               x = ri->ri_ccol * wi + ri->ri_xorigin;
+               y = ri->ri_crow * he + ri->ri_yorigin;
+               cg14_invert(sc, x, y, wi, he);
+               ri->ri_flg &= ~RI_CURSOR;
+       }
+}
+
+static void
 cg14_cursor(void *cookie, int on, int row, int col)
 {
        struct rasops_info *ri = cookie;
@@ -1549,20 +1570,17 @@
        he = ri->ri_font->fontheight;
        
        if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
-               x = ri->ri_ccol * wi + ri->ri_xorigin;
-               y = ri->ri_crow * he + ri->ri_yorigin;
-               if (ri->ri_flg & RI_CURSOR) {
+               if (on) {
+                       if (ri->ri_flg & RI_CURSOR) {
+                               cg14_nuke_cursor(ri);
+                       }
+                       x = col * wi + ri->ri_xorigin;
+                       y = row * he + ri->ri_yorigin;
                        cg14_invert(sc, x, y, wi, he);
-                       ri->ri_flg &= ~RI_CURSOR;
+                       ri->ri_flg |= RI_CURSOR;
                }
                ri->ri_crow = row;
                ri->ri_ccol = col;
-               if (on) {
-                       x = ri->ri_ccol * wi + ri->ri_xorigin;
-                       y = ri->ri_crow * he + ri->ri_yorigin;
-                       cg14_invert(sc, x, y, wi, he);
-                       ri->ri_flg |= RI_CURSOR;
-               }
        } else {
                scr->scr_ri.ri_crow = row;
                scr->scr_ri.ri_ccol = col;
@@ -1590,6 +1608,10 @@
        if (!CHAR_IN_FONT(c, font))
                return;
 
+       if (row == ri->ri_crow && col == ri->ri_ccol) {
+               ri->ri_flg &= ~RI_CURSOR;
+       }
+
        wi = font->fontwidth;
        he = font->fontheight;
 
@@ -1692,12 +1714,20 @@
        int32_t xs, xd, y, width, height;
        
        if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
+               if (ri->ri_crow == row && 
+                  (ri->ri_ccol >= srccol && ri->ri_ccol < (srccol + ncols)) &&
+                  (ri->ri_flg & RI_CURSOR)) {
+                       cg14_nuke_cursor(ri);
+               }
                xs = ri->ri_xorigin + ri->ri_font->fontwidth * srccol;
                xd = ri->ri_xorigin + ri->ri_font->fontwidth * dstcol;
                y = ri->ri_yorigin + ri->ri_font->fontheight * row;
                width = ri->ri_font->fontwidth * ncols;
                height = ri->ri_font->fontheight;
                cg14_bitblt(sc, xs, y, xd, y, width, height, 0x0c);
+               if (ri->ri_crow == row && 
+                  (ri->ri_ccol >= dstcol && ri->ri_ccol < (dstcol + ncols)))
+                       ri->ri_flg &= ~RI_CURSOR;
        }
 }
 
@@ -1715,8 +1745,11 @@
                width = ri->ri_font->fontwidth * ncols;
                height = ri->ri_font->fontheight;
                rasops_unpack_attr(fillattr, &fg, &bg, &ul);
+               cg14_rectfill(sc, x, y, width, height, ri->ri_devcmap[bg]);
+               if (ri->ri_crow == row && 
+                  (ri->ri_ccol >= startcol && ri->ri_ccol < (startcol + ncols)))
+                       ri->ri_flg &= ~RI_CURSOR;
 
-               cg14_rectfill(sc, x, y, width, height, ri->ri_devcmap[bg]);
        }
 }
 
@@ -1729,12 +1762,18 @@
        int32_t x, ys, yd, width, height;
 
        if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
+               if ((ri->ri_crow >= srcrow && ri->ri_crow < (srcrow + nrows)) &&
+                  (ri->ri_flg & RI_CURSOR)) {
+                       cg14_nuke_cursor(ri);
+               }
                x = ri->ri_xorigin;
                ys = ri->ri_yorigin + ri->ri_font->fontheight * srcrow;
                yd = ri->ri_yorigin + ri->ri_font->fontheight * dstrow;
                width = ri->ri_emuwidth;
                height = ri->ri_font->fontheight * nrows;
                cg14_bitblt(sc, x, ys, x, yd, width, height, 0x0c);
+               if (ri->ri_crow >= dstrow && ri->ri_crow < (dstrow + nrows))
+                       ri->ri_flg &= ~RI_CURSOR;
        }
 }
 
@@ -1752,8 +1791,9 @@
                width = ri->ri_emuwidth;
                height = ri->ri_font->fontheight * nrows;
                rasops_unpack_attr(fillattr, &fg, &bg, &ul);
-
                cg14_rectfill(sc, x, y, width, height, ri->ri_devcmap[bg]);
+               if (ri->ri_crow >= row && ri->ri_crow < (row + nrows))
+                       ri->ri_flg &= ~RI_CURSOR;
        }
 }
 



Home | Main Index | Thread Index | Old Index