From owner-dev-commits-src-branches@freebsd.org Sat Aug 28 05:44:36 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 EB95B66E719; Sat, 28 Aug 2021 05:44:36 +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 4GxQWm5GbJz3nYT; Sat, 28 Aug 2021 05:44:36 +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 7E1CC113ED; Sat, 28 Aug 2021 05:44:36 +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 17S5iaTT023299; Sat, 28 Aug 2021 05:44:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17S5iadk023298; Sat, 28 Aug 2021 05:44:36 GMT (envelope-from git) Date: Sat, 28 Aug 2021 05:44:36 GMT Message-Id: <202108280544.17S5iadk023298@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: d54fdcd59e23 - stable/13 - loader: FB console does leave garbage on screen while scrolling 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: d54fdcd59e23defaf5f6b458701c360c9b2a5dd8 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: Sat, 28 Aug 2021 05:44:37 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=d54fdcd59e23defaf5f6b458701c360c9b2a5dd8 commit d54fdcd59e23defaf5f6b458701c360c9b2a5dd8 Author: Toomas Soome AuthorDate: 2021-08-21 11:25:36 +0000 Commit: Toomas Soome CommitDate: 2021-08-28 05:37:03 +0000 loader: FB console does leave garbage on screen while scrolling Scrolling screen will leave "trail" of chars from first column. Apparently caused by cursor location mismanagement. Make sure we do not [attempt to] set cursor out of the screen. (cherry picked from commit e5a50b03297fa09652b3cf319bc6e863392554e0) --- stand/common/gfx_fb.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 92af49913748..71c162a77f27 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -976,20 +976,26 @@ gfx_fb_fill(void *arg, const teken_rect_t *r, teken_char_t c, } static void -gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) +gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *pos, bool on) { unsigned x, y, width, height; const uint8_t *glyph; + teken_pos_t p; int idx; - idx = p->tp_col + p->tp_row * state->tg_tp.tp_col; + p = *pos; + if (p.tp_col >= state->tg_tp.tp_col) + p.tp_col = state->tg_tp.tp_col - 1; + if (p.tp_row >= state->tg_tp.tp_row) + p.tp_row = state->tg_tp.tp_row - 1; + idx = p.tp_col + p.tp_row * state->tg_tp.tp_col; if (idx >= state->tg_tp.tp_col * state->tg_tp.tp_row) return; width = state->tg_font.vf_width; height = state->tg_font.vf_height; - x = state->tg_origin.tp_col + p->tp_col * width; - y = state->tg_origin.tp_row + p->tp_row * height; + x = state->tg_origin.tp_col + p.tp_col * width; + y = state->tg_origin.tp_row + p.tp_row * height; /* * Save original display content to preserve image data. @@ -1017,7 +1023,7 @@ gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) if (state->tg_cursor_image != NULL && gfxfb_blt(state->tg_cursor_image, GfxFbBltBufferToVideo, 0, 0, x, y, width, height, 0) == 0) { - state->tg_cursor = *p; + state->tg_cursor = p; return; } } @@ -1025,9 +1031,9 @@ gfx_fb_cursor_draw(teken_gfx_t *state, const teken_pos_t *p, bool on) glyph = font_lookup(&state->tg_font, screen_buffer[idx].c, &screen_buffer[idx].a); gfx_bitblt_bitmap(state, glyph, &screen_buffer[idx].a, 0xff, on); - gfx_fb_printchar(state, p); + gfx_fb_printchar(state, &p); - state->tg_cursor = *p; + state->tg_cursor = p; } void