进程的图形卡内存和虚拟地址空间 [英] Graphics card memory and virtual address space of a process

查看:104
本文介绍了进程的图形卡内存和虚拟地址空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个游戏,它根据openGL做很多图形,并且我有一个装有32位Linux,装有4GB RAM和1G Nvidia图形卡的台式机.我的游戏应用程序虚拟地址空间是怎样的?显卡内存是否映射在此虚拟地址空间中?

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 game application virtual address space look like ? Is graphics card memory mapped in this virtual address space ?

此外,RAM和图形卡内存之间是否存在某些关系? linux是否为不能由任何进程使用的图形卡分配相等的RAM?就是说,这样一来,我的游戏进程就只能获得3GB的RAM了?

Also, is there some relation between RAM and graphics card memory ? Does linux allocate equal RAM for graphics card which can not be used by any process ? That said, it results then into only 3GB of RAM available to my game process ?

推荐答案

我的游戏应用程序虚拟地址空间如何?

How does my game application virtual address space look like?

不可能告诉. OpenGL使这些细节完全对供应商实现开放.任何符合规范的内容都是允许的.

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.

此外,RAM和图形卡内存之间是否存在某些关系?

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

通常是.到目前为止,与大多数OpenGL实现有关,图形卡的RAM本质上是实际生活在系统内存(CPU RAM +交换空间+从存储映射的内存)中的内容的缓存.但是,这并不局限于规范,并且任何符合OpenGL规范的内容都是允许的.

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.

Linux是否为不能由任何进程使用的图形卡分配相等的RAM?

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

否,因为Linux(内核)与这些无关.但是,您的图形卡的驱动程序是.驾驶员可以按照自己认为合适的任何方式进行操作.它既可以通过物理地址扩展(PAE)将OpenGL上下文数据映射到单独的地址空间中,也可以将其置于不同的进程中,或者将其保留在游戏的地址空间中,或者……或……或…….没有任何书面计划.

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.

就是说,那么结果是我的游戏进程只能使用3GB的RAM吗?

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

如果是这样,则更像(3GB - 1GB) - x,其中0 < x,因为进程的地址空间的前1GB是为内核保留的,当然还有程序的文本(由CPU执行的二进制文件)和它正在使用的库也会占用一些地址空间.

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.

这篇关于进程的图形卡内存和虚拟地址空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆