mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 13:00:21 +01:00
r600g: reduce flushes for queries
This commit is contained in:
parent
9bf4c30d73
commit
fbe9d4261f
4 changed files with 12 additions and 11 deletions
|
|
@ -228,6 +228,7 @@ struct r600_query {
|
|||
#define R600_QUERY_STATE_STARTED (1 << 0)
|
||||
#define R600_QUERY_STATE_ENDED (1 << 1)
|
||||
#define R600_QUERY_STATE_SUSPENDED (1 << 2)
|
||||
#define R600_QUERY_STATE_FLUSHED (1 << 3)
|
||||
|
||||
#define R600_CONTEXT_DRAW_PENDING (1 << 0)
|
||||
#define R600_CONTEXT_DST_CACHES_DIRTY (1 << 1)
|
||||
|
|
@ -294,7 +295,7 @@ boolean r600_context_query_result(struct r600_context *ctx,
|
|||
void r600_query_begin(struct r600_context *ctx, struct r600_query *query);
|
||||
void r600_query_end(struct r600_context *ctx, struct r600_query *query);
|
||||
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);
|
||||
void r600_query_predication(struct r600_context *ctx, struct r600_query *query, int operation,
|
||||
int flag_wait);
|
||||
void r600_context_emit_fence(struct r600_context *ctx, struct r600_bo *fence,
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ static void r600_blitter_end(struct pipe_context *ctx)
|
|||
rctx->saved_render_cond_mode);
|
||||
rctx->saved_render_cond = NULL;
|
||||
}
|
||||
r600_context_queries_resume(&rctx->ctx);
|
||||
r600_context_queries_resume(&rctx->ctx, FALSE);
|
||||
rctx->blit = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,10 +61,7 @@ static boolean r600_get_query_result(struct pipe_context *ctx,
|
|||
struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
|
||||
struct r600_query *rquery = (struct r600_query *)query;
|
||||
|
||||
if (rquery->num_results) {
|
||||
ctx->flush(ctx, NULL);
|
||||
}
|
||||
return r600_context_query_result(&rctx->ctx, (struct r600_query *)query, wait, vresult);
|
||||
return r600_context_query_result(&rctx->ctx, rquery, wait, vresult);
|
||||
}
|
||||
|
||||
static void r600_render_condition(struct pipe_context *ctx,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue