display: confirm a resolution change, and size the console font to the screen

On the Ryzen 4600G desktop and the ASUS TUF A15, AMD's GOP "sets" the
smaller modes without leaving the panel's native timing and reports the
mode's own row length. Every check the loader made passed, and the screen
showed three or four squashed copies side by side (1920/640, 2560/640).
Nothing the firmware reports can tell such a mode from a real one.

So a mode change now asks "Keep this resolution?" in the new mode and keeps
it only on Enter within ten seconds. On a mode that does not really work the
question cannot be read, and the old mode comes back by itself.

And the reason to want a smaller mode was the text: the console font was a
fixed 16 px, unreadable on a 1440p monitor. It now scales to about 45 rows,
16 to 40 px per em, on whatever mode the firmware booted in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-24 23:11:22 +02:00
commit d2c70c9129
2 changed files with 50 additions and 8 deletions

View file

@ -473,10 +473,16 @@ gfx_font_init(void)
}
}
// 16 pixels per em. The bitmap it replaces is 16 tall, so the terminal keeps
// the number of rows it had and nothing that assumed a screenful has to
// change.
if (ttf_open(&consttf, data, len, 16) != 0) {
// The size follows the screen: about 45 rows whatever the resolution, and
// never under 16 pixels per em, the bitmap's height. A fixed 16 was right
// on 1024x768 and unreadable on a 1440p monitor -- and asking for a smaller
// mode to get bigger text is no answer, because firmware on real machines
// often "sets" a smaller mode by leaving the panel at its native size and
// misreporting the row length, which is the sheared, repeated screen.
int em = scanout.height / 45;
if (em < 16) em = 16;
if (em > 40) em = 40;
if (ttf_open(&consttf, data, len, em) != 0) {
// A bad file on the ESP must not cost the console its font. Nothing has
// been changed yet at this point, so the built-in one is still there to
// fall back to -- and it is worth saying, because a font that silently
@ -487,7 +493,7 @@ gfx_font_init(void)
"using the built-in one\n");
data = _binary_consfont_start;
len = (uint32)(_binary_consfont_end - _binary_consfont_start);
if (ttf_open(&consttf, data, len, 16) != 0)
if (ttf_open(&consttf, data, len, em) != 0)
return;
}