From owner-dev-commits-src-branches@freebsd.org Sun May 23 08:23:05 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DB96642571; Sun, 23 May 2021 08:23:05 +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 4FntdP30p7z4SNw; Sun, 23 May 2021 08:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4C74B1441A; Sun, 23 May 2021 08:23:05 +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 14N8N5gV023622; Sun, 23 May 2021 08:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14N8N5Gc023621; Sun, 23 May 2021 08:23:05 GMT (envelope-from git) Date: Sun, 23 May 2021 08:23:05 GMT Message-Id: <202105230823.14N8N5Gc023621@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 3dc9f92a0d3d - stable/13 - loader: gfx_fb_drawrect should use GfxFbBltVideoFill MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3dc9f92a0d3dbe0d56201d8806cd9e93e4676cc4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 May 2021 08:23:05 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=3dc9f92a0d3dbe0d56201d8806cd9e93e4676cc4 commit 3dc9f92a0d3dbe0d56201d8806cd9e93e4676cc4 Author: Toomas Soome AuthorDate: 2021-05-11 18:05:12 +0000 Commit: Toomas Soome CommitDate: 2021-05-23 00:46:51 +0000 loader: gfx_fb_drawrect should use GfxFbBltVideoFill The gfx_fb_drawrect() is drawing rectangle by pixels, this can be very slow on some systems. Use Blt() video fill primitive instead. Testing done: Tested on mac mini 2012 where the issue was revealed (cherry picked from commit 5365af662c78d7bded3bf83c7271d6bff17229a9) Reviewed by: yuripv --- stand/common/gfx_fb.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 3eae0a3a859e..92af49913748 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -1357,16 +1357,12 @@ isqrt(int num) return (res); } -/* set pixel in framebuffer using gfx coordinates */ -void -gfx_fb_setpixel(uint32_t x, uint32_t y) +static uint32_t +gfx_fb_getcolor(void) { uint32_t c; const teken_attr_t *ap; - if (gfx_state.tg_fb_type == FB_TEXT) - return; - ap = teken_get_curattr(&gfx_state.tg_teken); if (ap->ta_format & TF_REVERSE) { c = ap->ta_bgcolor; @@ -1378,7 +1374,19 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) c |= TC_LIGHT; } - c = gfx_fb_color_map(c); + return (gfx_fb_color_map(c)); +} + +/* set pixel in framebuffer using gfx coordinates */ +void +gfx_fb_setpixel(uint32_t x, uint32_t y) +{ + uint32_t c; + + if (gfx_state.tg_fb_type == FB_TEXT) + return; + + c = gfx_fb_getcolor(); if (x >= gfx_state.tg_fb.fb_width || y >= gfx_state.tg_fb.fb_height) @@ -1389,25 +1397,26 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) /* * draw rectangle in framebuffer using gfx coordinates. - * The function is borrowed from vt_fb.c */ void gfx_fb_drawrect(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t fill) { - uint32_t x, y; + uint32_t c; if (gfx_state.tg_fb_type == FB_TEXT) return; - for (y = y1; y <= y2; y++) { - if (fill || (y == y1) || (y == y2)) { - for (x = x1; x <= x2; x++) - gfx_fb_setpixel(x, y); - } else { - gfx_fb_setpixel(x1, y); - gfx_fb_setpixel(x2, y); - } + c = gfx_fb_getcolor(); + + if (fill != 0) { + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, x2 - x1, + y2 - y1, 0); + } else { + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, x2 - x1, 1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y2, x2 - x1, 1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x1, y1, 1, y2 - y1, 0); + gfxfb_blt(&c, GfxFbBltVideoFill, 0, 0, x2, y1, 1, y2 - y1, 0); } }