From owner-svn-src-all@freebsd.org Sun Oct 6 18:38:59 2019 Return-Path: Delivered-To: svn-src-all@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 406CD130EA2; Sun, 6 Oct 2019 18:38:59 +0000 (UTC) (envelope-from tsoome@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46mXSg0vkdz3C5S; Sun, 6 Oct 2019 18:38:59 +0000 (UTC) (envelope-from tsoome@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 024EF24D1; Sun, 6 Oct 2019 18:38:59 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x96Icwgp053917; Sun, 6 Oct 2019 18:38:58 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x96Icw58053916; Sun, 6 Oct 2019 18:38:58 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910061838.x96Icw58053916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 6 Oct 2019 18:38:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353146 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 353146 X-SVN-Commit-Repository: base 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.29 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: Sun, 06 Oct 2019 18:38:59 -0000 Author: tsoome Date: Sun Oct 6 18:38:58 2019 New Revision: 353146 URL: https://svnweb.freebsd.org/changeset/base/353146 Log: loader.efi: for text mode, use STM to scroll the whole screen Since local UEFI console is implemented on top of framebuffer, we need to avoid redrawing the whole screen ourselves, but let Simple Text Mode to do the scroll for us. Modified: head/stand/efi/libefi/efi_console.c Modified: head/stand/efi/libefi/efi_console.c ============================================================================== --- head/stand/efi/libefi/efi_console.c Sun Oct 6 08:47:10 2019 (r353145) +++ head/stand/efi/libefi/efi_console.c Sun Oct 6 18:38:58 2019 (r353146) @@ -136,7 +136,7 @@ efi_text_cursor(void *s __unused, const teken_pos_t *p } static void -efi_text_printchar(const teken_pos_t *p) +efi_text_printchar(const teken_pos_t *p, bool autoscroll) { UINTN a, attr; struct text_pixel *px; @@ -164,7 +164,8 @@ efi_text_printchar(const teken_pos_t *p) conout->SetCursorPosition(conout, p->tp_col, p->tp_row); /* to prvent autoscroll, skip print of lower right char */ - if (p->tp_row == tp.tp_row - 1 && + if (!autoscroll && + p->tp_row == tp.tp_row - 1 && p->tp_col == tp.tp_col - 1) return; @@ -183,7 +184,7 @@ efi_text_putchar(void *s __unused, const teken_pos_t * idx = p->tp_col + p->tp_row * tp.tp_col; buffer[idx].c = c; buffer[idx].a = *a; - efi_text_printchar(p); + efi_text_printchar(p, false); } static void @@ -226,6 +227,7 @@ efi_text_copy(void *ptr __unused, const teken_rect_t * int srow, drow; int nrow, ncol, x, y; /* Has to be signed - >= 0 comparison */ teken_pos_t d, s; + bool scroll = false; /* * Copying is a little tricky. We must make sure we do it in @@ -235,6 +237,13 @@ efi_text_copy(void *ptr __unused, const teken_rect_t * nrow = r->tr_end.tp_row - r->tr_begin.tp_row; ncol = r->tr_end.tp_col - r->tr_begin.tp_col; + /* + * Check if we do copy whole screen. + */ + if (p->tp_row == 0 && p->tp_col == 0 && + nrow == tp.tp_row - 2 && ncol == tp.tp_col - 2) + scroll = true; + conout->EnableCursor(conout, FALSE); if (p->tp_row < r->tr_begin.tp_row) { /* Copy from bottom to top. */ @@ -252,7 +261,17 @@ efi_text_copy(void *ptr __unused, const teken_rect_t * &buffer[s.tp_col + srow])) { buffer[d.tp_col + drow] = buffer[s.tp_col + srow]; - efi_text_printchar(&d); + if (!scroll) + efi_text_printchar(&d, false); + } else if (scroll) { + /* + * Draw last char and trigger + * scroll. + */ + if (y == nrow - 1 && + x == ncol - 1) { + efi_text_printchar(&d, true); + } } } } @@ -274,7 +293,7 @@ efi_text_copy(void *ptr __unused, const teken_rect_t * &buffer[s.tp_col + srow])) { buffer[d.tp_col + drow] = buffer[s.tp_col + srow]; - efi_text_printchar(&d); + efi_text_printchar(&d, false); } } } @@ -294,7 +313,7 @@ efi_text_copy(void *ptr __unused, const teken_rect_t * &buffer[s.tp_col + srow])) { buffer[d.tp_col + drow] = buffer[s.tp_col + srow]; - efi_text_printchar(&d); + efi_text_printchar(&d, false); } } }