如何检查video内存大小?

有没有办法检查video内存的大小? 具体来说,是否有一款适用于集成GPU和PCI / AGP显卡的产品?

许多集成的GPU都有动态分配的内存,因此该解决方案有望返回最大可用video内存或当前分配的数量。 对于独立的NVidia或ATI卡,它显然会返回物理GPU RAM的总量。

lspci -v输出内存数字,但我不相信它是video内存。 我怀疑报告的数字是一些系统内存分配或块或通道大小,但我不确定。 您可以在这些测试结果中看到lspci在6个测试中的5个中是错误的:

 ** ASUS EN210 PCIe - 1024 Mb *** 01:00.0 VGA compatible controller: nVidia Corporation GT218 [GeForce 210] (rev a2) Subsystem: ASUSTeK Computer Inc. Device 8354 Memory at e3000000 (32-bit, non-prefetchable) [size=16M] Memory at d0000000 (64-bit, prefetchable) [size=256M] Memory at e0000000 (64-bit, prefetchable) [size=32M] *** Galaxy 8400GS PCIe - 512 Mb *** 01:00.0 VGA compatible controller: nVidia Corporation G98 [GeForce 8400 GS] (rev a1) Subsystem: nVidia Corporation Device 05cc Region 0: Memory at e4000000 (32-bit, non-prefetchable) [size=16M] Region 1: Memory at d0000000 (64-bit, prefetchable) [size=256M] Region 3: Memory at e2000000 (64-bit, non-prefetchable) [size=32M] *** VirtualBox VM - 10 Mb (headless server) *** 00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter Memory at e0000000 (32-bit, prefetchable) [size=16M] *** VirtualBox VM - 128 Mb *** 00:02.0 VGA compatible controller: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter (prog-if 00 [VGA Controller]) Memory at e0000000 (32-bit, prefetchable) [size=128M] *** S3 Savage 4 AGP - unknown Mb (old lspci log), but I don't think they made these cards with 128Mb memory! *** 00:01.0 VGA compatible controller: S3 Inc. Savage 4 (rev 06) (prog-if 00 [VGA controller]) Subsystem: IBM Unknown device 01c5 Region 0: Memory at feb80000 (32-bit, non-prefetchable) [size=512K] Region 1: Memory at f0000000 (32-bit, prefetchable) [size=128M] *** NVIDIA Quadro FX 1800 integrated - 1024 Mb *** 01:00.0 VGA compatible controller: nVidia Corporation GT215 [Quadro FX 1800M] (rev a2) (prog-if 00 [VGA controller]) Subsystem: Dell Device 040c Memory at e2000000 (32-bit, non-prefetchable) [size=16M] Memory at d0000000 (64-bit, prefetchable) [size=256M] Memory at e0000000 (64-bit, prefetchable) [size=32M] 

这是带有ATI 6370HD分立式1G显卡的dmesg的o / p。 “检测到VRAM RAM = 1024M,BAR = 256M”,检查此行。

 sourajit@sourajit:~$ sudo dmesg | grep drm [ 6.126816] [drm] Initialized drm 1.1.0 20060810 [ 6.541907] [drm] radeon defaulting to kernel modesetting. [ 6.541910] [drm] radeon kernel modesetting enabled. [ 6.542102] [drm] initializing kernel modesetting (CEDAR 0x1002:0x68E4 0x17AA:0x397A). [ 6.542142] [drm] register mmio base: 0xE0600000 [ 6.542143] [drm] register mmio size: 131072 [ 7.406572] [drm] Detected VRAM RAM=1024M, BAR=256M [ 7.406576] [drm] RAM width 64bits DDR [ 7.406654] [drm] radeon: 1024M of VRAM memory ready [ 7.406655] [drm] radeon: 512M of GTT memory ready. 

nvidia-settings为使用专有的nvidia驱动程序的卡执行此操作。 它可能不准确,但对我的特定卡是正确的。 我不知道任何其他用户空间工具专门查询video驱动程序。

你也可以尝试sudo lshw -class display但我不能保证它会比lspci更准确。 它还会报告内存范围,而不是数量,所以你必须做一些数学运算。

我发现grep -i memory /var/log/Xorg.0.log正确报告我系统卡上的VRAM。 它不适用于使用集成Radeon Mobility设备的驱动程序radeon笔记本电脑。

 LC_ALL=C lspci -v | grep -EA10 "3D|VGA" | grep 'prefetchable' 

我的系统输出

 Memory at d0000000 (64-bit, non-prefetchable) [size=4M] Memory at c0000000 (64-bit, prefetchable) [size=256M] 

这意味着它具有专用于集成显卡的256 MB内存。

更新 :但是,请注意,如果您使用其中一个英特尔高清显卡。 它的内存通常与系统的主RAM共享,并且是动态的,这意味着它可以根据需要增加和减少。 在我的系统中,我后来发现它可以增长到1.7 GB,如果你的系统有4 GB的RAM(我的情况),这个值似乎是标准的。 如果你使用这样的显卡,上面的输出将没有多大帮助。

你可以试试这个:

 echo $"VRAM: "$(($(grep -P -o -i "(?<=memory:).*(?=kbytes)" /var/log/Xorg.0.log) / 1024))$" Mb" 

或者如果以上命令失败:

 echo $(dmesg | grep -o -P -i "(?<=vram:).*(?=M 0x)")$" Mb" 

没有什么新东西 - 只是查看其他post并添加模式匹配以获得更好的格式化输出。

软件中心提供了一个名为hardinfo 的程序 ,该程序将列出每个video卡(在“设备”下拉列表中,在“PCI设备”类别中)和每个卡的规格,包括内存和供应商/型号。