Hi,
I need to get the size of the VBE framebuffer, so I know how much space I need for its mapping. I have examined both the VBE 2.0 and 3.0 specifications. VBE 2.0 contains a field in "VBE Mode Info" to determine the start of the offscreen memory, plus the size of the offscreen memory.
However, in VBE 3.0 they are set to 0. To get the number of pages I can use the "LinNumberOfImagePages" field, but what is the size of a page? Is it equivalent to "BankSize", since I don't see any fields similar to "ImageSize"?
At last, should I only map to virtual memory the framebuffer, or should I map the whole video memory?
Your help would be much respected.
Regards,
glauxosdever
Getting the size of video memory (VBE)
-
- Member
- Posts: 501
- Joined: Wed Jun 17, 2015 9:40 am
- Libera.chat IRC: glauxosdever
- Location: Athens, Greece
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Getting the size of video memory (VBE)
How many bytes in each scanline? How many scanlines?glauxosdever wrote:I need to get the size of the VBE framebuffer, so I know how much space I need for its mapping.
I think you can figure it out once you have those two numbers.
You only need to map the parts you're using.glauxosdever wrote:At last, should I only map to virtual memory the framebuffer, or should I map the whole video memory?
-
- Member
- Posts: 501
- Joined: Wed Jun 17, 2015 9:40 am
- Libera.chat IRC: glauxosdever
- Location: Athens, Greece
Re: Getting the size of video memory (VBE)
Hi,
By the way, I'm not saying you are wrong (since you are far more experienced than me), but I always prefer having two of more opinions, so I have a broader perspective.
Regards,
glauxosdever
This is what I am currently doing. But I wasn't sure if it is the best solution. In fact, I think I'll wait for another reply to AND the suggested statements together.Octocontrabass wrote:How many bytes in each scanline? How many scanlines?
I think you can figure it out once you have those two numbers.
By the way, I'm not saying you are wrong (since you are far more experienced than me), but I always prefer having two of more opinions, so I have a broader perspective.
Regards,
glauxosdever
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Getting the size of video memory (VBE)
Well, height * bytes per line is probably how to calculate on-screen memory. If you want the entire VGA memory of the controller, the VESA Controller Information block has a field for that which contains the size of memory in 64 KB blocks.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
-
- Member
- Posts: 501
- Joined: Wed Jun 17, 2015 9:40 am
- Libera.chat IRC: glauxosdever
- Location: Athens, Greece
Re: Getting the size of video memory (VBE)
Hi,
Edit: People in #osdev told me this is the correct way too. So it seems it indeed is.
Regards,
glauxosdever
Ok, it seems I'm doing it well, then. But a third opinion wouldn't hurt, still.omarrx024 wrote:Well, height * bytes per line is probably how to calculate on-screen memory. If you want the entire VGA memory of the controller, the VESA Controller Information block has a field for that which contains the size of memory in 64 KB blocks.
Edit: People in #osdev told me this is the correct way too. So it seems it indeed is.
Regards,
glauxosdever
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Getting the size of video memory (VBE)
Since you asked, look up the BARs in the device's PCI space, find the one matching the framebuffer, then map it in its entirety.*glauxosdever wrote:But a third opinion wouldn't hurt, still.
* Fun exercise, but a bad idea in production code.
Re: Getting the size of video memory (VBE)
That is the usual way, Im also doing it, just try it out.glauxosdever wrote:This is what I am currently doing. But I wasn't sure if it is the best solution.Octocontrabass wrote:How many bytes in each scanline? How many scanlines?
I think you can figure it out once you have those two numbers.
You identity map from the framebuffer up to framebuffer+(heigth *pitch) and if you can still see all changes going on the screen, it works.
Are you somehow afraid of it not working everywhere?
My Bootloader Does Not Work?!