Page MenuHomeFreeBSD

loader: loader can pick too large font
ClosedPublic

Authored by tsoome on May 8 2025, 6:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 2, 10:17 AM
Unknown Object (File)
Thu, Jun 26, 2:47 AM
Unknown Object (File)
Jun 6 2025, 3:38 PM
Unknown Object (File)
May 23 2025, 12:23 AM
Unknown Object (File)
May 17 2025, 11:44 PM
Unknown Object (File)
May 14 2025, 8:04 PM
Unknown Object (File)
May 14 2025, 1:38 AM
Unknown Object (File)
May 14 2025, 1:38 AM

Details

Summary

While calculating font size based on EDID data, we can end up
selecting too large font and too small terminal. Add check to
prevent it.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tsoome requested review of this revision.May 8 2025, 6:35 PM

Need to get confirmation from hw owners tho.

What happen if the reported size is plainly wrong ?
Like on my system, at the loader phase my screen is 800x600, and after the kms driver is loaded it goes to higher dimension: 1080p, 1440p.
Does the smallest font will work in this case ? Or there will be no font selected ?

ziaee added a subscriber: ziaee.

I tested this on my machine (2560x1600) and nothing bad happened (default font is still 32x64 producing a perfect 80x25).

What happen if the reported size is plainly wrong ?
Like on my system, at the loader phase my screen is 800x600, and after the kms driver is loaded it goes to higher dimension: 1080p, 1440p.
Does the smallest font will work in this case ? Or there will be no font selected ?

in this case the reported size is still not wrong, it is different what you will get later, when the kernel is running and the KMS is starting up. And it is the case we can not really handle with loader. My supermicro does only use 800x600 with UEFI (it does list better modes, it does allow to switch to better mode with BIOS, but with UEFI it is limited to 800x600). So in such case we can not use larger font in loader as it will mess up the loader console and with small font the kernel console will be unreadable due to font being too small. As the current kernel does not have ability to "autoload" the best font, it has to be configured via rc.conf. We do have the code in loader and it can certainly be ported for kernel/KMS case too.

adrian added a subscriber: adrian.

This looks fine to me. Did you try it locally?

This revision is now accepted and ready to land.May 10 2025, 8:17 PM

This looks fine to me. Did you try it locally?

yes. also confirmed fix from bz:)

This revision was automatically updated to reflect the committed changes.
des added inline comments.
stand/common/gfx_fb.c
2085

what if it's too big in just one direction?

tsoome added inline comments.
stand/common/gfx_fb.c
2085

what if it's too big in just one direction?

yes, have bug there:) fortunately, with current fonts its not an issue, but need to fix it:)

stand/common/gfx_fb.c
2085

the font isn't the only variable; screen geometry matters too, and that's far more variable today than it used to be.