From owner-svn-src-all@freebsd.org Fri Apr 14 14:00:15 2017 Return-Path: Delivered-To: svn-src-all@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 441ABD3D129; Fri, 14 Apr 2017 14:00:15 +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 EED607D; Fri, 14 Apr 2017 14:00:14 +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 v3EE0El2053722; Fri, 14 Apr 2017 14:00:14 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3EE0Eo8053721; Fri, 14 Apr 2017 14:00:14 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704141400.v3EE0Eo8053721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 14 Apr 2017 14:00:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316830 - 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-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Apr 2017 14:00:15 -0000 Author: bde Date: Fri Apr 14 14:00:13 2017 New Revision: 316830 URL: https://svnweb.freebsd.org/changeset/base/316830 Log: Optimize drawing of the mouse cursor in vga planar mode almost as much as possible, by avoiding null ANDs and ORs to the frame buffer. Mouse cursors are fairly sparse, especially for their frame. Pixels are written in groups of 8 in planar mode and the per-group sparseness is not as large, but it still averages about 40% with the current 9x13 mouse cursor. The average drawing time is reduced by about this amount (from 22 usec constant to 12.5 usec average on Haswell). This optimization is relatively larger with larger cursors. Width 10 requires 6 frame buffer accesses per line instead of 4 if not done sparsely, but rarely more than 4 if done sparsely. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Fri Apr 14 13:25:45 2017 (r316829) +++ head/sys/dev/syscons/scvgarndr.c Fri Apr 14 14:00:13 2017 (r316830) @@ -1032,6 +1032,7 @@ draw_pxlmouse_planar(scr_stat *scp, int int ymax; u_short m; int i, j, k; + uint8_t m1; line_width = scp->sc->adp->va_line_width; xoff = (x - scp->xoff*8)%8; @@ -1046,9 +1047,10 @@ draw_pxlmouse_planar(scr_stat *scp, int for (i = y, j = 0; i < ymax; ++i, ++j) { m = ~((mouse_and_mask[j] & ~mouse_or_mask[j]) >> xoff); for (k = 0; k < 2; ++k) { - if (x + 8 * k < scp->xpixel) { + m1 = m >> (8 * (1 - k)); + if (m1 != 0xff && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m >> (8 * (1 - k))); + writeb(p + k, m1); } } p += line_width; @@ -1058,9 +1060,10 @@ draw_pxlmouse_planar(scr_stat *scp, int for (i = y, j = 0; i < ymax; ++i, ++j) { m = mouse_or_mask[j] >> xoff; for (k = 0; k < 2; ++k) { - if (x + 8 * k < scp->xpixel) { + m1 = m >> (8 * (1 - k)); + if (m1 != 0 && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m >> (8 * (1 - k))); + writeb(p + k, m1); } } p += line_width;