VGA frame buffer isnt displaying on screen
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: VGA frame buffer isnt displaying on screen
If you're not going to use MTRRs or PAT, set your pages to WB. The effective memory type will be whatever the firmware decided to program into the MTRRs.
Re: VGA frame buffer isnt displaying on screen
I wouldn't rely on BIOS programming MTRRs properly for video memory. I had a bug in this that resulted in poor performance on Intel
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: VGA frame buffer isnt displaying on screen
If you're not going to use MTRRs or PAT, you have to live with whatever poor decisions the firmware has made.
Re: VGA frame buffer isnt displaying on screen
I think PAT is the way to go. I avoid using MTRRs. My problem was that only BSP had the correct PAT settings, and when video was drawn from an application core, things was really slow.
-
- Member
- Posts: 184
- Joined: Tue Aug 26, 2008 11:24 am
- GitHub: https://github.com/sebihepp
Re: VGA frame buffer isnt displaying on screen
Thanks for the information. I will add PAT support to my kloader and later kernel
-
- Member
- Posts: 184
- Joined: Tue Aug 26, 2008 11:24 am
- GitHub: https://github.com/sebihepp
Re: VGA frame buffer isnt displaying on screen
And another question comes to my mind.
In Write-Combined mode, all accesses might be reordered. If I want to implement scrolling by reading the framebuffer line per line and copy the contents to the line before, wouldn't that reordering mess up things?
In Write-Combined mode, all accesses might be reordered. If I want to implement scrolling by reading the framebuffer line per line and copy the contents to the line before, wouldn't that reordering mess up things?
Re: VGA frame buffer isnt displaying on screen
Memory order only concerns independent accesses. If you store into location a the value from location b and then into b the value from c, the CPU sees the load-store dependency and will not reorder the accesses the wrong way around. It might still move the accesses elsewhere, and with write-combining it might just do them a little bit later, but it will not do them the wrong way around.
Carpe diem!
Re: VGA frame buffer isnt displaying on screen
You should never read the frame buffer. You should keep a copy of it in ordinary memory and then copy the contents to the framebuffer when appropriate.
This is because of how PCI operates. Reading PCI memory is quite slow because it results in multicycle operations in the PCI device, and PCI devices will seldom be optimized to handle reads. Writes can be buffered easily and thus are typically single cycle pipelined operations. That's why modern PCI devices use memory schedules. It's much faster for a PCI device to send large amounts of data to physical memory (PCI devices can issue 128 byte write requests, which CPUs cannot), than to let the CPU read out data from the PCI device.
-
- Member
- Posts: 184
- Joined: Tue Aug 26, 2008 11:24 am
- GitHub: https://github.com/sebihepp
Re: VGA frame buffer isnt displaying on screen
Thanks, that is some important info I missed somehow. I will implement DoubleBuffering ASAP.