Mesa (master): gallium: add a timestamp disjoint query

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


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

Author: Zack Rusin <zackr at vmware.com>
Date:   Tue Jun 22 12:14:29 2010 -0400

gallium: add a timestamp disjoint query

allows application to not only request the frequency of the TIME_ELAPSED
clock but also to detect if that frequency was consistent throughout the
entire bracketed range of graphics commands.

---

 src/gallium/auxiliary/draw/draw_gs.c    |    2 +-
 src/gallium/drivers/softpipe/sp_query.c |   14 +++++++++++++-
 src/gallium/include/pipe/p_defines.h    |    8 +++++++-
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 881d8fc..79a57a6 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -39,7 +39,6 @@
 #include "util/u_memory.h"
 #include "util/u_prim.h"
 
-#define MAX_PRIM_VERTICES 6
 /* fixme: move it from here */
 #define MAX_PRIMITIVES 64
 
@@ -76,6 +75,7 @@ draw_gs_set_constants(struct draw_context *draw,
                       const void *constants,
                       unsigned size)
 {
+   /* noop */
 }
 
 
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index 9328334..4ae69c1 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -59,7 +59,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_GPU_FINISHED);
+          type == PIPE_QUERY_GPU_FINISHED ||
+          type == PIPE_QUERY_TIMESTAMP_DISJOINT);
    sq = CALLOC_STRUCT( softpipe_query );
    sq->type = type;
 
@@ -93,6 +94,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
       break;
    case PIPE_QUERY_GPU_FINISHED:
       break;
+   case PIPE_QUERY_TIMESTAMP_DISJOINT:
    default:
       assert(0);
       break;
@@ -123,6 +125,7 @@ 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);
@@ -149,6 +152,15 @@ softpipe_get_query_result(struct pipe_context *pipe,
    case PIPE_QUERY_GPU_FINISHED:
       *result = TRUE;
       break;
+   case PIPE_QUERY_TIMESTAMP_DISJOINT: {
+      struct pipe_query_data_timestamp_disjoint td;
+      /*os_get_time is in microseconds*/
+      td.frequency = 1000000;
+      td.disjoint = FALSE;
+      memcpy(vresult, &sq->so,
+             sizeof(struct pipe_query_data_timestamp_disjoint));
+   }
+      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 b3a53c2..3b87d99 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -383,7 +383,8 @@ enum pipe_transfer_usage {
 #define PIPE_QUERY_TIME_ELAPSED          3
 #define PIPE_QUERY_SO_STATISTICS         5
 #define PIPE_QUERY_GPU_FINISHED          6
-#define PIPE_QUERY_TYPES                 7
+#define PIPE_QUERY_TIMESTAMP_DISJOINT    7
+#define PIPE_QUERY_TYPES                 8
 
 
 /**
@@ -508,6 +509,11 @@ struct pipe_query_data_so_statistics
    uint64_t num_primitives_written;
    uint64_t primitives_storage_needed;
 };
+struct pipe_query_data_timestamp_disjoint
+{
+   uint64_t frequency;
+   boolean  disjoint;
+};
 
 #ifdef __cplusplus
 }



More information about the mesa-commit mailing list