summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-02-02 14:33:55 +0100
committerMarek Olšák <marek.olsak@amd.com>2016-02-25 18:26:09 +0100
commit3e718db463207df7058edb49d2201ab1acc8bf25 (patch)
tree3156d69327121b7b70fee26856bc42008fcbbf06
parentb851fb1767858981cf47df6cb2a87c1a36057630 (diff)
downloadmesa-demos-3e718db463207df7058edb49d2201ab1acc8bf25.zip
mesa-demos-3e718db463207df7058edb49d2201ab1acc8bf25.tar.xz
glxinfo: test GL_ATI_meminfo and GL_NVX_gpu_memory_info (v2)
v2: move the code to glinfo_common.c. Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/xdemos/glinfo_common.c56
-rw-r--r--src/xdemos/glinfo_common.h2
-rw-r--r--src/xdemos/glxinfo.c1
3 files changed, 59 insertions, 0 deletions
diff --git a/src/xdemos/glinfo_common.c b/src/xdemos/glinfo_common.c
index 5d865f3..a7e1142 100644
--- a/src/xdemos/glinfo_common.c
+++ b/src/xdemos/glinfo_common.c
@@ -798,3 +798,59 @@ parse_args(int argc, char *argv[], struct options *options)
}
}
}
+
+static void
+query_ATI_meminfo(void)
+{
+#ifdef GL_ATI_meminfo
+ int i[4];
+
+ printf("Memory info (GL_ATI_meminfo):\n");
+
+ glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, i);
+ printf(" VBO free memory - total: %u MB, largest block: %u MB\n",
+ i[0] / 1024, i[1] / 1024);
+ printf(" VBO free aux. memory - total: %u MB, largest block: %u MB\n",
+ i[2] / 1024, i[3] / 1024);
+
+ glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, i);
+ printf(" Texture free memory - total: %u MB, largest block: %u MB\n",
+ i[0] / 1024, i[1] / 1024);
+ printf(" Texture free aux. memory - total: %u MB, largest block: %u MB\n",
+ i[2] / 1024, i[3] / 1024);
+
+ glGetIntegerv(GL_RENDERBUFFER_FREE_MEMORY_ATI, i);
+ printf(" Renderbuffer free memory - total: %u MB, largest block: %u MB\n",
+ i[0] / 1024, i[1] / 1024);
+ printf(" Renderbuffer free aux. memory - total: %u MB, largest block: %u MB\n",
+ i[2] / 1024, i[3] / 1024);
+#endif
+}
+
+static void
+query_NVX_gpu_memory_info(void)
+{
+#ifdef GL_NVX_gpu_memory_info
+ int i;
+
+ printf("Memory info (GL_NVX_gpu_memory_info):\n");
+
+ glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &i);
+ printf(" Dedicated video memory: %u MB\n", i / 1024);
+
+ glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &i);
+ printf(" Total available memory: %u MB\n", i / 1024);
+
+ glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &i);
+ printf(" Currently available dedicated video memory: %u MB\n", i / 1024);
+#endif
+}
+
+void
+print_gpu_memory_info(const char *glExtensions)
+{
+ if (strstr(glExtensions, "GL_ATI_meminfo"))
+ query_ATI_meminfo();
+ if (strstr(glExtensions, "GL_NVX_gpu_memory_info"))
+ query_NVX_gpu_memory_info();
+}
diff --git a/src/xdemos/glinfo_common.h b/src/xdemos/glinfo_common.h
index ad867ee..0024f85 100644
--- a/src/xdemos/glinfo_common.h
+++ b/src/xdemos/glinfo_common.h
@@ -138,5 +138,7 @@ context_flags_string(int mask);
void
parse_args(int argc, char *argv[], struct options *options);
+void
+print_gpu_memory_info(const char *glExtensions);
#endif /* GLINFO_COMMON_H */
diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index f65451a..1893f7b 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -547,6 +547,7 @@ print_screen_info(Display *dpy, int scrnum,
}
if (strstr(glxExtensions, "GLX_MESA_query_renderer"))
query_renderer();
+ print_gpu_memory_info(glExtensions);
printf("OpenGL vendor string: %s\n", glVendor);
printf("OpenGL renderer string: %s\n", glRenderer);
} else