[Mesa-dev] [PATCH 09/27] mesa: Handle !m->Ended for performance monitor result availability.

Kenneth Graunke kenneth at whitecape.org
Wed Nov 13 17:52:14 PST 2013


If a performance monitor has never ended, then no result can be
available.  Core Mesa can easily handle this, saving drivers a tiny bit
of complexity.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: Eric Anholt <eric at anholt.net>
Cc: Carl Worth <cworth at cworth.org>
Cc: Juha-Pekka Heikkilä <juha-pekka.heikkila at intel.com>
---
 src/mesa/main/performance_monitor.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/performance_monitor.c b/src/mesa/main/performance_monitor.c
index c168bf5..6491b42 100644
--- a/src/mesa/main/performance_monitor.c
+++ b/src/mesa/main/performance_monitor.c
@@ -568,8 +568,12 @@ _mesa_GetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname,
       return;
    }
 
+   /* If the monitor has never ended, there is no result. */
+   bool result_available = m->Ended &&
+      ctx->Driver.IsPerfMonitorResultAvailable(ctx, m);
+
    /* AMD appears to return 0 for all queries unless a result is available. */
-   if (!ctx->Driver.IsPerfMonitorResultAvailable(ctx, m)) {
+   if (!result_available) {
       *data = 0;
       if (bytesWritten != NULL)
          *bytesWritten = sizeof(GLuint);
-- 
1.8.3.2



More information about the mesa-dev mailing list