ezome wrote:we got the cpu, ram, videomemory and the gpu do you mean ram or video memory when you talk about memory?
Video memory is a form of ram, only located on the card rather than on the motherboard. When programming VBE modes, the other differences are neglegible.
when you say shared between gpu and the rest of the system do you mean some block of memory in ram is shared between gpu and cpu?
Yes. In most cases, its the video ram, but IIRC intel chipsets share system ram.
if thats true than how is memory transfered to the gpu?
Like any other multiprocessor system. both the CPU and GPU want access to the memory, and the chipset of the video card will arrange things so they both get what they want.
does the gpu paint data from ram or from video memory?
See the notes above.
if the gpu paints from video memory does it copy the lfb in one piece or in little chunks to video memory?
The LFB
is video memory.
but i just hate coding such stuff as long as i don't understand whats
going on
Compliments for the attitude.
A diagram:
Code: Select all
CPU
|
============ system bus
| |
RAM PCI controller
|
============= PCI bus
| |
other +--- | ---+
devices | ===== |
| | | | <- video card
| GPU RAM |
+- | -----+
|
Monitor
From the CPU's perspective, everything is either a form of memory (including MMIO) or port I/O. The CPU is connected almost directly to system memory, and less directly to the video card (via the PCI Host controller) It can read and write to both ram and video memory without knowing the difference.
The GPU can read and write to memory just as good (usually, its better at it) as the processor can - and it can just as well access everything it is (indirectly) connected to. Normally it won't stick his nose out of his box, but if you tell him to, it will talk to the monitor, and if you know how, it will even read from system memory even though that is quite a bit away (that process is called DMA).
When in VESA mode, the GPU just reads bits from the memory, and forwards them to the monitor. That means for every frame, the contents of memory is sent to the display.
Since the CPU has also access to the same bit of RAM, the CPU might change the contents of it during one of the GPU's cycles. The GPU doesn't bother, but from the user's perspective it seems as if you see parts of several screens. Tearing results when one of those screens is a intermediate of the drawing process, i.e. it is not the screen you previously drew, nor is it the screen that you want the user to see next time around. By keeping those intermediates out of the area where the GPU finds its data for the screen, you can eliminate tearing. Many alternatives are available, including double-buffering, triple-buffering, page-flipping and using the vertical retrace interval. Double buffering is the easiest - you simply keep a copy of the screen somewhere the user can't see it, then copy it to the video card's visible area once its in a state ready for the user to view. That way intermediates are only present in non-visible memory and can not contribute to tearing effects.
The other three methods are more advanced, but require special support from the video card. With a VGA, you have all options at your disposal.