summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_query.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2012-02-23 23:22:35 +0100
committerMarek Olšák <[email protected]>2012-03-05 14:22:19 +0100
commit09ec30f02830b3cbf9d6ac04d9497634dca86846 (patch)
treeea21c8d6820e974954af149095b8027d77145be0 /src/gallium/drivers/r600/r600_query.c
parenteabcecc26baf225dc50f1d400a80ea4c78831390 (diff)
r600g: don't suspend timer queries for u_blitter
Timer queries should be able to measure the time spent in u_blitter as well. Queries are split into two groups: the timer ones and the others (streamout, occlusion), because we should only suspend non-timer queries for u_blitter, and later if the non-timer queries are suspended, the context flush should only suspend and resume the timer queries. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Christian König <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_query.c')
-rw-r--r--src/gallium/drivers/r600/r600_query.c61
1 files changed, 52 insertions, 9 deletions
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 25731c290f6..53440ae734a 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -25,6 +25,13 @@
#include "util/u_memory.h"
#include "r600_hw_context_priv.h"
+static bool r600_is_timer_query(unsigned type)
+{
+ return type == PIPE_QUERY_TIME_ELAPSED ||
+ type == PIPE_QUERY_TIMESTAMP ||
+ type == PIPE_QUERY_TIMESTAMP_DISJOINT;
+}
+
static struct r600_resource *r600_new_query_buffer(struct r600_context *ctx, unsigned type)
{
unsigned j, i, num_results, buf_size = 4096;
@@ -123,7 +130,11 @@ static void r600_emit_query_begin(struct r600_context *ctx, struct r600_query *q
cs->buf[cs->cdw++] = PKT3(PKT3_NOP, 0, 0);
cs->buf[cs->cdw++] = r600_context_bo_reloc(ctx, query->buffer.buf, RADEON_USAGE_WRITE);
- ctx->num_cs_dw_queries_suspend += query->num_cs_dw;
+ if (r600_is_timer_query(query->type)) {
+ ctx->num_cs_dw_timer_queries_suspend += query->num_cs_dw;
+ } else {
+ ctx->num_cs_dw_nontimer_queries_suspend += query->num_cs_dw;
+ }
}
static void r600_emit_query_end(struct r600_context *ctx, struct r600_query *query)
@@ -167,7 +178,12 @@ static void r600_emit_query_end(struct r600_context *ctx, struct r600_query *que
cs->buf[cs->cdw++] = r600_context_bo_reloc(ctx, query->buffer.buf, RADEON_USAGE_WRITE);
query->buffer.results_end += query->result_size;
- ctx->num_cs_dw_queries_suspend -= query->num_cs_dw;
+
+ if (r600_is_timer_query(query->type)) {
+ ctx->num_cs_dw_timer_queries_suspend -= query->num_cs_dw;
+ } else {
+ ctx->num_cs_dw_nontimer_queries_suspend -= query->num_cs_dw;
+ }
}
static void r600_emit_query_predication(struct r600_context *ctx, struct r600_query *query,
@@ -324,7 +340,12 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query)
r600_update_occlusion_query_state(rctx, rquery->type, 1);
r600_emit_query_begin(rctx, rquery);
- LIST_ADDTAIL(&rquery->list, &rctx->active_query_list);
+
+ if (r600_is_timer_query(rquery->type)) {
+ LIST_ADDTAIL(&rquery->list, &rctx->active_timer_queries);
+ } else {
+ LIST_ADDTAIL(&rquery->list, &rctx->active_nontimer_queries);
+ }
}
static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
@@ -525,23 +546,45 @@ static void r600_render_condition(struct pipe_context *ctx,
}
}
-void r600_suspend_queries(struct r600_context *ctx)
+void r600_suspend_nontimer_queries(struct r600_context *ctx)
{
struct r600_query *query;
- LIST_FOR_EACH_ENTRY(query, &ctx->active_query_list, list) {
+ LIST_FOR_EACH_ENTRY(query, &ctx->active_nontimer_queries, list) {
r600_emit_query_end(ctx, query);
}
- assert(ctx->num_cs_dw_queries_suspend == 0);
+ assert(ctx->num_cs_dw_nontimer_queries_suspend == 0);
+}
+
+void r600_resume_nontimer_queries(struct r600_context *ctx)
+{
+ struct r600_query *query;
+
+ assert(ctx->num_cs_dw_nontimer_queries_suspend == 0);
+
+ LIST_FOR_EACH_ENTRY(query, &ctx->active_nontimer_queries, list) {
+ r600_emit_query_begin(ctx, query);
+ }
+}
+
+void r600_suspend_timer_queries(struct r600_context *ctx)
+{
+ struct r600_query *query;
+
+ LIST_FOR_EACH_ENTRY(query, &ctx->active_timer_queries, list) {
+ r600_emit_query_end(ctx, query);
+ }
+
+ assert(ctx->num_cs_dw_timer_queries_suspend == 0);
}
-void r600_resume_queries(struct r600_context *ctx)
+void r600_resume_timer_queries(struct r600_context *ctx)
{
struct r600_query *query;
- assert(ctx->num_cs_dw_queries_suspend == 0);
+ assert(ctx->num_cs_dw_timer_queries_suspend == 0);
- LIST_FOR_EACH_ENTRY(query, &ctx->active_query_list, list) {
+ LIST_FOR_EACH_ENTRY(query, &ctx->active_timer_queries, list) {
r600_emit_query_begin(ctx, query);
}
}