Mesa (master): softpipe: implement/fix TIMESTAMP queries

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Thu Oct 20 09:16:37 PDT 2011


Module: Mesa
Branch: master
Commit: 1f4f0c41db2eb81e858475f6677995c9e15ec03f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1f4f0c41db2eb81e858475f6677995c9e15ec03f

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sat Oct 15 16:35:27 2011 +0200

softpipe: implement/fix TIMESTAMP queries

---

 src/gallium/drivers/softpipe/sp_query.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index 88f4257..c2c48e8 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -60,6 +60,7 @@ softpipe_create_query(struct pipe_context *pipe,
           type == PIPE_QUERY_TIME_ELAPSED ||
           type == PIPE_QUERY_SO_STATISTICS ||
           type == PIPE_QUERY_GPU_FINISHED ||
+          type == PIPE_QUERY_TIMESTAMP ||
           type == PIPE_QUERY_TIMESTAMP_DISJOINT);
    sq = CALLOC_STRUCT( softpipe_query );
    sq->type = type;
@@ -85,6 +86,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
    case PIPE_QUERY_OCCLUSION_COUNTER:
       sq->start = softpipe->occlusion_count;
       break;
+   case PIPE_QUERY_TIMESTAMP_DISJOINT:
    case PIPE_QUERY_TIME_ELAPSED:
       sq->start = 1000*os_time_get();
       break;
@@ -92,9 +94,9 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
       sq->so.num_primitives_written = 0;
       sq->so.primitives_storage_needed = 0;
       break;
+   case PIPE_QUERY_TIMESTAMP:
    case PIPE_QUERY_GPU_FINISHED:
       break;
-   case PIPE_QUERY_TIMESTAMP_DISJOINT:
    default:
       assert(0);
       break;
@@ -115,6 +117,10 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
    case PIPE_QUERY_OCCLUSION_COUNTER:
       sq->end = softpipe->occlusion_count;
       break;
+   case PIPE_QUERY_TIMESTAMP:
+      sq->start = 0;
+      /* fall through */
+   case PIPE_QUERY_TIMESTAMP_DISJOINT:
    case PIPE_QUERY_TIME_ELAPSED:
       sq->end = 1000*os_time_get();
       break;
@@ -125,7 +131,6 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
          softpipe->so_stats.primitives_storage_needed;
       break;
    case PIPE_QUERY_GPU_FINISHED:
-   case PIPE_QUERY_TIMESTAMP_DISJOINT:
       break;
    default:
       assert(0);
@@ -156,7 +161,7 @@ softpipe_get_query_result(struct pipe_context *pipe,
       struct pipe_query_data_timestamp_disjoint td;
       /*os_get_time is in microseconds*/
       td.frequency = 1000000;
-      td.disjoint = FALSE;
+      td.disjoint = sq->end != sq->start;
       memcpy(vresult, &td,
              sizeof(struct pipe_query_data_timestamp_disjoint));
    }



More information about the mesa-commit mailing list