Hi, Can you give the attached patches a try? Do they detect the correct amount of video memory?
Thanks, Stefan Am Friday 14 August 2009 11:58:12 schrieb Sun, Sunny: > Hi > > I think it is difficult to maintain a large list of all ASICs, for you have > to change the list from time to time when a new ASIC is released. Actually > we have provided the functionality for getting total video memory, you can > use the following code to get the total video memory with ATI cards. > > #define GL_TOTAL_PHYSICAL_MEMORY_ATI 0x87FE > > const char *glExtensions = (const char*)glGetString(GL_EXTENSIONS); > > if(strstr(glExtensions, "GL_ATI_meminfo")) > > { > > int total_mem[4] = {0}; > > glGetIntegerv(GL_TOTAL_PHYSICAL_MEMORY_ATI, total_mem); // > total_mem[0] contains the total video memory size and the value is in Kbyte > > vidmem = total_mem[0] / 1024; //converting from Kbyte to Mbyte > > } > > > > Regards > > Sunny > > -----Original Message----- > From: Roderick Colenbrander [mailto:thunderbir...@gmail.com] > Sent: Friday, August 14, 2009 1:44 AM > To: Stefan Dösinger > Cc: wine-devel@winehq.org; Hu, Li; Jin, Jian-Rong; Wang, Robin; Guan, > Xiao-Feng; Sun, Sunny Subject: Re: about video memory detection in wine > > On Thu, Aug 13, 2009 at 6:59 PM, Stefan Dösinger<stefandoesin...@gmx.at> wrote: > > Am Wednesday 12 August 2009 10:04:10 schrieb Sun, Sunny: > >> I think you can first detect GL_ATI_meminfo in > >> > >> glGetString(GL_EXTENSIONS); if GL_ATI_meminfo exists, then you can use > >> > >> glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, param) to get the current free > >> > >> video memory, you can see more info at: > > > > A minor problem with GL_ATI_meminfo is that it doesn't report the total > > amount > > > > of video memory available. D3D8 and D3D9 only report the free amount as > > well, > > > > but DirectDraw can return the total amount. There are some games that > > first > > > > query the total amount using ddraw, then continue with d3d8 or 9. > > Depending > > > > on what other apps are doing, reporting the currently free amount as > > total > > > > might result in the app thinking that free vidmem > total vidmem, running > > > > into all sorts of troubles. (For example, another app frees a lot of > > textures > > > > between the ddraw vidmem query and the d3d9 vidmem query) > > It is even worse. Even OpenGL apps like WoW use ddraw for querying the > > amount of video memory at startup! > > In case of Nvidia the amount of video memory and the pci ids are > > advertised using the NV-CONTROL extension. At some point I plan on > > adding code for that. Even when using such extension the current > > fallback is still needed. The list needs some updates. > > > The other issue is that if some other apps use lots of video memory(like > > > > Compiz, etc), then we can still run into the same out of memory issue if > > > > other apps consume too much video memory. > > > > > > > > We should probably also fall back to a saner default on newer d3d10 class > > > > cards - a radeon 9500 isn't really representative for them any more. > > I still have to update that part but haven't had time for it yet. > > > > Roderick
From 0844cdc2be0fb4bf1769e97a05a6d6b4ac624ef2 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Stefan=20D=C3=B6singer?= <ste...@codeweavers.com> Date: Fri, 14 Aug 2009 13:09:26 +0200 Subject: [PATCH 4/4] WineD3D: Use GL_ATI_meminfo if available --- dlls/wined3d/directx.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 82e476c..723eb78 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1957,11 +1957,29 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_gl_info *gl_info) } TRACE_(d3d_caps)("FOUND (fake) card: 0x%x (vendor id), 0x%x (device id)\n", gl_info->gl_vendor, gl_info->gl_card); - /* If we have an estimate use it, else default to 64MB; */ - if(vidmem) - gl_info->vidmem = vidmem*1024*1024; /* convert from MBs to bytes */ + /* Use video memory info from GL if available */ + if(GL_SUPPORT(ATI_MEMINFO)) + { + /* All GL_ATI_meminfo enums return 4 ints, even the (undocumented) + * GL_TOTAL_PHYSICAL_MEMORY_ATI one, which returns {mem, 0, 0, 0} */ + GLint mem[4]; + /* Returns the vidmem in KB */ + glGetIntegerv(GL_TOTAL_PHYSICAL_MEMORY_ATI, mem); + TRACE("Video memory from OpenGL: %d MB\n", mem[0] / 1024); + gl_info->vidmem = mem[0] * 1024; /* convert from KBs to bytes */ + } + else if(vidmem) + { + /* If we have an estimate use it */ + gl_info->vidmem = vidmem * 1024 * 1024; /* convert from MBs to bytes */ + TRACE("Video memory estimate: %d MB\n", vidmem); + } else + { + /* Otherwise default to 64MB */ + TRACE("Default video memory: %d MB\n", WINE_DEFAULT_VIDMEM / (1024 * 1024)); gl_info->vidmem = WINE_DEFAULT_VIDMEM; + } /* Load all the lookup tables */ for (i = 0; i < MAX_LOOKUPS; i++) { -- 1.6.3.3
From 68cd9695b1af62e5d446f8d341915093dceccd9f Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Stefan=20D=C3=B6singer?= <ste...@codeweavers.com> Date: Fri, 14 Aug 2009 13:10:04 +0200 Subject: [PATCH 3/4] WineD3D: Add GL_ATI_meminfo to the extension table --- dlls/wined3d/directx.c | 1 + dlls/wined3d/wined3d_gl.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index ea02458..82e476c 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -52,6 +52,7 @@ static const struct { {"GL_ATI_texture_mirror_once", ATI_TEXTURE_MIRROR_ONCE, 0 }, {"GL_ATI_fragment_shader", ATI_FRAGMENT_SHADER, 0 }, {"GL_ATI_texture_compression_3dc", ATI_TEXTURE_COMPRESSION_3DC, 0 }, + {"GL_ATI_meminfo", ATI_MEMINFO, 0 }, /* ARB */ {"GL_ARB_color_buffer_float", ARB_COLOR_BUFFER_FLOAT, 0 }, diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 8ff55b0..ea91a07 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -3115,6 +3115,16 @@ typedef void (WINE_GLAPI *PGLFNSETFRAGMENTSHADERCONSTANTATI) (GLuint dst, const #define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 #endif +/* GL_ATI_meminfo */ +#ifndef GL_ATI_meminfo +#define GL_ATI_meminfo +#define GL_VBO_FREE_MEMORY_ATI 0x87FB +#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC +#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD +/* Undocumented in the spec */ +#define GL_TOTAL_PHYSICAL_MEMORY_ATI 0x87FE +#endif + /* GL_VERSION_2_0 */ #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 @@ -3492,6 +3502,7 @@ typedef enum _GL_SupportedExt { EXT_VERTEX_SHADER, ATI_FRAGMENT_SHADER, ATI_TEXTURE_COMPRESSION_3DC, + ATI_MEMINFO, /* APPLE */ APPLE_FENCE, APPLE_CLIENT_STORAGE, -- 1.6.3.3