Mesa (master): mesa: Track whether a performance monitor has ever ended.
Kenneth Graunke
kwg at kemper.freedesktop.org
Mon Nov 18 02:53:34 UTC 2013
Module: Mesa
Branch: master
Commit: bde5e4a1e64cd0ddd89556f654185d256743728f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bde5e4a1e64cd0ddd89556f654185d256743728f
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Wed Nov 13 17:12:37 2013 -0800
mesa: Track whether a performance monitor has ever ended.
If a monitor has ended, it means a result should eventually become
available, pending some flushing.
This is distinct from !m->Active; if a monitor has not been started,
then m->Active == false and m->Ended == false.
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/main/mtypes.h | 8 ++++++++
src/mesa/main/performance_monitor.c | 6 +++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 926d948..8801d6f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1848,9 +1848,17 @@ struct gl_perf_monitor_object
{
GLuint Name;
+ /** True if the monitor is currently active (Begin called but not End). */
GLboolean Active;
/**
+ * True if the monitor has ended.
+ *
+ * This is distinct from !Active because it may never have began.
+ */
+ GLboolean Ended;
+
+ /**
* A list of groups with currently active counters.
*
* ActiveGroups[g] == n if there are n counters active from group 'g'.
diff --git a/src/mesa/main/performance_monitor.c b/src/mesa/main/performance_monitor.c
index 5a295b1..c168bf5 100644
--- a/src/mesa/main/performance_monitor.c
+++ b/src/mesa/main/performance_monitor.c
@@ -359,8 +359,10 @@ _mesa_DeletePerfMonitorsAMD(GLsizei n, GLuint *monitors)
if (m) {
/* Give the driver a chance to stop the monitor if it's active. */
- if (m->Active)
+ if (m->Active) {
ctx->Driver.ResetPerfMonitor(ctx, m);
+ m->Ended = false;
+ }
_mesa_HashRemove(ctx->PerfMonitor.Monitors, monitors[i]);
ralloc_free(m->ActiveGroups);
@@ -478,6 +480,7 @@ _mesa_BeginPerfMonitorAMD(GLuint monitor)
*/
if (ctx->Driver.BeginPerfMonitor(ctx, m)) {
m->Active = true;
+ m->Ended = false;
} else {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glBeginPerfMonitor(driver unable to begin monitoring)");
@@ -507,6 +510,7 @@ _mesa_EndPerfMonitorAMD(GLuint monitor)
ctx->Driver.EndPerfMonitor(ctx, m);
m->Active = false;
+ m->Ended = true;
}
/**
More information about the mesa-commit
mailing list