I have been thinking that drawing in a screen could be done extremely fast if the base address of the graphics card (the BAR) could be moved to arbitrary regions of memory at runtime instead of relying on double/multiple buffering.
In this way, we could implement a high level stack of buffer pointers, and also a heap of such buffers.
Then, we could start pushing just the address of certain screen-sized buffer and pass it as a parameter for a drawing function.
When we finish drawing, we could, instead of copying the secondary buffer to the screen's frame buffer, just pop it directly into the PCI Base Address Register (BAR) and thus updating the current screen immediately?
If the hardware supported it, we could also move, free up and even page the frame buffer region and probably use it for other purposes (for example when the screen is turned off or when there's a long time away from the computer).
Moving the Graphics Card Base Addres instead of buffering
Moving the Graphics Card Base Addres instead of buffering
How common and how possible would the following be in a standard way?
YouTube:
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
Re: Moving the Graphics Card Base Addres instead of bufferin
Most modern video devices support page flipping which can be used to alternate between multiple buffers without the need to copy data. I am not aware of any standard protocol (not even firmware interfaces) that provides these facilities though. In other words, you may need to write custom drivers for these devices. Copying the back buffer is slower but more portable.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
-
- Member
- Posts: 283
- Joined: Mon Jan 03, 2011 6:58 pm
Re: Moving the Graphics Card Base Addres instead of bufferin
Seeing as hardware sees physical memory (and not paged/linear/whats the other one called?) this is already "easy" to do.
- Monk
- Monk
Re: Moving the Graphics Card Base Addres instead of bufferin
Segmented?tjmonk15 wrote:Seeing as hardware sees physical memory (and not paged/linear/whats the other one called?) this is already "easy" to do.
- Monk
YouTube:
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
Re: Moving the Graphics Card Base Addres instead of bufferin
VESA VBE. If you have enough video memory, you can make a virtual screen larger than the physical screen and organize scrolling or flipping by setting the address of the beginning of the visible portion and drawing in the invisible.neon wrote:Most modern video devices support page flipping which can be used to alternate between multiple buffers without the need to copy data. I am not aware of any standard protocol (not even firmware interfaces) that provides these facilities though. In other words, you may need to write custom drivers for these devices. Copying the back buffer is slower but more portable.
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Moving the Graphics Card Base Addres instead of bufferin
The video card's frame buffer is located in the video card's RAM, not in main RAM. Changing the BAR only changes where the video card's RAM is located in the CPU address space; it does not cause the video card to use main RAM as the frame buffer.~ wrote:instead of copying the secondary buffer to the screen's frame buffer, just pop it directly into the PCI Base Address Register (BAR) and thus updating the current screen immediately?
(Integrated graphics controllers that use main RAM as the video card's RAM may support these kinds of shenanigans, but it won't be as simple as messing with the PCI configuration.)