有没有办法检查视频内存的大小?具体来说,是否有一种可以同时适用于集成 GPU 和 PCI/AGP 显卡?
许多集成 GPU 已动态分配内存,因此该解决方案有望返回最大可用视频内存或当前分配的数量。对于独立的 NVidia 或 ATI 卡,它显然会返回物理 GPU RAM 的总量。
lspci -v确实输出内存数字,但我不相信它是视频内存。我怀疑报告的数字是一些系统内存分配或块或通道大小,但我不确定。您可以在这些测试结果中看到 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]
Run Code Online (Sandbox Code Playgroud)
小智 32
这是带有 ATI 6370HD 独立 1G 显卡的 dmesg 的 o/p。“Detected 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.
Run Code Online (Sandbox Code Playgroud)
koa*_*ead 16
nvidia-settings 为使用专有nvidia驱动程序的卡执行此操作。它可能不准确,但对我的特定卡来说是正确的。我不知道有任何其他专门查询视频驱动程序的用户空间工具。
您也可以尝试,sudo lshw -class display但我不能保证它会比 lspci 更准确。它还报告内存范围,而不是数量,所以你必须做一些数学运算。
我发现它grep -i memory /var/log/Xorg.0.log正确地报告了我系统卡上的 VRAM。它并没有使用驱动程序我的笔记本电脑工作radeon与集成Radeon移动设备。
thi*_*wfx 16
LC_ALL=C lspci -v | grep -EA10 "3D|VGA" | grep 'prefetchable'
Run Code Online (Sandbox Code Playgroud)
我的系统输出
Memory at d0000000 (64-bit, non-prefetchable) [size=4M]
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Run Code Online (Sandbox Code Playgroud)
这意味着它有 256 MB 的内存专用于集成显卡。
更新:但是,如果您使用英特尔高清显卡之一,请注意。它的内存通常与系统的主 RAM 共享,并且是动态的,这意味着它可以按需增加和减少。在我的系统中,我后来发现它可以增长到 1.7 GB,如果您的系统具有 4.0 GB 的 RAM(我的情况),这个值似乎是标准的。如果你使用这样的显卡,上面的输出不会有太大帮助。
你可以试试这个:
echo $"VRAM: "$(($(grep -P -o -i "(?<=memory:).*(?=kbytes)" /var/log/Xorg.0.log) / 1024))$" Mb"
Run Code Online (Sandbox Code Playgroud)
或者如果上述命令失败:
echo $(dmesg | grep -o -P -i "(?<=vram:).*(?=M 0x)")$" Mb"
Run Code Online (Sandbox Code Playgroud)
没有什么新鲜事 - 只是查看了其他帖子并添加了模式匹配以获得更好的格式化输出。
小智 8
以下对我有用:
glxinfo | egrep -i 'device|memory'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
137557 次 |
| 最近记录: |