Cannot set video mode on real hardware
Cannot set video mode on real hardware
I just recently finished tasking in my OS and decided to make a whole rewrite to fix some mistakes. Along the way, I also decided to make it bootable on real hardware. The code got stuck on setting video mode. First I thought the problem was with my set video mode function but it wasn't that. The problem is that my computer doesn't seem to support 1920x1080x32 resolution. The video list ends on 0x11Bh which is 1280x1024x24. My monitor and graphics card both support 1920x1080 and it also works on QEMU. The code also fails on Virtual Box.
Also, note that my computer doesn't have legacy BIOS, it has UEFI and I am running the OS with CSM. I thought the problem may be with that.
I can give you any information that you may need, I didn't post code since it seems to be irrelevant.
TL;DR:
I cannot set video mode because the video mode list on real hardware doesn't include my desired resolution 1920x1080x32 although my hardware should support it. I don't have legacy BIOS, I am running OS with UEFI and CSM.
Also, note that my computer doesn't have legacy BIOS, it has UEFI and I am running the OS with CSM. I thought the problem may be with that.
I can give you any information that you may need, I didn't post code since it seems to be irrelevant.
TL;DR:
I cannot set video mode because the video mode list on real hardware doesn't include my desired resolution 1920x1080x32 although my hardware should support it. I don't have legacy BIOS, I am running OS with UEFI and CSM.
Re: Cannot set video mode on real hardware
VBE often doesn't support modern resolutions. Try GOP (if your video card supports it).
Re: Cannot set video mode on real hardware
Yes but QEMU seems to support it very wellpvc wrote:VBE often doesn't support modern resolutions. Try GOP (if your video card supports it).
Edit: Is there any way I can make my VBE2 support video mdoes I want.
Last edited by Danyy on Fri May 21, 2021 8:58 am, edited 1 time in total.
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Cannot set video mode on real hardware
QEMU is nicer than hardware in several ways.
Re: Cannot set video mode on real hardware
Is there any way I could make real hardware detect the video modes I wantOctocontrabass wrote:QEMU is nicer than hardware in several ways.
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Cannot set video mode on real hardware
Yes: write a driver for the video card.
There's no way to make the firmware give you additional modes.
There's no way to make the firmware give you additional modes.
Re: Cannot set video mode on real hardware
so it is impossible lol since I cannot write a driver for every video cardOctocontrabass wrote:Yes: write a driver for the video card.
There's no way to make the firmware give you additional modes.
Re: Cannot set video mode on real hardware
No, but you can start with a driver for your video card, and then add every card you come across as required. Given that your OS is unlikely to be used outside of you personally, this is probably the way to go. Add a VESA/GOP fallback for people who want to try it out, and make documentation available on how to add video drivers, and that is probably going to be as it gets. Everything more would require vendor support, which you are unlikely to get until you even reach the lofty heights Linux has climbed to (<10% market share). Which is probably still beyond even your wildest dreams.Danyy wrote:so it is impossible lol since I cannot write a driver for every video card
Carpe diem!
Re: Cannot set video mode on real hardware
IMO, targeting Intel integrated graphics would be a good point to start for several reasons.
- a lot of machines (from virtually any segment) have it
- documentation is decent(-ish)
- differences between models are only minimal (for 2D graphics)
- potential test machines are extremely cheap (sometimes even free)
Re: Cannot set video mode on real hardware
pvc wrote:IMO, targeting Intel integrated graphics would be a good point to start for several reasons.
- a lot of machines (from virtually any segment) have it
- documentation is decent(-ish)
- differences between models are only minimal (for 2D graphics)
- potential test machines are extremely cheap (sometimes even free)
Ok but isn’t it just making things harder for me. Wouldn’t using UEFI and GOP be easier than writing drivers for my video card. I believe it would be provided that GOP can support higher video modes. Is it *guaranteed* for the GOP to supply higher modes? If not so, how can I even start writing drivers for a video card?nullplan wrote:No, but you can start with a driver for your video card, and then add every card you come across as required. Given that your OS is unlikely to be used outside of you personally, this is probably the way to go. Add a VESA/GOP fallback for people who want to try it out, and make documentation available on how to add video drivers, and that is probably going to be as it gets. Everything more would require vendor support, which you are unlikely to get until you even reach the lofty heights Linux has climbed to (<10% market share). Which is probably still beyond even your wildest dreams.Danyy wrote:so it is impossible lol since I cannot write a driver for every video card
Re: Cannot set video mode on real hardware
GOP reports in every case what modes it does support. Being in the loader, you can query that and set to what you like most. You can also query EDID information, using UEFI, but that makes little sense, because again - what GOP supports, it reports itself. If you find through EDID some higher resolutions, that GOP doesn't claim to support - you wouldn't be able to set them without directly manipulating the display controller, what is only possible if you know what to manipulate. Warning: GOP, as any UEFI protocol, works only before ExitBootServices(), so setting the mode through it is only possible in the loader.
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Cannot set video mode on real hardware
No.Danyy wrote:Is it *guaranteed* for the GOP to supply higher modes?
Start by figuring out which video card it is so you can find documentation.Danyy wrote:If not so, how can I even start writing drivers for a video card?
Re: Cannot set video mode on real hardware
Well, yes and no. There is a way to detect video modes without writing a driver, however it will report what the card actually supports, and not necessarily what you want. The best you can do is get the list of supported video modes, then look for the resolution which is the closest to the one you want (but there's no guarantee there will be an exact match).Danyy wrote:Is there any way I could make real hardware detect the video modes I want
In that case you definitely will have GOP (in UEFI mode) and both GOP and VBE will report exactly the same video resolutions (because in legacy CSM the VBE function is just a wrapper around GOP).Danyy wrote:Also, note that my computer doesn't have legacy BIOS, it has UEFI and I am running the OS with CSM.
As for VBE, I don't have a tutorial, but here's a link a working Assembly code in my boot loader. It queries the list of supported modes from VESA VBE, and then sets the mode which is closest to the resolution given in reqwidth and reqheight variables.
For GOP, here's a tutorial. It reports the following modes in my qemu:
On a real machine it will report 20 - 30 modes at least.
Cheers,
bzt
Re: Cannot set video mode on real hardware
bzt wrote:Well, yes and no. There is a way to detect video modes without writing a driver, however it will report what the card actually supports, and not necessarily what you want. The best you can do is get the list of supported video modes, then look for the resolution which is the closest to the one you want (but there's no guarantee there will be an exact match).Danyy wrote:Is there any way I could make real hardware detect the video modes I want
In that case you definitely will have GOP (in UEFI mode) and both GOP and VBE will report exactly the same video resolutions (because in legacy CSM the VBE function is just a wrapper around GOP).Danyy wrote:Also, note that my computer doesn't have legacy BIOS, it has UEFI and I am running the OS with CSM.
As for VBE, I don't have a tutorial, but here's a link a working Assembly code in my boot loader. It queries the list of supported modes from VESA VBE, and then sets the mode which is closest to the resolution given in reqwidth and reqheight variables.
For GOP, here's a tutorial. It reports the following modes in my qemu:
On a real machine it will report 20 - 30 modes at least.
Cheers,
bzt
I think I couldn’t clarify. Using VBE I am getting the list of supported video modes and checking the mode that supports 1920x1080x32 and set it, meaning I am not hardcoding any mode. My graphics card being 2080ti and monitor being a 2k monitor, they should support video modes such as 1920x1080x32 but VBE doesn’t report them.zaval wrote:GOP reports in every case what modes it does support. Being in the loader, you can query that and set to what you like most. You can also query EDID information, using UEFI, but that makes little sense, because again - what GOP supports, it reports itself. If you find through EDID some higher resolutions, that GOP doesn't claim to support - you wouldn't be able to set them without directly manipulating the display controller, what is only possible if you know what to manipulate. Warning: GOP, as any UEFI protocol, works only before ExitBootServices(), so setting the mode through it is only possible in the loader.
I am asking how I should reach the video modes I want that are already supported my graphics card and that should be reported by VBE but aren't, without writing a driver for my video hard (hopefully)?
-
- Member
- Posts: 5568
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Cannot set video mode on real hardware
The only way to do it is to write a driver.Danyy wrote:I am asking how I should reach the video modes I want that are already supported my graphics card and that should be reported by VBE but aren't, without writing a driver for my video hard (hopefully)?