PDA

View Full Version : Distinguishing shared vs. dedicated VRAM



James W. Walker
07-13-2009, 06:54 PM
I can use CGL APIs to find the total amount of graphics memory available to a display, but it doesn't distinguish between real VRAM and graphics memory shared with the CPU. Somehow the System Profiler can tell the difference. Anyone know how?

scratt
07-13-2009, 08:44 PM
Hi James,

I thought Chris et al in the OpenGL list had covered this for you..

But there is another thread here where we discuss some of the same stuff..
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=258022#Post2580 22

James W. Walker
07-14-2009, 12:37 AM
I thought Chris et al in the OpenGL list had covered this for you..

Not unless I missed something. The CGL method that I mentioned here (CGLDescribeRenderer and such) definitely does not distinguish VRAM from shared memory. There's also an IOKit approach, which is incorrect in the Apple Q&A, and Chris said it could be fixed, but didn't say how.


But there is another thread here where we discuss some of the same stuff..
http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=258022#Post2580 22

I'm not sure (no code is given in that thread, and IOKit is fairly opaque to me), but I'll bet that approach also treats shared memory the same as VRAM.

James W. Walker
07-15-2009, 06:10 PM
For the record, I found a somewhat suboptimal solution: Run the command


system_profiler -detailLevel mini -xml

in an NSTask, and then parse the result. I say "suboptimal" because it may take a couple of seconds.

scratt
07-15-2009, 08:17 PM
That's useful to know. :)

James_Bond
08-13-2009, 04:05 AM
Here's a way to achieve this :
http://developer.apple.com/samplecode/VideoHardwareInfo/listing3.html

look at function interrogateIOKitFor

James W. Walker
08-13-2009, 11:28 AM
That function fails to distinguish between shared and dedicated VRAM. I tried the VideoHardwareInfo app on a Mac mini that, according to System Profiler, has 64 MB of shared memory. It reports 256 MB of VRAM.

Any time you have a function that reports a single value for graphics memory, I think it's likely that it doesn't distinguish shared and dedicated VRAM.

I don't doubt that there's some way to get the information from IOKit, but apparently this isn't it.

James_Bond
08-14-2009, 02:23 AM
Ok. Good to know. On another thread (Get amount of graphics memory in OpenGL coding: advanced), I've read that WBEM is developed as an open source project for MAC OS and Linux. May be it worth taking a look to it as it can provides a lot of system infos.