83

Is there a way to check the size of the video memory? Specifically, is there one that works accurately for both integrated GPU's as well as PCI/AGP graphics cards?

Many integrated GPU's have dynamically allocated memory, so the solution would hopefully return either the maximum available video memory or the currently allocated amount. For stand-alone NVidia or ATI cards it would obviously return the total amount of physical GPU RAM.

lspci -v does output memory figures, but I do not believe it is the video memory. I suspect the figure reported is some system memory allocation or block or channel size, but I don't know for sure. You can see in these test results that lspci was wrong in 5 of the 6 tests:

** 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]
3
  • So because you do not believe it is the figure, you do not accept answers that suggest it?
    – RolandiXor
    Aug 17, 2011 at 16:18
  • 5
    @Roland, perhaps my wording is wrong. I am no expert regarding lspci output, but as you can see in the test results link, it does not give the total size of video memory, and hence does not answer the question.
    – drgrog
    Aug 19, 2011 at 0:48
  • Possible duplicate of How to find how much RAM does my computer have? Aug 4, 2016 at 11:04

6 Answers 6

38

This is the o/p of dmesg with a ATI 6370HD discrete 1G graphics card. "Detected VRAM RAM=1024M, BAR=256M", check for this line.

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.
4
  • 10
    This is the one that ended up working for me, slight tweak just to filter out more of dmesg: dmesg | grep VRAM
    – Ron E
    Jun 26, 2014 at 15:09
  • 2
    confused by Memory usable by graphics device = 2048M when everything else says 256M on my intel i5 integrated graphics (might be shared memory or something). EDIT: just read askubuntu.com/a/475405/178596
    – Wilf
    Apr 14, 2015 at 10:19
  • This information can also be obtained from /var/log/syslog (and syslog.1, syslog.2.gz), with grep and zgrep (for gz). Mar 19, 2021 at 5:47
  • @RonE Your method is the simplest hands down! It works.
    – 71GA
    Jul 2, 2021 at 15:40
35

The following worked for me:

glxinfo | egrep -i 'device|memory'
5
  • 2
    it works like a charm!
    – obayhan
    Oct 17, 2020 at 20:11
  • this is the best command to get info about a graphics card in a ubuntu system by far
    – Capaj
    Mar 9, 2021 at 15:54
  • Work in Nvidia GeForce 9600 on Redhat 8 (NV96) Jul 5, 2021 at 21:45
  • To show the memory part of glxinfoone could use glxinfo | grep -A3 'Memory info'
    – jnas
    Oct 9, 2022 at 17:00
  • Got Error: unable to open display when running on a server
    – Teddy C
    Jan 9 at 23:16
21
LC_ALL=C lspci -v | grep -EA10 "3D|VGA" | grep 'prefetchable' 

My system outputs

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

Which means it has 256 MB of memory dedicated to the integrated video card.

Update: however, beware if you use one of the Intel HD Graphics cards. Its memory is usually shared with the main RAM of the system and it is dynamic, which means it increases and decreases on demand. In my system, I later discovered that it can grow up to 1.7 GB, and this value seems to be standard if you have a system with 4.0 GB of RAM (my case).
If you use a graphics card like this, the above output won't be of much help.

3
  • 3
    You might be able to find how much by running sudo dmesg | grep drm as in the first answer - I got 2048M, which I used for a app under Wine and it worked.
    – Wilf
    Apr 14, 2015 at 10:39
  • 1
    For graphics cards that share with the main memory, is this memory use exposed by things like top or free or is it invisible to the OS? How does one find out how much RAM is taken up by the shared IGP? Jan 24, 2016 at 15:32
  • I can't really tell which command is appending shared memory and resulting in a total memory ; as both glxinfo and dmesg are reporting double the amount of VRAM reported by lspci on an a laptop with APU , while on another desktop with another intel APU it's inconsistent , with dmesg not even reporting anything this time .
    – xquilt
    Oct 2, 2021 at 9:32
16

nvidia-settings does this for cards using the proprietary nvidia driver. It may be inaccurate but it is correct for my particular card. I don't know of any other userspace tool that specifically queries the video driver.

You can also try sudo lshw -class display but I can't guarantee that it will be any more accurate than lspci. Also it reports memory ranges, not amounts, so you'd have to do some math.

I find that grep -i memory /var/log/Xorg.0.log correctly reports the VRAM on my system's card. It does not work for my laptop using driver radeon with integrated Radeon Mobility device.

6
  • Thanks, but nvidia-settings is card-specific. And yes, I believe lshw reports the same system memory resources as lspci, only lshw reports them as address ranges instead of sizes.
    – drgrog
    Jun 5, 2011 at 13:48
  • 3
    I should have thought to go check phoronix before trying to answer this. On my system my 768MB G80 video card is reported as 256MB in lspci, as you note. The folks in the forum have said that this is actually the aperture which is visible over the PCI bus, which makes sense. Doing a 'dmesg |grep VGA' gives the same problem on my system, though I've heard it works correctly for others. The memory is reported correctly in /var/log/Xorg.0.log: 'NVIDIA(0): Memory: 786432 kBytes'. From this forum post: phoronix.com/forums/…!
    – koanhead
    Jun 6, 2011 at 0:00
  • 1
    It seems as if I will have to write my own script. So far grep kB /var/log/Xorg.0.log or grep -i mem /var/log/Xorg.0.log give me the most accurate and workable data for nvidia cards and VirtualBox VMs. I do not have any ATI cards to test, and have not got around to testing my integrated intel cards or VMware VMs.
    – drgrog
    Jun 6, 2011 at 1:27
  • 1
    fglrx: grep kByte will result in something like this: Video RAM: 1048576 kByte, Type: GDDR5, grepping for just kB will also show some VESA items.
    – taneli
    Aug 11, 2011 at 13:00
  • xserver-xorg-video-ati: grep "mem size" will result in something like this: RADEON(0): mem size init: gart size :1fdff000 vram size: s:40000000 visible:f6f6000 which is the best I could get out of it, where memory size is in hex after s:
    – taneli
    Aug 11, 2011 at 13:02
9

You can try this:

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

or this if the above command fails:

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

Nothing new - just looked at other posts and added pattern matching for a better formatted output.

4
  • Both doesn't work for Ubuntu 14.04 Asus G551JM notebook (dual graphics, incl. GeForce GTX 860M) Nov 3, 2016 at 13:43
  • 2
    The first command returns error bash: / 1024: syntax error: operand expected (error token is "/ 1024") Nov 3, 2016 at 13:44
  • This is the only solution that worked for me, from the command line!
    – Panayotis
    Jan 20, 2018 at 18:09
  • second command returns the exact size of video ram Oct 5, 2019 at 14:21
1

There is a program called hardinfo, available in the Software Center, which will list out each video card (under the Devices drop-down, in the PCI Devices category) and the specs for each card, including the memory and vendor/model.

2
  • 2
    Thanks Nathan, but hardinfo is just a gui frontend for the information obtained from lshw and lspci etc. I remember this being suggested before, although it seems the answer has been removed by the author.
    – drgrog
    Jul 16, 2011 at 6:05
  • 3
    hardinfo is cool, but doesn't tell GPU memory. Nov 3, 2016 at 13:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .