Sat Jan 2 03:00:56 2021 UTC ()
be more careful when optimizing stretches of blanks into erasecols()
now testpat's output is redrawn properly


(macallan)
diff -r1.44 -r1.45 src/sys/dev/wscons/wsdisplay_vcons.c

cvs diff -r1.44 -r1.45 src/sys/dev/wscons/wsdisplay_vcons.c (expand / switch to unified diff)

--- src/sys/dev/wscons/wsdisplay_vcons.c 2020/12/28 00:14:18 1.44
+++ src/sys/dev/wscons/wsdisplay_vcons.c 2021/01/02 03:00:56 1.45
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $ */ 1/* $NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2005, 2006 Michael Lorenz 4 * Copyright (c) 2005, 2006 Michael Lorenz
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.44 2020/12/28 00:14:18 macallan Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.45 2021/01/02 03:00:56 macallan Exp $");
31 31
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/buf.h> 35#include <sys/buf.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/ioctl.h> 37#include <sys/ioctl.h>
38#include <sys/malloc.h> 38#include <sys/malloc.h>
39#include <sys/mman.h> 39#include <sys/mman.h>
40#include <sys/tty.h> 40#include <sys/tty.h>
41#include <sys/conf.h> 41#include <sys/conf.h>
42#include <sys/proc.h> 42#include <sys/proc.h>
43#include <sys/kthread.h> 43#include <sys/kthread.h>
@@ -586,27 +586,27 @@ vcons_redraw_screen(struct vcons_screen  @@ -586,27 +586,27 @@ vcons_redraw_screen(struct vcons_screen
586 * and we already made sure the screen we're 586 * and we already made sure the screen we're
587 * working on is visible 587 * working on is visible
588 */ 588 */
589 c = charptr[offset]; 589 c = charptr[offset];
590 a = attrptr[offset]; 590 a = attrptr[offset];
591 acmp = a & mask; 591 acmp = a & mask;
592 if (c == ' ') { 592 if (c == ' ') {
593 /* 593 /*
594 * if we already erased the background 594 * if we already erased the background
595 * and this blank uses the same colour 595 * and this blank uses the same colour
596 * and flags we don't need to do 596 * and flags we don't need to do
597 * anything here 597 * anything here
598 */ 598 */
599 if (acmp == cmp) 599 if (acmp == cmp && start == -1)
600 goto next; 600 goto next;
601 /* 601 /*
602 * see if we can optimize things a 602 * see if we can optimize things a
603 * little bit by drawing stretches of 603 * little bit by drawing stretches of
604 * blanks using erasecols 604 * blanks using erasecols
605 */ 605 */
606  606
607 if (start == -1) { 607 if (start == -1) {
608 start = j; 608 start = j;
609 last_a = acmp; 609 last_a = acmp;
610 } else if (acmp != last_a) { 610 } else if (acmp != last_a) {
611 /* 611 /*
612 * different attr, need to 612 * different attr, need to