Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rasops When using stamp, drop attributions other tha...



details:   https://anonhg.NetBSD.org/src/rev/69bfa0d13c0d
branches:  trunk
changeset: 964721:69bfa0d13c0d
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Aug 14 00:51:10 2019 +0000

description:
When using stamp, drop attributions other than back and foreground
colors so that stamp is not updated unnecessarily.

diffstat:

 sys/dev/rasops/rasops.h               |   5 ++++-
 sys/dev/rasops/rasops15.c             |   6 +++---
 sys/dev/rasops/rasops2.c              |   6 +++---
 sys/dev/rasops/rasops24.c             |   6 +++---
 sys/dev/rasops/rasops32.c             |   6 +++---
 sys/dev/rasops/rasops4.c              |   6 +++---
 sys/dev/rasops/rasops8.c              |   6 +++---
 sys/dev/rasops/rasops_putchar_width.h |  12 ++++++++++--
 8 files changed, 32 insertions(+), 21 deletions(-)

diffs (221 lines):

diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops.h
--- a/sys/dev/rasops/rasops.h   Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops.h   Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops.h,v 1.47 2019/08/10 01:24:17 rin Exp $ */
+/*     $NetBSD: rasops.h,v 1.48 2019/08/14 00:51:10 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -203,6 +203,9 @@
 #define        ATTR_BG(ri, attr) ((ri)->ri_devcmap[((uint32_t)(attr) >> 16) & 0xf])
 #define        ATTR_FG(ri, attr) ((ri)->ri_devcmap[((uint32_t)(attr) >> 24) & 0xf])
 
+#define        ATTR_MASK_BG __BITS(16, 19)
+#define        ATTR_MASK_FG __BITS(24, 27)
+
 #define        DELTA(p, d, cast) ((p) = (cast)((uint8_t *)(p) + (d)))
 
 #define        FBOFFSET(ri, row, col)                                          \
diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops15.c
--- a/sys/dev/rasops/rasops15.c Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops15.c Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops15.c,v 1.38 2019/08/10 01:24:17 rin Exp $        */
+/*     $NetBSD: rasops15.c,v 1.39 2019/08/14 00:51:10 rin Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.38 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.39 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -109,7 +109,7 @@
        }
 
 #ifndef RASOPS_SMALL
-       stamp_attr = 0;
+       stamp_attr = -1;
        stamp_ri = NULL;
 #endif
 }
diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops2.c
--- a/sys/dev/rasops/rasops2.c  Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops2.c  Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops2.c,v 1.32 2019/08/10 01:24:17 rin Exp $ */
+/*     $NetBSD: rasops2.c,v 1.33 2019/08/14 00:51:10 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.32 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops2.c,v 1.33 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -111,7 +111,7 @@
        }
 
 #ifndef RASOPS_SMALL
-       stamp_attr = 0;
+       stamp_attr = -1;
        stamp_ri = NULL;
 #endif
 }
diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops24.c
--- a/sys/dev/rasops/rasops24.c Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops24.c Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops24.c,v 1.49 2019/08/10 01:24:17 rin Exp $        */
+/*     $NetBSD: rasops24.c,v 1.50 2019/08/14 00:51:10 rin Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.49 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.50 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -120,7 +120,7 @@
        }
 
 #ifndef RASOPS_SMALL
-       stamp_attr = 0;
+       stamp_attr = -1;
        stamp_ri = NULL;
 #endif
 }
diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops32.c
--- a/sys/dev/rasops/rasops32.c Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops32.c Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops32.c,v 1.45 2019/08/10 01:24:17 rin Exp $       */
+/*      $NetBSD: rasops32.c,v 1.46 2019/08/14 00:51:10 rin Exp $       */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.45 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.46 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -110,7 +110,7 @@
        }
 
 #ifndef RASOPS_SMALL
-       stamp_attr = 0;
+       stamp_attr = -1;
        stamp_ri = NULL;
 #endif
 }
diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops4.c
--- a/sys/dev/rasops/rasops4.c  Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops4.c  Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops4.c,v 1.27 2019/08/10 01:24:17 rin Exp $ */
+/*     $NetBSD: rasops4.c,v 1.28 2019/08/14 00:51:10 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.27 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops4.c,v 1.28 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -105,7 +105,7 @@
        }
 
 #ifndef RASOPS_SMALL
-       stamp_attr = 0;
+       stamp_attr = -1;
        stamp_ri = NULL;
 #endif
 }
diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops8.c
--- a/sys/dev/rasops/rasops8.c  Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops8.c  Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rasops8.c,v 1.50 2019/08/10 01:24:17 rin Exp $ */
+/*     $NetBSD: rasops8.c,v 1.51 2019/08/14 00:51:10 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.50 2019/08/10 01:24:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops8.c,v 1.51 2019/08/14 00:51:10 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_rasops.h"
@@ -108,7 +108,7 @@
        }
 
 #ifndef RASOPS_SMALL
-       stamp_attr = 0;
+       stamp_attr = -1;
        stamp_ri = NULL;
 #endif
 }
diff -r 8ca439846fa3 -r 69bfa0d13c0d sys/dev/rasops/rasops_putchar_width.h
--- a/sys/dev/rasops/rasops_putchar_width.h     Tue Aug 13 19:55:40 2019 +0000
+++ b/sys/dev/rasops/rasops_putchar_width.h     Wed Aug 14 00:51:10 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar_width.h,v 1.14 2019/08/10 01:24:17 rin Exp $ */
+/* $NetBSD: rasops_putchar_width.h,v 1.15 2019/08/14 00:51:10 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.41 2019/07/25 03:02:44 rin Exp  */
 /*-
@@ -210,6 +210,7 @@
        struct wsdisplay_font *font = PICK_FONT(ri, uc);
        int height;
        uint8_t *fr;
+       bool do_ul;
        STAMP_TYPE *rp, *hp;
 
        hp = NULL; /* XXX GCC */
@@ -227,6 +228,13 @@
                return;
 #endif
 
+       /*
+        * We don't care attributions other than back/foreground
+        * colors when using stamp.
+        */
+       do_ul = (attr & WSATTR_UNDERLINE) != 0;
+       attr &= (ATTR_MASK_BG | ATTR_MASK_FG);
+
        /* Recompute stamp? */
        if (attr != stamp_attr || __predict_false(ri != stamp_ri))
                MAKESTAMP(RASOPS_DEPTH)(ri, attr);
@@ -260,7 +268,7 @@
        }
 
        /* Do underline */
-       if ((attr & WSATTR_UNDERLINE) != 0) {
+       if (do_ul) {
                DELTA(rp, - ri->ri_stride * ri->ri_ul.off, STAMP_TYPE *);
                if (ri->ri_hwbits)
                        DELTA(hp, - ri->ri_stride * ri->ri_ul.off,



Home | Main Index | Thread Index | Old Index