Graphics card memory and virtual address space of a process

后端 未结 1 2022
故里飘歌
故里飘歌 2021-02-06 19:49

Supposing I have a game that does lots of graphics in terms of openGL and I have a desktop with Linux 32-bit installed with 4GB of RAM and 1G Nvidia Graphics card. How does my g

1条回答
  •  一生所求
    2021-02-06 20:10

    How does my game application virtual address space look like?

    Impossible to tell. OpenGL leaves this detail completely open to the vendor implementation. Anything that satisfies the specification is allowed.

    Is graphics card memory mapped in this virtual address space?

    Maybe, maybe not. That depends on the actual implementation.

    Also, is there some relation between RAM and graphics card memory?

    Usually yes. As far and the majority of OpenGL implementation are concerned the graphics card's RAM is essentially a cache for things that actually live in system memory (CPU RAM + swap space + stuff memory mapped from storage). However this is not pinned down to the specification and anything that satisfies the OpenGL specification is allowed.

    Does Linux allocate equal RAM for graphics card which can not be used by any process?

    No, because Linux (the kernel) is not concerned with these things. Your graphics card's driver is, though. And the driver may do it any way it sees fit. It can either map OpenGL context data into a separate address space through Physical Address Extension (PAE) or place it in a different process or keep it in your game's address space, or…, or…, or…. There's no written down scheme on this.

    That said, it results then into only 3GB of RAM available to my game process?

    If so, then more like (3GB - 1GB) - x where 0 < x because the top 1GB of your process' address space are reserved for the kernel and of course your program's text (the binary executed by the CPU) and the text of the libraries it's using takes some address space as well.

    0 讨论(0)
提交回复
热议问题