From owner-svn-src-all@freebsd.org Thu Apr 20 16:34:11 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 6C0CDD4872A; Thu, 20 Apr 2017 16:34:11 +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 2CBF41FA7; Thu, 20 Apr 2017 16:34:11 +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 v3KGYAKu085068; Thu, 20 Apr 2017 16:34:10 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3KGYALk085066; Thu, 20 Apr 2017 16:34:10 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704201634.v3KGYALk085066@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Thu, 20 Apr 2017 16:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317198 - 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: Thu, 20 Apr 2017 16:34:11 -0000 Author: bde Date: Thu Apr 20 16:34:09 2017 New Revision: 317198 URL: https://svnweb.freebsd.org/changeset/base/317198 Log: When the character width is 9, remove vertical lines in the mouse cursor corresponding to the gaps between characters. This fixes distortion of the cursor due to expanding it across the gaps. Again for character width 9, when the cursor characters are not in the graphics range (0xb0-0xdf), the gaps were always there (filled in the background color for the previous char). They still look strange, but don't cause distortion. When the cursor characters are in the graphics range, the gaps are filled by repeating the previous line. This gives distortion with cilia. Removing vertical lines reduces the distortion to vertical cilia. Move the default for the cursor characters out of the graphics range. With character width 9, this gives gaps instead of distortion and other problems. With character width 8, it just fixes a smaller set of other problems. Some distortion and other problems can be recovered using vidcontrol -M. Presumably the default was to fill the gaps intentionally, but it is much better to leave gaps. The gaps can even be considered as a feature for text processing -- they give sub-pointers to character boundaries. The other problems are: (1) with character width 9, characters near the cursor are moved into the graphics range and thus distorted if any of their 8th bits is set; (2) conflicts with national characters in the graphics range. The default range for the graphics cursor characters is now 8-11. This doesn't conflict with anything, since the glyphs for the characters in this range are unreachable. Use the 10x16 mouse cursor in text mode too (if the font size is >= 14). When the character width is 9, removal of 1 or 2 vertical lines makes 10x16 cursor no wider than the 9x13 one usually was. We could even handle cursors 1 pixel wider in 2 character cells and gaps without more clipping than given by the gaps (the worst case is 1 pixel in the left cell, 1 removed in the middle gap, 8 in the right cell and 1 removed in the right gap. The pixel in the right gap is removed so it doesn't matter if it is in the font). When the character width is 8, we now clip the 10-wide cursor by 1 pixel in the worst case. This clipping is usually invisible since it is of the border and and the border usually merges with the background so is invisible. There should be an option to use reverse video to highlight the border and its tip instead of the interior (graphics mode can do better using separate colors). This needs the 9x13 cursor again. Ideas from: ache (especially about the bad default character range) Modified: head/sys/dev/syscons/scvgarndr.c head/sys/dev/syscons/syscons.h Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Thu Apr 20 15:53:20 2017 (r317197) +++ head/sys/dev/syscons/scvgarndr.c Thu Apr 20 16:34:09 2017 (r317198) @@ -173,8 +173,7 @@ static const struct mousedata mouse9x13 0x0c00, 0x0c00, 0x0600, 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, }, 9, 13, }; -#endif -#if defined(SC_PIXEL_MODE) + static const struct mousedata mouse10x16 = { { 0xc000, 0xa000, 0x9000, 0x8800, 0x8400, 0x8200, 0x8100, 0x8080, 0x8040, 0x83c0, 0x9200, 0xa900, 0xc900, 0x0480, 0x0480, 0x0300, }, { @@ -412,6 +411,7 @@ draw_txtmouse(scr_stat *scp, int x, int #ifndef SC_ALT_MOUSE_IMAGE if (ISMOUSEAVAIL(scp->sc->adp->va_flags)) { const struct mousedata *mdp; + uint32_t border, interior; u_char font_buf[128]; u_short cursor[32]; u_char c; @@ -420,7 +420,7 @@ draw_txtmouse(scr_stat *scp, int x, int int crtc_addr; int i; - mdp = &mouse9x13; + mdp = (scp->font_size < 14) ? &mouse9x13 : &mouse10x16; /* prepare mousepointer char's bitmaps */ pos = (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff; @@ -443,9 +443,23 @@ draw_txtmouse(scr_stat *scp, int x, int xoffset = x%8; yoffset = y%scp->font_size; for (i = 0; i < 16; ++i) { - cursor[i + yoffset] = - (cursor[i + yoffset] & ~(mdp->md_border[i] >> xoffset)) - | (mdp->md_interior[i] >> xoffset); + border = mdp->md_border[i] << 8; /* avoid right shifting out */ + interior = mdp->md_interior[i] << 8; + border >>= xoffset; /* normalize */ + interior >>= xoffset; + if (scp->sc->adp->va_flags & V_ADP_CWIDTH9) { + /* skip gaps between characters */ + border = (border & 0xff0000) | + (border & 0x007f80) << 1 | + (border & 0x00003f) << 2; + interior = (interior & 0xff0000) | + (interior & 0x007f80) << 1 | + (interior & 0x00003f) << 2; + } + border >>= 8; /* back to normal position */ + interior >>= 8; + cursor[i + yoffset] = (cursor[i + yoffset] & ~border) | + interior; } for (i = 0; i < scp->font_size; ++i) { font_buf[i] = (cursor[i] & 0xff00) >> 8; Modified: head/sys/dev/syscons/syscons.h ============================================================================== --- head/sys/dev/syscons/syscons.h Thu Apr 20 15:53:20 2017 (r317197) +++ head/sys/dev/syscons/syscons.h Thu Apr 20 16:34:09 2017 (r317198) @@ -68,11 +68,11 @@ #endif #ifndef SC_CURSOR_CHAR -#define SC_CURSOR_CHAR (0x07) +#define SC_CURSOR_CHAR 7 #endif #ifndef SC_MOUSE_CHAR -#define SC_MOUSE_CHAR (0xd0) +#define SC_MOUSE_CHAR 8 #endif #if SC_MOUSE_CHAR <= SC_CURSOR_CHAR && SC_CURSOR_CHAR < (SC_MOUSE_CHAR + 4)