summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_query.c
diff options
context:
space:
mode:
authorZack Rusin <zackr@vmware.com>2010-06-22 12:14:29 -0400
committerZack Rusin <zackr@vmware.com>2010-06-22 12:58:04 -0400
commite433b73dd256577b022bf38c8499c7ea4eda9845 (patch)
treeabd1946c1cc80ebace26b608fd1622ab56c34d1e /src/gallium/drivers/softpipe/sp_query.c
parentb6c360b46c2b2b1548e2aeaa1a1cd201dfcf82ae (diff)
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.
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_query.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_query.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c
index 9328334c5c..4ae69c1c2b 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;