From owner-svn-src-head@freebsd.org Sat Apr 8 10:00:40 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B3B38D30252; Sat, 8 Apr 2017 10:00:40 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7685195D; Sat, 8 Apr 2017 10:00:40 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v38A0dpM078785; Sat, 8 Apr 2017 10:00:39 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v38A0dBU078784; Sat, 8 Apr 2017 10:00:39 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704081000.v38A0dBU078784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 8 Apr 2017 10:00:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316642 - head/sys/dev/syscons X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Apr 2017 10:00:40 -0000 Author: bde Date: Sat Apr 8 10:00:39 2017 New Revision: 316642 URL: https://svnweb.freebsd.org/changeset/base/316642 Log: Quick fix for removal of the mouse cursor in vga direct graphics modes (that is, in all supported 8, 15, 16 and 24-color modes). Moving the mouse cursor while holding down a button (giving cut marking) left a trail of garbage from misremoved mouse cursors (usually colored rectangles and not cursor shapes). Cases with a button not held down worked better and may even have worked. No renderer support for removing (software) mouse cursors is needed (and many renderers don't have any), since sc_remove_mouse_image() marks for update the region containing the image and usually much more. The mouse cursor can be (partially) over as many as 4 character cells, and removing it in only the 1-4 cells occupied by it would be best for efficiency and for avoiding flicker. However, sc_remove_mouse_image() can only mark a single linear region and usually marks a full row of cells and 1 more to be sure to cover the 4 cells. It always does this, so using the special rendering method just wastes even more time and gives even more flicker. The special methods will be removed soon. The general method always works. vga_pxlmouse_direct() appeared to defer to it by returning immediately if !on. However, vga_pxlmouse_direct() actually did foot-shooting using a disguised saveunder method. Normal order near a mouse move is: (1) remove the mouse cursor in the renderer (optional) (2) remove the mouse cursor again and refresh the screen over the mouse cursor and much more from the vtb. When the mouse has actually moved and a button is down, many attributes in this region are changed to be up to date with the new cut marking (3) draw the keyboard cursor again if it was clobbered by the update (4) draw the mouse cursor image in its new position. The bug was to remove the mouse cursor again in step (4), before the drawing it again in (4), using a saveunder that was valid in step (1) at best. The quick fix is to use the saveunder in step (1) and not in step (4). Using it in step (4) also used it before it was initialized, initially and after mode and screen switches. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Sat Apr 8 09:49:21 2017 (r316641) +++ head/sys/dev/syscons/scvgarndr.c Sat Apr 8 10:00:39 2017 (r316642) @@ -1167,9 +1167,6 @@ vga_pxlmouse_direct(scr_stat *scp, int x uint8_t *u8; int bpp; - if (!on) - return; - bpp = scp->sc->adp->va_info.vi_depth; if ((bpp == 16) && (scp->sc->adp->va_info.vi_pixel_fsizes[1] == 5)) @@ -1181,6 +1178,9 @@ vga_pxlmouse_direct(scr_stat *scp, int x xend = imin(x + 16, scp->xpixel); yend = imin(y + 16, scp->ypixel); + if (on) + goto do_on; + p = scp->sc->adp->va_window + y_old * line_width + x_old * pixel_size; for (i = 0; i < (yend_old - y_old); i++) { @@ -1205,7 +1205,9 @@ vga_pxlmouse_direct(scr_stat *scp, int x p += line_width; } + return; +do_on: p = scp->sc->adp->va_window + y * line_width + x * pixel_size; for (i = 0; i < (yend - y); i++) {