Page 1 of 1

Setting graphics mode to maximum resolution

Posted: Sat Apr 29, 2017 9:57 am
by obiwac
Hello all!

I currently passing my desired resolution (and bbp) to grub with the multiboot header flags. I can read the graphics pointer and draw graphics on the screen.
My question is, how do I ask grub to set the graphics mode to the maximum resolution of the monitor, at specifically 32 bbp, instead of passing it a resolution?

Thanks in advance!

Re: Setting graphics mode to maximum resolution

Posted: Sat Apr 29, 2017 10:05 am
by iansjack
Try the line:

GRUB_GFXMODE=auto

in your configuration file. Note that Grub can only set modes supported by VBE.

Re: Setting graphics mode to maximum resolution

Posted: Sat Apr 29, 2017 10:42 am
by Brendan
Hi,
iansjack wrote:Note that Grub can only set modes supported by VBE.
Note that just because VBE and the video card support a video mode it doesn't mean that the monitor itself supports that video mode. In practice, this means "set graphics mode to max. supported by VBE" is the same as "maximise the possibility that the user will see nothing".

You really want to use EDID to ensure that the video mode is supported by both the video card and the monitor. UEFI does this (or at least it's supposed to) so it shouldn't be a problem for "GRUB on UEFI"; but the BIOS doesn't (and as far as I know GRUB doesn't either) so it will be a disaster for "GRUB on BIOS".

Also note that what you really want is the monitor's native resolution, not the maximum resolution that the monitor can down-scale and make blurry.


Cheers,

Brendan

Re: Setting graphics mode to maximum resolution

Posted: Sat Apr 29, 2017 10:59 am
by obiwac
Ok thanks. I'll do a bit more research then.

Re: Setting graphics mode to maximum resolution

Posted: Sat Apr 29, 2017 11:17 am
by onlyonemac
obiwac wrote:Ok thanks. I'll do a bit more research then.
You'll want to start with figuring out how to set the graphics mode yourself. Then you'll need to find out how to get the maximum and preferred resolutions of the graphics card and monitor, and use this to choose a suitable resolution. Think also about how you're going to handle changing the resolution during operation (if at all) - the user might want to change the resolution without having to reboot the computer, such as when they connect another monitor or if your OS chooses the wrong resolution and they want to change it.

Re: Setting graphics mode to maximum resolution

Posted: Sat Apr 29, 2017 11:53 am
by eryjus
obiwac wrote:Hello all!

I currently passing my desired resolution (and bbp) to grub with the multiboot header flags. I can read the graphics pointer and draw graphics on the screen.
My question is, how do I ask grub to set the graphics mode to the maximum resolution of the monitor, at specifically 32 bbp, instead of passing it a resolution?

Thanks in advance!
I started down this path myself last week. Ultimately I chose to have my stage 3 loader support only 1024x768 while it is collecting info for the kernel and setting the CPU in native mode. The resolution is pretty ubiquitous still even if it letter boxed. As onlyonemac says, I made the choice to support the final resolution later in the OS driver.

Re: Setting graphics mode to maximum resolution

Posted: Sat Apr 29, 2017 12:00 pm
by Korona
Brendan wrote:You really want to use EDID to ensure that the video mode is supported by both the video card and the monitor. UEFI does this (or at least it's supposed to) so it shouldn't be a problem for "GRUB on UEFI"; but the BIOS doesn't (and as far as I know GRUB doesn't either) so it will be a disaster for "GRUB on BIOS".
GRUB reads EDID and sets the mode that is specified by the first detailed timing descriptor (in grub_video_edid_preferred_mode()).

Re: Setting graphics mode to maximum resolution

Posted: Sun Apr 30, 2017 6:47 am
by obiwac
onlyonemac wrote:
obiwac wrote:Ok thanks. I'll do a bit more research then.
You'll want to start with figuring out how to set the graphics mode yourself. Then you'll need to find out how to get the maximum and preferred resolutions of the graphics card and monitor, and use this to choose a suitable resolution. Think also about how you're going to handle changing the resolution during operation (if at all) - the user might want to change the resolution without having to reboot the computer, such as when they connect another monitor or if your OS chooses the wrong resolution and they want to change it.
I think I won't try to go with something too complicated. I think that for now I'ts ok if the computer has to reboot. I timed it once, and it was like 15 seconds or something. Thanks!