OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 10:31 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Setting graphics mode to maximum resolution
PostPosted: Sat Apr 29, 2017 9:57 am 
Offline
Member
Member
User avatar

Joined: Fri Jan 27, 2017 12:15 pm
Posts: 149
Location: Belgium
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!

_________________
AQUA OS: https://obiwac.wordpress.com/aqua-os/


Top
 Profile  
 
 Post subject: Re: Setting graphics mode to maximum resolution
PostPosted: Sat Apr 29, 2017 10:05 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
Try the line:

GRUB_GFXMODE=auto

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


Top
 Profile  
 
 Post subject: Re: Setting graphics mode to maximum resolution
PostPosted: Sat Apr 29, 2017 10:42 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
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

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Setting graphics mode to maximum resolution
PostPosted: Sat Apr 29, 2017 10:59 am 
Offline
Member
Member
User avatar

Joined: Fri Jan 27, 2017 12:15 pm
Posts: 149
Location: Belgium
Ok thanks. I'll do a bit more research then.

_________________
AQUA OS: https://obiwac.wordpress.com/aqua-os/


Top
 Profile  
 
 Post subject: Re: Setting graphics mode to maximum resolution
PostPosted: Sat Apr 29, 2017 11:17 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
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.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Setting graphics mode to maximum resolution
PostPosted: Sat Apr 29, 2017 11:53 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 21, 2011 9:47 pm
Posts: 286
Location: Tustin, CA USA
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.

_________________
Adam

The name is fitting: Century Hobby OS -- At this rate, it's gonna take me that long!
Read about my mistakes and missteps with this iteration: Journal

"Sometimes things just don't make sense until you figure them out." -- Phil Stahlheber


Top
 Profile  
 
 Post subject: Re: Setting graphics mode to maximum resolution
PostPosted: Sat Apr 29, 2017 12:00 pm 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 999
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()).

_________________
managarm: Microkernel-based OS capable of running a Wayland desktop (Discord: https://discord.gg/7WB6Ur3). My OS-dev projects: [mlibc: Portable C library for managarm, qword, Linux, Sigma, ...] [LAI: AML interpreter] [xbstrap: Build system for OS distributions].


Top
 Profile  
 
 Post subject: Re: Setting graphics mode to maximum resolution
PostPosted: Sun Apr 30, 2017 6:47 am 
Offline
Member
Member
User avatar

Joined: Fri Jan 27, 2017 12:15 pm
Posts: 149
Location: Belgium
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!

_________________
AQUA OS: https://obiwac.wordpress.com/aqua-os/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 109 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group