From owner-svn-src-all@freebsd.org Wed Apr 19 18:35:35 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 C9DD0D44E85; Wed, 19 Apr 2017 18:35:35 +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 A4FF31E3A; Wed, 19 Apr 2017 18:35:35 +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 v3JIZY5W040823; Wed, 19 Apr 2017 18:35:34 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3JIZYk2040822; Wed, 19 Apr 2017 18:35:34 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704191835.v3JIZYk2040822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Wed, 19 Apr 2017 18:35:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317157 - 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: Wed, 19 Apr 2017 18:35:35 -0000 Author: bde Date: Wed Apr 19 18:35:34 2017 New Revision: 317157 URL: https://svnweb.freebsd.org/changeset/base/317157 Log: Fix missing support for drawing the mouse cursor in depth 24 of direct mode. Use the general DRAWPIXEL() macro with its bigger case statement (twice) instead of our big case statement (once). DRAWPIXEL() is more complicated since it is not missing support for depth 24 or complications for colors in depth 16 (we currently hard-code black and white so the complications for colors are not needed). DRAWPIXEL() also does the bpp calculation in the inner loop. Compilers optimize DRAWPIXEL() well enough, and the main text drawing method always depended on this. In direct mode, mouse cursor drawing is now similar to normal text drawing except it draws in 2 hard-coded colors instead of 1 variable color. This also fixes a nested hard-coding of colors. DRAWPIXEL() uses the palette in all cases, but the direct code didn't use the palette for its hard-coded black. This only had an effect in depth 8, since changing the palette is not supported in other depths. Modified: head/sys/dev/syscons/scvgarndr.c Modified: head/sys/dev/syscons/scvgarndr.c ============================================================================== --- head/sys/dev/syscons/scvgarndr.c Wed Apr 19 18:11:08 2017 (r317156) +++ head/sys/dev/syscons/scvgarndr.c Wed Apr 19 18:35:34 2017 (r317157) @@ -1127,10 +1127,6 @@ vga_pxlmouse_direct(scr_stat *scp, int x int line_width, pixel_size; int xend, yend; int i, j; - uint32_t *u32; - uint16_t *u16; - uint8_t *u8; - int bpp; mdp = (scp->font_size < 14) ? &mouse9x13 : &mouse10x16; @@ -1144,11 +1140,6 @@ vga_pxlmouse_direct(scr_stat *scp, int x yend <= (scp->yoff + scp->ysize) * scp->font_size) return; - bpp = scp->sc->adp->va_info.vi_depth; - - if ((bpp == 16) && (scp->sc->adp->va_info.vi_pixel_fsizes[1] == 5)) - bpp = 15; - line_width = scp->sc->adp->va_line_width; pixel_size = scp->sc->adp->va_info.vi_pixel_size; @@ -1165,43 +1156,12 @@ vga_pxlmouse_direct(scr_stat *scp, int x do_on: p = scp->sc->adp->va_window + y * line_width + x * pixel_size; - - for (i = 0; i < (yend - y); i++) { - for (j = (xend - x - 1); j >= 0; j--) { - switch (bpp) { - case 32: - u32 = (uint32_t*)(p + j * pixel_size); - if (mdp->md_interior[i] & (1 << (15 - j))) - writel(u32, vga_palette32[15]); - else if (mdp->md_border[i] & (1 << (15 - j))) - writel(u32, 0); - break; - case 16: - u16 = (uint16_t*)(p + j * pixel_size); - if (mdp->md_interior[i] & (1 << (15 - j))) - writew(u16, vga_palette16[15]); - else if (mdp->md_border[i] & (1 << (15 - j))) - writew(u16, 0); - break; - case 15: - u16 = (uint16_t*)(p + j * pixel_size); - if (mdp->md_interior[i] & (1 << (15 - j))) - writew(u16, vga_palette15[15]); - else if (mdp->md_border[i] & (1 << (15 - j))) - writew(u16, 0); - break; - case 8: - u8 = (uint8_t*)(p + j * pixel_size); - if (mdp->md_interior[i] & (1 << (15 - j))) - writeb(u8, 15); - else if (mdp->md_border[i] & (1 << (15 - j))) - writeb(u8, 0); - break; - } - } - - p += line_width; - } + for (i = 0; i < yend - y; i++, p += line_width) + for (j = xend - x - 1; j >= 0; j--) + if (mdp->md_interior[i] & (1 << (15 - j))) + DRAW_PIXEL(scp, p + j * pixel_size, 15); + else if (mdp->md_border[i] & (1 << (15 - j))) + DRAW_PIXEL(scp, p + j * pixel_size, 0); } static void