From owner-svn-src-head@freebsd.org Fri Apr 21 17:57:25 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 4F84FD4997F; Fri, 21 Apr 2017 17:57:25 +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 1C81A86B; Fri, 21 Apr 2017 17:57:25 +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 v3LHvOiv019418; Fri, 21 Apr 2017 17:57:24 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3LHvOj3019417; Fri, 21 Apr 2017 17:57:24 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704211757.v3LHvOj3019417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 21 Apr 2017 17:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317264 - 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: Fri, 21 Apr 2017 17:57:25 -0000 Author: bde Date: Fri Apr 21 17:57:23 2017 New Revision: 317264 URL: https://svnweb.freebsd.org/changeset/base/317264 Log: Optimize setting of the foreground color in the main planar method much like for the background color. This is a about 5% faster for output that actually reaches the screen. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Fri Apr 21 17:42:48 2017 (r317263) +++ head/sys/dev/syscons/scvgarndr.c Fri Apr 21 17:57:23 2017 (r317264) @@ -736,7 +736,7 @@ vga_vgadraw_planar(scr_stat *scp, int fr vm_offset_t d; vm_offset_t e; u_char *f; - u_short bg; + u_short bg, fg; u_short col1, col2; int line_width; int i, j; @@ -754,7 +754,7 @@ vga_vgadraw_planar(scr_stat *scp, int fr outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ outw(GDCIDX, 0x0003); /* data rotate/function select */ outw(GDCIDX, 0x0f01); /* set/reset enable */ - bg = -1; + fg = bg = -1; if (from + count > scp->xsize*scp->ysize) count = scp->xsize*scp->ysize - from; for (i = from; count-- > 0; ++i) { @@ -769,6 +769,7 @@ vga_vgadraw_planar(scr_stat *scp, int fr /* set background color in EGA/VGA latch */ if (bg != col2) { bg = col2; + fg = -1; outw(GDCIDX, bg | 0x00); /* set/reset */ if (scp->sc->adp->va_type != KD_VGA) outw(GDCIDX, 0xff08); /* bit mask */ @@ -776,7 +777,10 @@ vga_vgadraw_planar(scr_stat *scp, int fr c = readb(d); /* set bg color in the latch */ } /* foreground color */ - outw(GDCIDX, col1 | 0x00); /* set/reset */ + if (fg != col1) { + fg = col1; + outw(GDCIDX, col1 | 0x00); /* set/reset */ + } e = d; f = &(scp->font[sc_vtb_getc(&scp->vtb, i)*scp->font_size]); for (j = 0; j < scp->font_size; ++j, ++f) {