OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:25 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [SOLVED] Getting framebuffer's size
PostPosted: Sun Sep 03, 2017 8:34 am 
Offline
Member
Member
User avatar

Joined: Wed Dec 26, 2007 3:37 am
Posts: 117
Location: France
Hi, I Implemented VBE and paging support to have a framebuffer and would like to know how to get the framebuffer's size in order to map framebuffer's address into virtual memory with the right size.
I can display characters because for the moment its mapped with an arbitrary value: framebuffer's address to framebuffer's address + 128 page size.
Thank you in advance.

_________________
OS for PowerPC Macs: https://github.com/narke/Einherjar
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium


Last edited by narke on Sun Sep 03, 2017 3:11 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Getting framebuffer's size
PostPosted: Sun Sep 03, 2017 10:30 am 
Offline
Member
Member
User avatar

Joined: Thu Aug 06, 2015 6:41 am
Posts: 97
Location: Netherlands
Multiplying LinBytesPerScanLine with YResolution (as found in the ModeInfoBlock structure) gives you the size of the screen in bytes for linear framebuffer modes. LinNumberOfImagePages gives you the number of times the entire screen (LinBytesPerScanLine * YResolution) fits in the framebuffer, minus one. So the framebuffer is at least LinBytesPerScanLine * YResolution * (LinNumberOfImagePages + 1) bytes in size.
I'm not sure if there's also a way to find out the exact size of the framebuffer memory, but if you're only interested in the part of the framebuffer that allows you to draw to the screen then LinBytesPerScanLine * YResolution is the size of the area you want to map.


Top
 Profile  
 
 Post subject: Re: Getting framebuffer's size
PostPosted: Sun Sep 03, 2017 1:28 pm 
Offline
Member
Member
User avatar

Joined: Wed Dec 26, 2007 3:37 am
Posts: 117
Location: France
LinBytesPerScanLine is same as pitch? Am I right? I saw http://wiki.osdev.org/VESA_Video_Modes

_________________
OS for PowerPC Macs: https://github.com/narke/Einherjar
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium


Top
 Profile  
 
 Post subject: Re: Getting framebuffer's size
PostPosted: Sun Sep 03, 2017 2:14 pm 
Offline
Member
Member
User avatar

Joined: Thu Aug 06, 2015 6:41 am
Posts: 97
Location: Netherlands
narke wrote:
LinBytesPerScanLine is same as pitch? Am I right? I saw http://wiki.osdev.org/VESA_Video_Modes
Yes, it is generally referred to as pitch, I used the names as they appear in this document (see page 30 for the ModeInfoBlock struct) because there are multiple fields that could be called 'pitch'.
Note that the value defined as 'pitch' in that wiki article is actually BytesPerScanLine, not LinBytesPerScanLine. To quote the document (page 38):
Quote:
The LinBytesPerScanLine field specifies how many full bytes are in each logical scanline for linear framebuffer modes if the linear framebuffer modes are different to the banked modes. (...) VBE 3.0 applications should look at this value for linear modes, as it is possible for the linear modes to have a different logical scanline width than the banked modes.
So BytesPerScanLine might work for some linear modes, LinBytesPerScanLine works for all linear modes.


Top
 Profile  
 
 Post subject: Re: Getting framebuffer's size
PostPosted: Sun Sep 03, 2017 3:07 pm 
Offline
Member
Member
User avatar

Joined: Wed Dec 26, 2007 3:37 am
Posts: 117
Location: France
Thank you very much! It seems to work.

_________________
OS for PowerPC Macs: https://github.com/narke/Einherjar
Operating system: colorForth computing environment for x86.: https://github.com/narke/Roentgenium


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: 8infy, Bing [Bot], thewrongchristian and 76 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