diff --git a/sys/dev/rasops/rasops.h b/sys/dev/rasops/rasops.h index b6ad4b0c7134..777bd15a16cd 100644 --- a/sys/dev/rasops/rasops.h +++ b/sys/dev/rasops/rasops.h @@ -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 @@ void rasops32_init(struct rasops_info *); #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 --git a/sys/dev/rasops/rasops15.c b/sys/dev/rasops/rasops15.c index caeea8cfe2c4..cd920efe4326 100644 --- a/sys/dev/rasops/rasops15.c +++ b/sys/dev/rasops/rasops15.c @@ -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 -__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 @@ rasops15_init(struct rasops_info *ri) } #ifndef RASOPS_SMALL - stamp_attr = 0; + stamp_attr = -1; stamp_ri = NULL; #endif } diff --git a/sys/dev/rasops/rasops2.c b/sys/dev/rasops/rasops2.c index 17764011c264..1b566a088bb8 100644 --- a/sys/dev/rasops/rasops2.c +++ b/sys/dev/rasops/rasops2.c @@ -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 -__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 @@ rasops2_init(struct rasops_info *ri) } #ifndef RASOPS_SMALL - stamp_attr = 0; + stamp_attr = -1; stamp_ri = NULL; #endif } diff --git a/sys/dev/rasops/rasops24.c b/sys/dev/rasops/rasops24.c index 29f952ed58b0..256162b36e2b 100644 --- a/sys/dev/rasops/rasops24.c +++ b/sys/dev/rasops/rasops24.c @@ -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 -__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 @@ rasops24_init(struct rasops_info *ri) } #ifndef RASOPS_SMALL - stamp_attr = 0; + stamp_attr = -1; stamp_ri = NULL; #endif } diff --git a/sys/dev/rasops/rasops32.c b/sys/dev/rasops/rasops32.c index 753738d105c5..4969dcc7cfd7 100644 --- a/sys/dev/rasops/rasops32.c +++ b/sys/dev/rasops/rasops32.c @@ -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 -__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 @@ rasops32_init(struct rasops_info *ri) } #ifndef RASOPS_SMALL - stamp_attr = 0; + stamp_attr = -1; stamp_ri = NULL; #endif } diff --git a/sys/dev/rasops/rasops4.c b/sys/dev/rasops/rasops4.c index ac19a35ab53c..25a38a3170f5 100644 --- a/sys/dev/rasops/rasops4.c +++ b/sys/dev/rasops/rasops4.c @@ -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 -__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 @@ rasops4_init(struct rasops_info *ri) } #ifndef RASOPS_SMALL - stamp_attr = 0; + stamp_attr = -1; stamp_ri = NULL; #endif } diff --git a/sys/dev/rasops/rasops8.c b/sys/dev/rasops/rasops8.c index efd92b450dc8..dc92f7124af6 100644 --- a/sys/dev/rasops/rasops8.c +++ b/sys/dev/rasops/rasops8.c @@ -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 -__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 @@ rasops8_init(struct rasops_info *ri) } #ifndef RASOPS_SMALL - stamp_attr = 0; + stamp_attr = -1; stamp_ri = NULL; #endif } diff --git a/sys/dev/rasops/rasops_putchar_width.h b/sys/dev/rasops/rasops_putchar_width.h index aeb3b80164d1..374351121d0b 100644 --- a/sys/dev/rasops/rasops_putchar_width.h +++ b/sys/dev/rasops/rasops_putchar_width.h @@ -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 @@ NAME(RASOPS_DEPTH, RASOPS_WIDTH)(void *cookie, int row, int col, u_int uc, 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 @@ NAME(RASOPS_DEPTH, RASOPS_WIDTH)(void *cookie, int row, int col, u_int uc, 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 @@ NAME(RASOPS_DEPTH, RASOPS_WIDTH)(void *cookie, int row, int col, u_int uc, } /* 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,