Mesa (master): gallium: add a new query

Zack Rusin zack at kemper.freedesktop.org
Tue Jun 22 09:53:07 PDT 2010


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

Author: Zack Rusin <zackr at vmware.com>
Date:   Mon Jun 21 22:11:07 2010 -0400

gallium: add a new query

to figure out if gpu is finished with all of the previously issues commands

---

 src/gallium/drivers/softpipe/sp_query.c |   12 ++++++++++--
 src/gallium/include/pipe/p_defines.h    |    3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index 245f1b5..9328334 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -58,7 +58,8 @@ softpipe_create_query(struct pipe_context *pipe,
 
    assert(type == PIPE_QUERY_OCCLUSION_COUNTER ||
           type == PIPE_QUERY_TIME_ELAPSED ||
-          type == PIPE_QUERY_SO_STATISTICS);
+          type == PIPE_QUERY_SO_STATISTICS ||
+          type == PIPE_QUERY_GPU_FINISHED);
    sq = CALLOC_STRUCT( softpipe_query );
    sq->type = type;
 
@@ -78,7 +79,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
 {
    struct softpipe_context *softpipe = softpipe_context( pipe );
    struct softpipe_query *sq = softpipe_query(q);
-   
+
    switch (sq->type) {
    case PIPE_QUERY_OCCLUSION_COUNTER:
       sq->start = softpipe->occlusion_count;
@@ -90,6 +91,8 @@ 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_GPU_FINISHED:
+      break;
    default:
       assert(0);
       break;
@@ -119,6 +122,8 @@ softpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
       sq->so.primitives_storage_needed =
          softpipe->so_stats.primitives_storage_needed;
       break;
+   case PIPE_QUERY_GPU_FINISHED:
+      break;
    default:
       assert(0);
       break;
@@ -141,6 +146,9 @@ softpipe_get_query_result(struct pipe_context *pipe,
       memcpy(vresult, &sq->so,
              sizeof(struct pipe_query_data_so_statistics));
       break;
+   case PIPE_QUERY_GPU_FINISHED:
+      *result = TRUE;
+      break;
    default:
       *result = sq->end - sq->start;
       break;
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 85551ca..b3a53c2 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -382,7 +382,8 @@ enum pipe_transfer_usage {
 #define PIPE_QUERY_PRIMITIVES_EMITTED    2
 #define PIPE_QUERY_TIME_ELAPSED          3
 #define PIPE_QUERY_SO_STATISTICS         5
-#define PIPE_QUERY_TYPES                 6
+#define PIPE_QUERY_GPU_FINISHED          6
+#define PIPE_QUERY_TYPES                 7
 
 
 /**



More information about the mesa-commit mailing list