From owner-svn-src-all@freebsd.org Tue Aug 7 08:33:41 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FB751052530; Tue, 7 Aug 2018 08:33:41 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C8370839D4; Tue, 7 Aug 2018 08:33:40 +0000 (UTC) (envelope-from cperciva@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A929A196A9; Tue, 7 Aug 2018 08:33:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w778Xepr077456; Tue, 7 Aug 2018 08:33:40 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w778Xe2o077455; Tue, 7 Aug 2018 08:33:40 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201808070833.w778Xe2o077455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Tue, 7 Aug 2018 08:33:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r337411 - head/sys/dev/vt/hw/vga X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/sys/dev/vt/hw/vga X-SVN-Commit-Revision: 337411 X-SVN-Commit-Repository: base 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.27 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: Tue, 07 Aug 2018 08:33:41 -0000 Author: cperciva Date: Tue Aug 7 08:33:40 2018 New Revision: 337411 URL: https://svnweb.freebsd.org/changeset/base/337411 Log: Replace a pair of 8-bit writes to VGA memory with a single 16-bit write. The VGA "text mode" buffer has a pair of bytes for each character: One byte for the character symbol, and an "attribute" byte encoding the foreground and background colours. When updating the screen, we were writing these two bytes separately. On some virtualized systems, every write results in a glyph being redrawn into a (graphical) virtual screen; writing these two bytes separately results in twice as much work being done to draw characters, whereas if we perform a single 16-bit write instead, the character only needs to be redrawn once. On an EC2 c5.4xlarge instance, this change cuts 1.30s from the kernel boot, speeding it up from 8.90s to 7.60s. MFC after: 1 week Modified: head/sys/dev/vt/hw/vga/vt_vga.c Modified: head/sys/dev/vt/hw/vga/vt_vga.c ============================================================================== --- head/sys/dev/vt/hw/vga/vt_vga.c Tue Aug 7 07:12:59 2018 (r337410) +++ head/sys/dev/vt/hw/vga/vt_vga.c Tue Aug 7 08:33:40 2018 (r337411) @@ -68,6 +68,8 @@ struct vga_softc { bus_space_read_1(sc->vga_fb_tag, sc->vga_fb_handle, ofs) #define MEM_WRITE1(sc, ofs, val) \ bus_space_write_1(sc->vga_fb_tag, sc->vga_fb_handle, ofs, val) +#define MEM_WRITE2(sc, ofs, val) \ + bus_space_write_2(sc->vga_fb_tag, sc->vga_fb_handle, ofs, val) #define REG_READ1(sc, reg) \ bus_space_read_1(sc->vga_reg_tag, sc->vga_reg_handle, reg) #define REG_WRITE1(sc, reg, val) \ @@ -894,10 +896,8 @@ vga_bitblt_text_txtmode(struct vt_device *vd, const st cons_to_vga_colors[bg] << 4 | cons_to_vga_colors[fg]; - MEM_WRITE1(sc, (row * 80 + col) * 2 + 0, - ch); - MEM_WRITE1(sc, (row * 80 + col) * 2 + 1, - attr); + MEM_WRITE2(sc, (row * 80 + col) * 2 + 0, + ch + ((uint16_t)(attr) << 8)); } } }