Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sun be lazy about clearing the cursor - in most case...



details:   https://anonhg.NetBSD.org/src/rev/320ee1eb63c0
branches:  trunk
changeset: 365844:320ee1eb63c0
user:      macallan <macallan%NetBSD.org@localhost>
date:      Thu Apr 28 03:12:03 2022 +0000

description:
be lazy about clearing the cursor - in most cases we're about to overwrite it
anyway. Same logic as with VCONS_DONT_READ.
visible speedup in things like systat and top

diffstat:

 sys/dev/sun/cgsix.c |  72 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 58 insertions(+), 14 deletions(-)

diffs (174 lines):

diff -r 9d236cde235d -r 320ee1eb63c0 sys/dev/sun/cgsix.c
--- a/sys/dev/sun/cgsix.c       Thu Apr 28 03:07:44 2022 +0000
+++ b/sys/dev/sun/cgsix.c       Thu Apr 28 03:12:03 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgsix.c,v 1.70 2021/08/07 16:19:16 thorpej Exp $ */
+/*     $NetBSD: cgsix.c,v 1.71 2022/04/28 03:12:03 macallan Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.70 2021/08/07 16:19:16 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.71 2022/04/28 03:12:03 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -339,6 +339,23 @@
 }
 
 static void
+cg6_ras_nuke_cursor(struct rasops_info *ri)
+{
+       struct vcons_screen *scr = ri->ri_hw;
+       struct cgsix_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;
+               cg6_invert(sc, x, y, wi, he);
+               ri->ri_flg &= ~RI_CURSOR;
+       }
+}
+
+static void
 cg6_ras_copyrows(void *cookie, int src, int dst, int n)
 {
        struct rasops_info *ri = cookie;
@@ -362,6 +379,10 @@
                n = ri->ri_rows - dst;
        if (n <= 0)
                return;
+       if ((ri->ri_crow >= src && ri->ri_crow < (src + n)) &&
+          (ri->ri_flg & RI_CURSOR)) {
+               cg6_ras_nuke_cursor(ri);
+       }
        n *= ri->ri_font->fontheight;
        src *= ri->ri_font->fontheight;
        dst *= ri->ri_font->fontheight;
@@ -380,6 +401,8 @@
        fbc->fbc_x3 = ri->ri_xorigin + ri->ri_emuwidth - 1;
        fbc->fbc_y3 = ri->ri_yorigin + dst + n - 1;
        CG6_BLIT(fbc);
+       if (ri->ri_crow >= dst && ri->ri_crow < (dst + n))
+               ri->ri_flg &= ~RI_CURSOR;
 }
 
 static void
@@ -408,6 +431,11 @@
                n = ri->ri_cols - dst;
        if (n <= 0)
                return;
+       if (ri->ri_crow == row && 
+          (ri->ri_ccol >= src && ri->ri_ccol < (src + n)) &&
+          (ri->ri_flg & RI_CURSOR)) {
+               cg6_ras_nuke_cursor(ri);
+       }
        n *= ri->ri_font->fontwidth;
        src *= ri->ri_font->fontwidth;
        dst *= ri->ri_font->fontwidth;
@@ -429,6 +457,9 @@
        fbc->fbc_y3 = ri->ri_yorigin + row + 
            ri->ri_font->fontheight - 1;
        CG6_BLIT(fbc);
+       if (ri->ri_crow == row && 
+          (ri->ri_ccol >= dst && ri->ri_ccol < (dst + n)))
+               ri->ri_flg &= ~RI_CURSOR;
 }
 
 static void
@@ -449,6 +480,11 @@
                n = ri->ri_cols - col;
        if (n <= 0)
                return;
+
+       if (ri->ri_crow == row && 
+          (ri->ri_ccol >= col && ri->ri_ccol < (col + n)))
+               ri->ri_flg &= ~RI_CURSOR;
+
        n *= ri->ri_font->fontwidth;
        col *= ri->ri_font->fontwidth;
        row *= ri->ri_font->fontheight;
@@ -483,6 +519,9 @@
        if (n <= 0)
                return;
 
+       if (ri->ri_crow >= row && ri->ri_crow < (row + n))
+               ri->ri_flg &= ~RI_CURSOR;
+
        CG6_WAIT_READY(fbc);
        fbc->fbc_alu = CG6_ALU_FILL;
        fbc->fbc_mode = GX_BLIT_SRC | GX_MODE_COLOR8;
@@ -624,7 +663,7 @@
                }
        }
        cg6_setup_palette(sc);
-       
+
        aa.scrdata = &cgsix_screenlist;
        aa.console = isconsole;
        aa.accessops = &cgsix_accessops;
@@ -1369,6 +1408,10 @@
        if ((row >= 0) && (row < ri->ri_rows) && (col >= 0) && 
            (col < ri->ri_cols)) {
 
+               if (row == ri->ri_crow && col == ri->ri_ccol) {
+                       ri->ri_flg &= ~RI_CURSOR;
+               }
+
                if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
 
                        int fg, bg, uc, i;
@@ -1438,6 +1481,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;
 
@@ -1532,21 +1579,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) {
+                               cg6_ras_nuke_cursor(ri);
+                       }
+                       x = col * wi + ri->ri_xorigin;
+                       y = row * he + ri->ri_yorigin;
                        cg6_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;
-                       cg6_invert(sc, x, y, wi, he);
-                       ri->ri_flg |= RI_CURSOR;
-               }
        } else
        {
                ri->ri_crow = row;
@@ -1574,6 +1617,7 @@
                fbc->fbc_arectx = ri->ri_width - 1;
                fbc->fbc_arecty = ri->ri_height - 1;
                CG6_DRAW(fbc);
+               ri->ri_flg &= ~RI_CURSOR;
        }
 }
 



Home | Main Index | Thread Index | Old Index