6
$\begingroup$

In a modern day desktop or mobile computer, you got the CPU, the RAM, the GPU and it's own video RAM. When a modern OS renderes an image to the screen, where is the actual image data for that screen located? (Talking about a default HDMI output port)

Is it within the memory of the OS Kernel in RAM, fetching the rendered image of an onscreen window from the GPU when preparing the next frame?

Is it within the GPUs VRAM, accessed and manipulated by low level CPU instructions?

Is it within the GPUs VRAM, mapped via DMA to the CPUs adress space?

And also, where can I read up on implementing some of these basic access patterns for a custom written science project OS? A friend of mine managed to get the SVGA mode running in assembly, but I guess one can do more.

$\endgroup$

1 Answer 1

4
$\begingroup$

For modern GPUs it's commonly stored in VRAM which for discrete GPUs are separate from the CPU memory. This usually means there is a penalty associated with letting the CPU access this as the data typically has to be copied across some bus. Mobile devices tend to use shared RAM for both GPU and CPU.

$\endgroup$
4
  • $\begingroup$ But how does the OS ask the GPU for memory to write to when you plugged in an HDMI port. Do OSes manage their own framebuffer when doing "naive" drawing operations and send the 1920*1080 pixel big framebuffer to the GPU with some arbitrary and common standard that can be implemented or does one need a driver for each GPU type so that one can send a simple text message over HDMI ? How does a tty or xserver send it's content through HDMI to the screen? $\endgroup$
    – salbeira
    Apr 13, 2016 at 10:06
  • $\begingroup$ The video card in a PC will handle encoding VRAM to a video signal, the CPU is never involved in this. For unaccelerated OS's they will keep a system memory based frame buffer and use the CPU to draw into it, and then send regions of it over the PCIE bus to the card (typically 'dirty' regions or just areas of the screen that need updating), so some GPU driver/motherboard driver is required to do this. $\endgroup$
    – PaulHK
    Apr 13, 2016 at 10:19
  • $\begingroup$ So implementing this in my very own OS will not really be possible using open and known standards? $\endgroup$
    – salbeira
    Apr 13, 2016 at 10:34
  • $\begingroup$ You could have a look here for some more specifics: wiki.osdev.org/VGA_Hardware $\endgroup$
    – PaulHK
    Apr 15, 2016 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.