[Mesa-dev] [PATCH] glxinfo: test GL_ATI_meminfo and GL_NVX_gpu_memory_info
Marek Olšák
maraeo at gmail.com
Tue Feb 2 13:47:32 UTC 2016
From: Marek Olšák <marek.olsak at amd.com>
---
src/xdemos/glxinfo.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+)
diff --git a/src/xdemos/glxinfo.c b/src/xdemos/glxinfo.c
index f65451a..b0377fb 100644
--- a/src/xdemos/glxinfo.c
+++ b/src/xdemos/glxinfo.c
@@ -390,6 +390,55 @@ query_renderer(void)
}
+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
+}
+
+
static Bool
print_screen_info(Display *dpy, int scrnum,
const struct options *opts,
@@ -547,6 +596,10 @@ print_screen_info(Display *dpy, int scrnum,
}
if (strstr(glxExtensions, "GLX_MESA_query_renderer"))
query_renderer();
+ if (strstr(glExtensions, "GL_ATI_meminfo"))
+ query_ATI_meminfo();
+ if (strstr(glExtensions, "GL_NVX_gpu_memory_info"))
+ query_NVX_gpu_memory_info();
printf("OpenGL vendor string: %s\n", glVendor);
printf("OpenGL renderer string: %s\n", glRenderer);
} else
--
2.1.4
More information about the mesa-dev
mailing list