diff options
author | Vadim Girlin <[email protected]> | 2011-07-04 18:30:40 +0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2011-07-05 15:57:06 -0400 |
commit | fbe9d4261f94b8a22ae04dccb8201a6762b66d40 (patch) | |
tree | c739c99e1a14299df6c5e3632df5c50fec83395c /src/gallium/winsys/r600 | |
parent | 9bf4c30d73f5066db094fa9e72e6c4de7d6f9596 (diff) |
r600g: reduce flushes for queries
Diffstat (limited to 'src/gallium/winsys/r600')
-rw-r--r-- | src/gallium/winsys/r600/drm/r600_hw_context.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index c98a1b15701..e3fb6b18394 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -1565,7 +1565,7 @@ void r600_context_flush(struct r600_context *ctx) r600_init_cs(ctx); /* resume queries */ - r600_context_queries_resume(ctx); + r600_context_queries_resume(ctx, TRUE); /* set all valid group as dirty so they get reemited on * next draw command @@ -1741,7 +1741,8 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) /* if query buffer is full force a flush */ if (query->num_results*4 >= query->buffer_size - 16) { - r600_context_flush(ctx); + if (!(query->state & R600_QUERY_STATE_FLUSHED)) + r600_context_flush(ctx); r600_query_result(ctx, query, TRUE); } @@ -1809,6 +1810,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) query->num_results += 4 * (query->type == PIPE_QUERY_OCCLUSION_COUNTER ? ctx->max_db : 1); query->state ^= R600_QUERY_STATE_STARTED; query->state |= R600_QUERY_STATE_ENDED; + query->state &= ~R600_QUERY_STATE_FLUSHED; ctx->num_query_running--; } @@ -1877,7 +1879,7 @@ boolean r600_context_query_result(struct r600_context *ctx, { uint64_t *result = (uint64_t*)vresult; - if (query->num_results) { + if (query->num_results && !(query->state & R600_QUERY_STATE_FLUSHED)) { r600_context_flush(ctx); } if (!r600_query_result(ctx, query, wait)) @@ -1902,7 +1904,7 @@ void r600_context_queries_suspend(struct r600_context *ctx) } } -void r600_context_queries_resume(struct r600_context *ctx) +void r600_context_queries_resume(struct r600_context *ctx, boolean flushed) { struct r600_query *query; @@ -1910,6 +1912,7 @@ void r600_context_queries_resume(struct r600_context *ctx) if (query->state & R600_QUERY_STATE_SUSPENDED) { r600_query_begin(ctx, query); query->state ^= R600_QUERY_STATE_SUSPENDED; - } + } else if (flushed && query->state==R600_QUERY_STATE_ENDED) + query->state |= R600_QUERY_STATE_FLUSHED; } } |