# /boot/loader.conf ignores efifb mode setting



## Holger (Jun 26, 2020)

Hi,

I am running FreeBSD 12.1-RELEASE. Since my Intel graphics card (UHD 630) does not seem to be currently supported, I am happy to use efifb and the scfb Xorg-driver. All fine.

The only thing that bothers me is the default resolution (800x600) that is selected by the VT driver (or bootloader, I don't know).

The following _works _and mitigates the problem:

When starting up, get into the bootloader prompt by pressing Escape.
Select a video mode by doing `mode <number>`, for example `mode 3` for 1920x1080, which is just right.
Typing `boot` to boot the system, using exactly that mode.
Now I would like to make this mode selection (e.g. `mode 3`) permanent.

I tried adding `mode 3` to /boot/loader.conf and /boot/loader.conf.local, but it did not have any effect. The bootloader seems to ignore this entry!

How can I change permanently the efifb video mode resolution?

Thanks!

Update: Also tried putting `mode 3` in /boot/loader.rc and /boot/loader.rc.local as proposed here:








						Solved - The vt(4) resolution is always 640x480
					

The laptop is ThinkPad X250 (Broadwell GPU) and the LCD resolution is 1366x768. I have set booting from UEFI only and disabled CSM. The whole disk is encrypted by GELI except /boot/.  On 10.2-STABLE, the LCD resolution can be recognized rightly without any configure in /boot/loader.conf. The...




					forums.freebsd.org
				




But didn't work. Mode-entry still seems to be ignored.


----------



## T-Daemon (Jun 27, 2020)

Holger said:


> I am happy to use efifb ...
> ...
> Select a video mode by doing  mode <number>, for example  mode 3 for 1920x1080, which is just right.
> ...
> How can I change permanently the efifb video mode resolution?



Set in /boot/loader.conf

```
efi_max_resolution="1920x1080"
```

man loader.conf(5)


----------



## T-Daemon (Jun 27, 2020)

Holger said:


> I am running FreeBSD 12.1-RELEASE. Since my Intel graphics card (UHD 630) does not seem to be currently supported, ...


Have you tried graphics/drm-fbsd12.0-kmod ? There is an older forum Thread 60159, where a user is claiming having it working (with 12-CURRENT at the time). graphics/drm-next-kmod has been moved to graphics/drm-fbsd12.0-kmod.


----------



## Mjölnir (Jun 27, 2020)

It would be nice if you figure out how to have the boot menu on a_ efi_max_resolution="480p"_ but then make the system switch to full resolution.  The boot menu in full resolution on HiRes screens can be very small and unreadable.  Should you manage to do that, please post here.


----------



## T-Daemon (Jun 27, 2020)

mjollnir said:


> The boot menu in full resolution on HiRes screens can be very small and unreadable.


Like in this Thread 68435 ?

In this Asrock forum enabling/disabling the CSM (Compatility Support Module), and here on tom's hardware, has an effect on the screen resolution. Also check the UEFI if it has any dedicated screen resolution settings. Those are not widely spread, most likely absent on your system, but it doesn't hurt to check.

Here are other UEFI settings to try for setting the screen resolution.


----------



## Holger (Jun 29, 2020)

T-Daemon said:


> Set in /boot/loader.conf
> 
> ```
> efi_max_resolution="1920x1080"
> ...


Tried it, but didn't work. Also tried 
	
	



```
efi_max_resolution="1080p"
```
, but didn't work either.

Btw., man loader.conf(5) says this specifies the _maximum_ desired resolution, but I want to specify the _minimum _resolution.


----------



## Holger (Jun 29, 2020)

T-Daemon said:


> Have you tried graphics/drm-fbsd12.0-kmod ? There is an older forum Thread 60159, where a user is claiming having it working (with 12-CURRENT at the time). graphics/drm-next-kmod has been moved to graphics/drm-fbsd12.0-kmod.



Thanks for the suggestion. Tried it, but no effect: module gets loaded but no mode change, no "drm" messages on boot, nothing.

In the thread you are referring to the GPU is a Intel HD Graphics 630. Mine is UHD Graphics 630. Not sure how big the difference is, though.


----------



## SirDice (Jun 29, 2020)

What  does `sysctl machdep.bootmethod` output?


----------



## Holger (Jun 29, 2020)

SirDice said:


> What  does `sysctl machdep.bootmethod` output?



Output is:

```
machdep.bootmethod: UEFI
```


----------



## Mjölnir (Jun 29, 2020)

This looks strange.  I'm booting UEFI method, with _efi_max_resolution="480p"_ in /boot/loader.conf the boot menu is as large I want it to be, and the system switches to maximum high resolution later by default (hw.vga.textmode=0 by default).

You can try _kern.vt.fb.default_mode_ or _kern.vt.fb.modes.connector_name_ in loader.conf(5).  Grep the connector names from dmesg(8).  RTFM vt(4).


----------



## Holger (Jun 29, 2020)

mjollnir said:


> ...
> You can try _kern.vt.fb.default_mode_ or _kern.vt.fb.modes.connector_name_ in loader.conf(5).  Grep the connector names from dmesg(8).  RTFM vt(4).



Tried it. No effect.

As I mentioned in the original post, setting `mode 3` manually in the bootloader prompt works. It's just that the bootloader seemingly ignores the contents of /boot/loader.rc.local. Could it be that the file is not accessible during boot time (I am running ZFS if that should matter)?


----------



## Mjölnir (Jun 29, 2020)

AFAIK the chain of console framebuffer mode control is UEFI->efiboot->loader (boot menu, kernel messages)->vt takes over (hw.vga.textmode)->init (rc.conf:kld_list="/boot/modules/i915kms.ko").
The correct names of the relevant files are /boot/loader.conf and /boot/loader.conf.local.


----------



## T-Daemon (Jun 29, 2020)

Does the command `gop list` at the loader prompt return a list?



Holger said:


> As I mentioned in the original post, setting  mode 3 manually in the bootloader prompt works. It's just that the bootloader seemingly ignores the contents of /boot/loader.rc.local.


Try: /boot/loader.conf

```
exec="mode 3"
```


----------



## T-Daemon (Jun 29, 2020)

Holger said:


> In the thread you are referring to the GPU is a Intel HD Graphics 630. Mine is UHD Graphics 630. Not sure how big the difference is, though.


My bad. I have misread the model. Sorry.


----------



## Holger (Jun 29, 2020)

T-Daemon said:


> Try: /boot/loader.conf
> 
> ```
> exec="mode 3"
> ```



That worked! Thank you  Should mark this as the official solution somehow ...


----------



## free-and-bsd (Apr 19, 2021)

It seems to work now, as of 13.0-RELEASE, in the form of `exec="gop set <MODE>"`. Just `exec="mode <MODE>"` didn't work for me.


----------



## sko (Jun 15, 2021)

I'm currently stuck with the same problem on a new Intel rocket lake desktop system.

The GPU isn't yet supported by i915kms (UHD 750) and using vt and scfb for Xorg just ignores any resolution I'm trying to set.
The only thing that works is hitting '3' at the loader, forcing the resolution to the native one (2560x1440) via 'set gop 0' and then 'boot'.

I've already tried in /boot/loader.conf:
`exec="gop set 0"`
`exec="mode 0"`
`kern.vt.fb.default_mode="2560x1440"`
`efi_max_resolution="2560x1440"`

All of them seem to be completely ignored, as vt _always_ boots with 1024x786
Xorg afterwards always picks up the vt resolution. When trying to set a higher resolution via xorg.conf.d/scfb.conf X fails with "no screens found" - so I am stuck with 1024x786 in Xorg unless I've manually forced the mode before boot.

The system is booted in EFI mode:

```
# sysctl machdep.bootmethod
machdep.bootmethod: UEFI
```

This behaviour is consistent on 12.2-RELEASE and 13.0-RELEASE, with the exception that the loader menu with 13.0-RELEASE is completely botched (i.e. instead of lines there are various symbols drawn).


----------



## Emrion (Jun 15, 2021)

sko said:


> 13.0-RELEASE is completely botched (i.e. instead of lines there are various symbols drawn).


This is because you didn't update the efi loader. You'd better to update it.

There is someting to set the boot resolution, at least for the 13.0-RELEASE, but I don't have any of my machines on the hand. I will tell you tonight if someone doesn't answer in the meantime.


----------



## Emrion (Jun 15, 2021)

It was simply `efi_max_resolution`. Note the typo in your command.
It should work even with an old efi loader, I think.


----------

