For ati there is also GL_ATI_mem_info [1] or WGL_AMD_gpu_association [2] . I believe that [1] is now obsolete as from reading some of the wine-dev mailing list [3], and some other site it seems AMD is now pushing the using of WGL_AMD_gpu_association instead. A patch could be written in the exact same manor as your nvidia patch for ati. There doesn't appear to be an intel or via extension to get video memory, although it's much less of a problem for those integrated graphics.
One thing with your patch is that only since 190.x drivers has the extension been introduced. So any card that is older than the 6xxx series won't support the extension. So you could remove the code for the FX card and below. Besides that I think your implementation is good; but I'm no dev, so I'll let Roderick and Henri make the real comments.
[1] http://www.opengl.org/registry/specs/ATI/meminfo.txt
[2] http://www.opengl.org/registry/specs/AMD/wgl_gpu_association.txt
[3] http://www.mail-archive.com/wine-devel@winehq.org/msg57060.html
--- On Tue, 20/7/10, Henri Verbeet <hverbeet@gmail.com> wrote:The attached uses that experimental extension [1] to report the correct total memory for cards that support it, while sticking with the existing hard coded values and code layout for those that don't.
> Negative on using experimental extensions I'm afraid.
> Writing a proof
> of concept patch is ok, of course, and I'd be willing to
> review that,
> but it can't go in until the extension is finalized. Note
> that this
> wouldn't allow you to get rid of the current code though,
> you still
> need a fallback. It would just allow for more accurate
> reporting on
> cards that do support that extension.
I would appreciate any comments.
Thanks
Luke Bratch
[1] http://developer.download.nvidia.com/opengl/specs/GL_NVX_gpu_memory_info.txt