Reputation: 1433
We believe that we are running out of video RAM in a Linux based system that we are working on. We are seeing video & graphic drivers segment faulting with allocation related errors.
Are they any tools or techniques that we can use to determine how much video ram is free at any given point in time? Either an external application or something that we build into our application would be great.
Any ideas / suggestions would be appreciated -- Thanks.
Upvotes: 10
Views: 3785
Reputation: 5270
lspci
is not guaranteed to contain the total amount of VRAM. It will only report the VRAM which MMIO-ed to cpu via bar
(mem
, or prefetch-mem
). But the actual VRAM can be larger.
For the same AMD graphic card, radeon
and amdgpu
can see different mmio-ed vram from lspci
, IIUC, for hd8570
, radeon
can only MMIO 256M VRAM to CPU, but amdgpu can MMIO 2G instead, here is the related amdgpu patch: https://patchwork.kernel.org/project/platform-driver-x86/patch/[email protected]/ as example:
Try to resize BAR0 to let CPU access all of VRAM.
So, there is no general way to cal vram from userspace, because it depeneds on gpu drivers.
Upvotes: 1
Reputation: 60771
There isn't a standard way that I know of. Ask whoever makes the drivers you are using.
Depending on your driver, you might have a shot with lspci. Run it verbosely with -v -v
$lspci -v -v | less
look for something that resembles your video card driver, if you're lucky it might list the amount of free memory.
Upvotes: 2