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
This commit is contained in:
Toomas Soome 2021-02-09 00:34:47 +02:00
parent 96bef2053a
commit a26f735858
2 changed files with 21 additions and 3 deletions

View File

@ -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) { STAILQ_FOREACH(fl, &fonts, font_next) {
font = fl->font_data; font = fl->font_data;
if ((*rows * font->vfbd_height <= height) && if ((*rows * font->vfbd_height <= height &&
(*cols * font->vfbd_width <= width)) { *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 || if (font->vfbd_font == NULL ||
fl->font_flags == FONT_RELOAD) { fl->font_flags == FONT_RELOAD) {
if (fl->font_load != NULL && if (fl->font_load != NULL &&

View File

@ -164,6 +164,18 @@ struct vesa_flat_panel_info {
#define NCMAP 256 #define NCMAP 256
extern uint32_t cmap[NCMAP]; 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 { enum FB_TYPE {
FB_TEXT = -1, FB_TEXT = -1,
FB_GOP, FB_GOP,