From nobody Thu Mar 03 00:08:57 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 22FD219FFF42; Thu, 3 Mar 2022 00:08:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4K8BDB0VPCz4YxX; Thu, 3 Mar 2022 00:08:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646266138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BLtEAkZ47aWS5dHtagc2psUgWs80iR4/Rm8qABpM34M=; b=J0uo+lVfLD95HlHMpGtB84kyPRJnxvbiAM0C5WS3K38mPVhpfNLRJiNMwqzGs+7KPVfbfa tgbpKCghCpWaYiUIzSY/GgEMpNkNEBrvpTp0TR88vTDQZW8zFk4FgXpm6KRYCwgYwWHF71 78cjLvh5H/AUTkc3Yyyv1B5wpYBL6I/TCeEQHB5Zi+qnb/+F5mkTzoDPlex2GeJ4E+sWfu sbGZTcNhUJeY7qh8iUz3mBufM0yl/+jlgOFMrPesiSLZu+CQ0bms7os37ZFzrHZopB/tsy J5q8ff8EBJMeEsINyh8m+3jzlPUPkTUp4mTauFYd60PqAWrBg4T7M+iewMSjgQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD743575A; Thu, 3 Mar 2022 00:08:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22308vlK042730; Thu, 3 Mar 2022 00:08:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22308vUx042729; Thu, 3 Mar 2022 00:08:57 GMT (envelope-from git) Date: Thu, 3 Mar 2022 00:08:57 GMT Message-Id: <202203030008.22308vUx042729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: f266082f113a - main - vt_vga: fix colour in pixel blocks with more than 4 colours List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f266082f113a6a110c28034c64693c2cc216fd9d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646266138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BLtEAkZ47aWS5dHtagc2psUgWs80iR4/Rm8qABpM34M=; b=IKoAO1Jyi0qgrU2hHPV5h4QN4MWJ100g6bfP93gyLIu3RIEAXjGNxP+lNSKbAl1VG0HiHQ FL8PfQ5h6Eu+s22/j+odG8on6a3GkdAex5yn2XEvSp+Ht6y74lLd9/yPMbx4WpIRbVWUi1 WW9lVrr9QMS/5c3Xw3VnpjTFKjl1LgXduZ3/c7KMHhJrfTxmstYPK4wyap3le5Wwuj3cWR FXeczBHx+yi8ZFTcqWe89+q24cojEeRNJMco0vcyL4wTg51RmlsRkAnwYb+6KOxN4HqGip 9A/JdD1nzSPqVVyDBlNWxuv4HZUUXMaMo7aZyIzT+Q6cNyj3WZ4Umco9evDMuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646266138; a=rsa-sha256; cv=none; b=Qt+lp4A3e6AZsB7GP8oFKn8ouwfhzpEHGD2LO/Hc2wzHIekxAXM6i4kKSZ9yt1yxcQP0Dw fMQzhSgggkx0uO4un50b8WXHfilzRg+1yKglbO1+aYbcQSI2HEbUXG40ZssqKrFRs0LAP/ CUH6DNu3CkAeoogYnwG20A0hsGmYXBnjGo0C4frb6LT9dYGCySLtjy8E4bWD0QSvga3s7A FoB38xix+uhpQycAWY/bilfdy/fsx+H8GyDHI4LzgDv92RZo3R2PUU6HbUnvbSOj+JxLWb 8YMx0215+y6wDvI/Aeer3fd8t4XLdzalNYBA4orU1tkcF5O9G8H80WJZpfSItg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f266082f113a6a110c28034c64693c2cc216fd9d commit f266082f113a6a110c28034c64693c2cc216fd9d Author: Ed Maste AuthorDate: 2022-03-02 16:40:00 +0000 Commit: Ed Maste CommitDate: 2022-03-03 00:07:20 +0000 vt_vga: fix colour in pixel blocks with more than 4 colours VGA hardware provides many different graphics and data access modes, each with different capabilities and limitations. VGA vt(4) graphics mode operates on blocks of pixels at a time. When a given pixel block contains only two colours the vt_vga driver uses write mode 3. When the block contains more than two colours it uses write mode 0. This is done because two-colour write mode 3 is much more efficient. In practice write mode 3 is used most of the time, as there is often a single foreground colour and single background colour across the entire console. One common exception requiring the use of mode 0 is when the mouse cursor is drawn over a background other than black, as we need black and white for the cursor in addition to the background colour. VGA's default 16-colour palette provides the same set of colours as the system console, but in a different order. Previously we configured a non-default VGA palette that had the same colours at the same indexes. However, this caused anything drawn before the kernel started (drawn by the loader, for instance) to change colours once the kernel configured the new, non-default palette. In 5e251aec8636 we switched to leaving the default VGA palette in place, translating console colour indexes to VGA colour indexes as necessary. This translation was missed for the write mode 0 case for pixel blocks with more than two colours. PR: 261751 Reviewed by: adrian MFC after: 1 week Fixes: 5e251aec8636 ("vt(4): Use default VGA palette") Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34412 --- sys/dev/vt/hw/vga/vt_vga.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/vt/hw/vga/vt_vga.c b/sys/dev/vt/hw/vga/vt_vga.c index c0d001d09659..bac8f3eb7b97 100644 --- a/sys/dev/vt/hw/vga/vt_vga.c +++ b/sys/dev/vt/hw/vga/vt_vga.c @@ -582,7 +582,8 @@ vga_bitblt_pixels_block_ncolors(struct vt_device *vd, const uint8_t *masks, /* The pixel "j" uses color "color". */ for (plane = 0; plane < 4; ++plane) planes[i * 4 + plane] |= - ((color >> plane) & 0x1) << (7 - j); + ((cons_to_vga_colors[color] >> + plane) & 0x1) << (7 - j); } } }