st/nine: return GetAvailableTextureMem in bytes as expected (v2)
authorDavid Heidelberg <david@ixit.cz>
Mon, 24 Nov 2014 23:38:07 +0000 (00:38 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 26 Nov 2014 20:09:11 +0000 (20:09 +0000)
PIPE_CAP_VIDEO_MEMORY returns the amount of video memory in megabytes,
so need to converted it to bytes.

Fixed Warframe memory detection.

v2: also prepare for cards with more than 4GB memory

Cc: "10.4" <mesa-stable@lists.freedesktop.org>
Tested-by: Yaroslav Andrusyak <pontostroy@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: David Heidelberg <david@ixit.cz>
src/gallium/state_trackers/nine/device9.c

index 66d5e667f8e93280bac78e01ba8b58728be6069b..d48f47d5bd404e7a4282208b45a96ee955abe7f6 100644 (file)
@@ -423,7 +423,11 @@ NineDevice9_TestCooperativeLevel( struct NineDevice9 *This )
 UINT WINAPI
 NineDevice9_GetAvailableTextureMem( struct NineDevice9 *This )
 {
-    return This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY);
+   const unsigned mem = This->screen->get_param(This->screen, PIPE_CAP_VIDEO_MEMORY);
+   if (mem < 4096)
+      return mem << 20;
+   else
+      return UINT_MAX;
 }
 
 HRESULT WINAPI