Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Feb 2021 11:47:26 GMT
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a26f73585831 - main - loader: do not autoselect smaller font than 8x16 with high res display
Message-ID:  <202102091147.119BlQYR061281@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tsoome:

URL: https://cgit.FreeBSD.org/src/commit/?id=a26f7358583174f2fe0df3e979f7b8b02069278c

commit a26f7358583174f2fe0df3e979f7b8b02069278c
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2021-02-08 22:34:47 +0000
Commit:     Toomas Soome <tsoome@FreeBSD.org>
CommitDate: 2021-02-09 11:46:58 +0000

    loader: do not autoselect smaller font than 8x16 with high res display
    
    The VT screen buffer size is calculated based on our default
    built in (8x16) font.
    
    With high-resolution display, we want to use at least 8x16 font,
    or we will have large unused areas on screen.
    
    MFC after: 1 week
---
 stand/common/gfx_fb.c | 12 +++++++++---
 stand/common/gfx_fb.h | 12 ++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c
index 2aed8775a540..02a0a3d2be22 100644
--- a/stand/common/gfx_fb.c
+++ b/stand/common/gfx_fb.c
@@ -1894,12 +1894,18 @@ set_font(teken_unit_t *rows, teken_unit_t *cols, teken_unit_t h, teken_unit_t w)
 	}
 
 	/*
-	 * Find best font for these dimensions, or use default
+	 * Find best font for these dimensions, or use default.
+	 * If height >= VT_FB_MAX_HEIGHT and width >= VT_FB_MAX_WIDTH,
+	 * do not use smaller font than our DEFAULT_FONT_DATA.
 	 */
 	STAILQ_FOREACH(fl, &fonts, font_next) {
 		font = fl->font_data;
-		if ((*rows * font->vfbd_height <= height) &&
-		    (*cols * font->vfbd_width <= width)) {
+		if ((*rows * font->vfbd_height <= height &&
+		    *cols * font->vfbd_width <= width) ||
+		    (height >= VT_FB_MAX_HEIGHT &&
+		    width >= VT_FB_MAX_WIDTH &&
+		    font->vfbd_height == DEFAULT_FONT_DATA.vfbd_height &&
+		    font->vfbd_width == DEFAULT_FONT_DATA.vfbd_width)) {
 			if (font->vfbd_font == NULL ||
 			    fl->font_flags == FONT_RELOAD) {
 				if (fl->font_load != NULL &&
diff --git a/stand/common/gfx_fb.h b/stand/common/gfx_fb.h
index d046865604ea..04076a2c6d38 100644
--- a/stand/common/gfx_fb.h
+++ b/stand/common/gfx_fb.h
@@ -164,6 +164,18 @@ struct vesa_flat_panel_info {
 #define	NCMAP	256
 extern uint32_t cmap[NCMAP];
 
+/*
+ * VT_FB_MAX_WIDTH and VT_FB_MAX_HEIGHT are dimensions from where
+ * we will not auto select smaller font than 8x16.
+ * See also sys/dev/vt/vt.h
+ */
+#ifndef VT_FB_MAX_WIDTH
+#define	VT_FB_MAX_WIDTH		4096
+#endif
+#ifndef VT_FB_MAX_HEIGHT
+#define	VT_FB_MAX_HEIGHT	2400
+#endif
+
 enum FB_TYPE {
 	FB_TEXT = -1,
 	FB_GOP,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102091147.119BlQYR061281>