Thu Jan 28 17:40:00 2021 UTC ()
fix logic botch from previous - if we're asked to draw the cursor somewhere
else and it's still visible we need to clear it


(macallan)
diff -r1.50 -r1.51 src/sys/dev/wscons/wsdisplay_vcons.c

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

--- src/sys/dev/wscons/wsdisplay_vcons.c 2021/01/26 16:24:17 1.50
+++ src/sys/dev/wscons/wsdisplay_vcons.c 2021/01/28 17:40:00 1.51
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: wsdisplay_vcons.c,v 1.50 2021/01/26 16:24:17 macallan Exp $ */ 1/* $NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 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.50 2021/01/26 16:24:17 macallan Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.51 2021/01/28 17:40:00 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>
@@ -1324,27 +1324,27 @@ vcons_cursor(void *cookie, int on, int r @@ -1324,27 +1324,27 @@ vcons_cursor(void *cookie, int on, int r
1324 1324
1325static void 1325static void
1326vcons_cursor_noread(void *cookie, int on, int row, int col) 1326vcons_cursor_noread(void *cookie, int on, int row, int col)
1327{ 1327{
1328 struct rasops_info *ri = cookie; 1328 struct rasops_info *ri = cookie;
1329 struct vcons_screen *scr = ri->ri_hw; 1329 struct vcons_screen *scr = ri->ri_hw;
1330 int offset = 0, ofs; 1330 int offset = 0, ofs;
1331 1331
1332#ifdef WSDISPLAY_SCROLLSUPPORT 1332#ifdef WSDISPLAY_SCROLLSUPPORT
1333 offset = scr->scr_current_offset; 1333 offset = scr->scr_current_offset;
1334#endif 1334#endif
1335 ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; 1335 ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol;
1336 if ((ri->ri_flg & RI_CURSOR) &&  1336 if ((ri->ri_flg & RI_CURSOR) &&
1337 ((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ)) { 1337 (((scr->scr_flags & VCONS_DONT_READ) != VCONS_DONT_READ) || on)) {
1338 scr->putchar(cookie, ri->ri_crow, ri->ri_ccol, 1338 scr->putchar(cookie, ri->ri_crow, ri->ri_ccol,
1339 scr->scr_chars[ofs], scr->scr_attrs[ofs]); 1339 scr->scr_chars[ofs], scr->scr_attrs[ofs]);
1340 ri->ri_flg &= ~RI_CURSOR; 1340 ri->ri_flg &= ~RI_CURSOR;
1341 } 1341 }
1342 ri->ri_crow = row; 1342 ri->ri_crow = row;
1343 ri->ri_ccol = col; 1343 ri->ri_ccol = col;
1344 ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol; 1344 ofs = offset + ri->ri_crow * ri->ri_cols + ri->ri_ccol;
1345 if (on) { 1345 if (on) {
1346 scr->putchar(cookie, row, col, scr->scr_chars[ofs], 1346 scr->putchar(cookie, row, col, scr->scr_chars[ofs],
1347#ifdef VCONS_DEBUG_CURSOR_NOREAD 1347#ifdef VCONS_DEBUG_CURSOR_NOREAD
1348 /* draw a red cursor so we can tell which cursor()  1348 /* draw a red cursor so we can tell which cursor()
1349 * implementation is being used */ 1349 * implementation is being used */
1350 ((scr->scr_attrs[ofs] & 0xff00ffff) ^ 0x0f000000) | 1350 ((scr->scr_attrs[ofs] & 0xff00ffff) ^ 0x0f000000) |