Determine the ram of the graphics card
Code:
lspci -v -s "$(lspci | grep -i 'VGA compatible controller' | head -n 1 | awk '{print $1}')" | grep -ie 'Memory at .* prefetchable'
Whilst the command offered shows a form of memory, it is the "prefectchable" memory which is distinct from the graphics card memory.
For example, the following is output by the command from a machine here:
Code:
$ lspci -v -s "$(lspci | grep -i 'VGA compatible controller' | head -n 1 | awk '{print $1}')" | grep -ie 'Memory at .* prefetchable'
Memory at 4000000000 (64-bit, prefetchable) [size=128M]
Memory at 4008000000 (64-bit, prefetchable) [size=32M]
However the memory of the graphics card itself is much greater than the 128M and 32M shown in that output. When purchased, the graphics card was described as having 2G memory!
To find the memory of the graphics card itself, the following command usually provides it:
Code:
$ dmesg | grep -i vram
<snip>
[ 4.516772] nouveau 0000:01:00.0: DRM: VRAM: 2048 MiB
The output shown here of 2048MiB approximates to the 2G of the original specification of the graphics card by the manufacturer.
Prefetchable memory is separate from the graphics card memory. It's a type of memory that can be accessed by the CPU in advance of the CPU's need for the data. The CPU has the capacity to predict which data will be needed next and "prefetches" it into the CPU cache. This is done to try and improve performance by reducing the number of times the CPU has to wait for data to be fetched from main memory.
The graphics card memory, on the other hand, which is also known as VRAM (video random access memory), is a type of memory that is specifically designed for use by graphics cards, and in the graphics card itself. VRAM is optimised for high-speed data access and processing. That's important for rendering graphics images and videos. Videos move and graphics cards have to cope. Graphics card VRAM is usually larger in capacity than prefetchable memory, since it stores more data to use for the work it has to do. Modern graphics cards have all sorts of complicated stuff they do which probably explains why their memory capacity has increased over the years.
Here's a quote from my notes on the matter:
"The main difference between prefetchable memory and graphics card memory is that prefetchable memory is general-purpose memory that can be used by any device on the system, while graphics card memory is specifically designed for use by graphics cards."