From owner-svn-src-head@freebsd.org Sun Apr 23 08:59:37 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 20111D4C492; Sun, 23 Apr 2017 08:59:37 +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 F184AE27; Sun, 23 Apr 2017 08:59:36 +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 v3N8xat5080444; Sun, 23 Apr 2017 08:59:36 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8xaJW080443; Sun, 23 Apr 2017 08:59:36 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704230859.v3N8xaJW080443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sun, 23 Apr 2017 08:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317334 - 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: Sun, 23 Apr 2017 08:59:37 -0000 Author: bde Date: Sun Apr 23 08:59:35 2017 New Revision: 317334 URL: https://svnweb.freebsd.org/changeset/base/317334 Log: Change the drawing method for the mouse cursor in planar mode to support colors. Colors are still hard-coded as 15 (normally lightwhite) for the interior and 0 (normally black) for the border, but these are now values used in 2 expressions instead of built in to the algorithm. The algorithm used a fancy and/or method, but this gives no control over the colors except and'ing all color planes off gives black and or'ing all color planes on gives lightwhite. Just draw the border and interior in separate colors using the same method as for characters, including its complications to optimize for VGA adaptors. Optimization is not really needed here, but for the VGA case it avoids being slower than the and/or method. The optimization is worth about 30%. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Sun Apr 23 08:58:50 2017 (r317333) +++ head/sys/dev/syscons/scvgarndr.c Sun Apr 23 08:59:35 2017 (r317334) @@ -1009,23 +1009,34 @@ draw_pxlmouse_planar(scr_stat *scp, int yoff = y - rounddown(y, line_width); ymax = imin(y + mdp->md_height, scp->ypixel); - outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ - outw(GDCIDX, 0x0001); /* set/reset enable */ - outw(GDCIDX, 0xff08); /* bit mask */ - outw(GDCIDX, 0x0803); /* data rotate/function select (and) */ + if (scp->sc->adp->va_type == KD_VGA) { + outw(GDCIDX, 0x0305); /* read mode 0, write mode 3 */ + outw(GDCIDX, 0xff08); /* bit mask */ + } else + outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ + outw(GDCIDX, 0x0003); /* data rotate/function select */ + outw(GDCIDX, 0x0f01); /* set/reset enable */ + + outw(GDCIDX, (0 << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { - m = ~(mdp->md_border[j] << 8 >> xoff); + m = mdp->md_border[j] << 8 >> xoff; for (k = 0; k < 3; ++k) { m1 = m >> (8 * (2 - k)); - if (m1 != 0xff && x + 8 * k < scp->xpixel) { + if (m1 != 0 && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m1); - } + if (scp->sc->adp->va_type == KD_VGA) + writeb(p + k, m1); + else { + /* bit mask: */ + outw(GDCIDX, (m1 << 8) | 0x08); + writeb(p + k, 0); + } + } } p += line_width; } - outw(GDCIDX, 0x1003); /* data rotate/function select (or) */ + outw(GDCIDX, (15 << 8) | 0x00); /* set/reset */ p = scp->sc->adp->va_window + line_width*y + x/8; for (i = y, j = 0; i < ymax; ++i, ++j) { m = mdp->md_interior[j] << 8 >> xoff; @@ -1033,12 +1044,23 @@ draw_pxlmouse_planar(scr_stat *scp, int m1 = m >> (8 * (2 - k)); if (m1 != 0 && x + 8 * k < scp->xpixel) { readb(p + k); - writeb(p + k, m1); + if (scp->sc->adp->va_type == KD_VGA) + writeb(p + k, m1); + else { + /* bit mask: */ + outw(GDCIDX, (m1 << 8) | 0x08); + writeb(p + k, 0); + } } } p += line_width; } - outw(GDCIDX, 0x0003); /* data rotate/function select */ + if (scp->sc->adp->va_type == KD_VGA) + outw(GDCIDX, 0x0005); /* read mode 0, write mode 0 */ + else + outw(GDCIDX, 0xff08); /* bit mask */ + outw(GDCIDX, 0x0000); /* set/reset */ + outw(GDCIDX, 0x0001); /* set/reset enable */ } static void