summaryrefslogtreecommitdiffstats
path: root/src/mapi/glapi/gen
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-04-11 13:22:00 -0700
committerKenneth Graunke <[email protected]>2013-09-26 16:55:18 -0700
commitb2e327e08f8519da131dd382adcc99240d433404 (patch)
tree228f6f2521a17994ec8d013fcadaccf3aae6f0d6 /src/mapi/glapi/gen
parentf91475d4ab7e1328904a1df443fbf85ed8acb7f3 (diff)
mesa: Add core support for the GL_AMD_performance_monitor extension.
This provides an interface for applications (and OpenGL-based tools) to access GPU performance counters. Since the exact performance counters available vary between vendors and hardware generations, the extension provides an API the application can use to get the names, types, and minimum/maximum values of all available counters. Counters are also organized into groups. Applications create "performance monitor" objects, select the counters they want to track, and Begin/End monitoring, much like OpenGL's query API. Multiple monitors can be in flight simultaneously. v2: Pass ctx to all driver hooks (suggested by Christoph), and attempt to fix overallocation of bitsets (caught by Christoph). Incomplete. v3: Significantly rework core data structures. Store counters in groups rather than in a global list. Use their array index in the group's counter list as the ID rather than trying to store a globally unique counter ID. Use bitsets for active counters within a group, and also track which groups are active so that's easy to query. v4: Remove _mesa_ prefix on static functions; detect out of memory conditions in new_performance_monitor(); make BeginPerfMonitor hook return a boolean rather than setting m->Active or raising an error. Switch to GLuint/unsigned for NumGroups, NumCounters, and MaxActiveCounters (which also means switching a bunch of temporary variable types). All suggested by Brian Paul. Also, remove commented out code at the bottom of the block. Finally, fix the dispatch sanity test (noticed by Ian Romanick). Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> [v3] Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mapi/glapi/gen')
-rw-r--r--src/mapi/glapi/gen/AMD_performance_monitor.xml87
-rw-r--r--src/mapi/glapi/gen/Makefile.am1
-rw-r--r--src/mapi/glapi/gen/gl_API.xml2
-rw-r--r--src/mapi/glapi/gen/gl_genexec.py1
4 files changed, 91 insertions, 0 deletions
diff --git a/src/mapi/glapi/gen/AMD_performance_monitor.xml b/src/mapi/glapi/gen/AMD_performance_monitor.xml
new file mode 100644
index 00000000000..b96b263db03
--- /dev/null
+++ b/src/mapi/glapi/gen/AMD_performance_monitor.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
+
+<OpenGLAPI>
+
+<category name="GL_AMD_performance_monitor" number="360">
+
+ <function name="GetPerfMonitorGroupsAMD" offset="assign">
+ <param name="numGroups" type="GLint *"/>
+ <param name="groupsSize" type="GLsizei"/>
+ <param name="groups" type="GLuint *"/>
+ </function>
+
+ <function name="GetPerfMonitorCountersAMD" offset="assign">
+ <param name="group" type="GLuint"/>
+ <param name="numCounters" type="GLint *"/>
+ <param name="maxActiveCounters" type="GLint *"/>
+ <param name="countersSize" type="GLsizei"/>
+ <param name="counters" type="GLuint *"/>
+ </function>
+
+ <function name="GetPerfMonitorGroupStringAMD" offset="assign">
+ <param name="group" type="GLuint"/>
+ <param name="bufSize" type="GLsizei"/>
+ <param name="length" type="GLsizei *"/>
+ <param name="groupString" type="GLchar *"/>
+ </function>
+
+ <function name="GetPerfMonitorCounterStringAMD" offset="assign">
+ <param name="group" type="GLuint"/>
+ <param name="counter" type="GLuint"/>
+ <param name="bufSize" type="GLsizei"/>
+ <param name="length" type="GLsizei *"/>
+ <param name="counterString" type="GLchar *"/>
+ </function>
+
+ <function name="GetPerfMonitorCounterInfoAMD" offset="assign">
+ <param name="group" type="GLuint"/>
+ <param name="counter" type="GLuint"/>
+ <param name="pname" type="GLenum"/>
+ <param name="data" type="GLvoid *"/>
+ </function>
+
+ <function name="GenPerfMonitorsAMD" offset="assign">
+ <param name="n" type="GLsizei"/>
+ <param name="monitors" type="GLuint *"/>
+ </function>
+
+ <function name="DeletePerfMonitorsAMD" offset="assign">
+ <param name="n" type="GLsizei"/>
+ <param name="monitors" type="GLuint *"/>
+ </function>
+
+ <function name="SelectPerfMonitorCountersAMD" offset="assign">
+ <param name="monitor" type="GLuint"/>
+ <param name="enable" type="GLboolean"/>
+ <param name="group" type="GLuint"/>
+ <param name="numCounters" type="GLint"/>
+ <param name="counterList" type="GLuint *"/>
+ </function>
+
+ <function name="BeginPerfMonitorAMD" offset="assign">
+ <param name="monitor" type="GLuint"/>
+ </function>
+
+ <function name="EndPerfMonitorAMD" offset="assign">
+ <param name="monitor" type="GLuint"/>
+ </function>
+
+ <function name="GetPerfMonitorCounterDataAMD" offset="assign">
+ <param name="monitor" type="GLuint"/>
+ <param name="pname" type="GLenum"/>
+ <param name="dataSize" type="GLsizei"/>
+ <param name="data" type="GLuint *"/>
+ <param name="bytesWritten" type="GLint *"/>
+ </function>
+
+ <enum name="COUNTER_TYPE_AMD" value="0x8BC0"/>
+ <enum name="COUNTER_RANGE_AMD" value="0x8BC1"/>
+ <enum name="UNSIGNED_INT64_AMD" value="0x8BC2"/>
+ <enum name="PECENTAGE_AMD" value="0x8BC3"/>
+ <enum name="PERFMON_RESULT_AVAILABLE_AMD" value="0x8BC4"/>
+ <enum name="PERFMON_RESULT_SIZE_AMD" value="0x8BC5"/>
+ <enum name="PERFMON_RESULT_AMD" value="0x8BC6"/>
+</category>
+
+</OpenGLAPI>
diff --git a/src/mapi/glapi/gen/Makefile.am b/src/mapi/glapi/gen/Makefile.am
index d4fbd351131..9b9b99505f6 100644
--- a/src/mapi/glapi/gen/Makefile.am
+++ b/src/mapi/glapi/gen/Makefile.am
@@ -115,6 +115,7 @@ API_XML = \
ARB_texture_storage.xml \
ARB_vertex_array_object.xml \
AMD_draw_buffers_blend.xml \
+ AMD_performance_monitor.xml \
ARB_vertex_type_2_10_10_10_rev.xml \
APPLE_object_purgeable.xml \
APPLE_vertex_array_object.xml \
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 71aa9a7bdb2..f6511e9878e 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -12890,6 +12890,8 @@
<enum name="FRAMEBUFFER_SRGB_CAPABLE_EXT" value="0x8DBA"/>
</category>
+<xi:include href="AMD_performance_monitor.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
<category name="GL_APPLE_texture_range" number="367">
<enum name="TEXTURE_STORAGE_HINT_APPLE" count="1" value="0x85BC">
<size name="TexParameteriv"/>
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index be82f9089e4..a074c234829 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -82,6 +82,7 @@ header = """/**
#include "main/matrix.h"
#include "main/multisample.h"
#include "main/objectlabel.h"
+#include "main/performance_monitor.h"
#include "main/pixel.h"
#include "main/pixelstore.h"
#include "main/points.h"