diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-09-15 15:58:36 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2016-09-29 11:14:51 +0200 |
commit | 2c9d546402a4e3fb55bc3a01a5843dfca82b4a6a (patch) | |
tree | ac61c71e75bfa2260386a1318c63b5e55415af95 /src/gallium/drivers/radeon | |
parent | daeab0171dda1ce477ba34eb52576bda638f98df (diff) |
gallium/radeon: zero all query buffers
To ensure that fences are properly initialized.
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_query.c | 26 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_query.h | 2 |
2 files changed, 11 insertions, 17 deletions
diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index c1c359990bd..d96f9fcb1fd 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -338,11 +338,9 @@ static struct r600_resource *r600_new_query_buffer(struct r600_common_context *c if (!buf) return NULL; - if (query->flags & R600_QUERY_HW_FLAG_PREDICATE) { - if (!query->ops->prepare_buffer(ctx, query, buf)) { - r600_resource_reference(&buf, NULL); - return NULL; - } + if (!query->ops->prepare_buffer(ctx, query, buf)) { + r600_resource_reference(&buf, NULL); + return NULL; } return buf; @@ -440,7 +438,6 @@ static struct pipe_query *r600_query_hw_create(struct r600_common_context *rctx, query->result_size += 16; /* for the fence + alignment */ query->num_cs_dw_begin = 6; query->num_cs_dw_end = 6 + r600_gfx_write_fence_dwords(rctx->screen); - query->flags |= R600_QUERY_HW_FLAG_PREDICATE; break; case PIPE_QUERY_TIME_ELAPSED: query->result_size = 24; @@ -461,7 +458,6 @@ static struct pipe_query *r600_query_hw_create(struct r600_common_context *rctx, query->num_cs_dw_begin = 6; query->num_cs_dw_end = 6; query->stream = index; - query->flags |= R600_QUERY_HW_FLAG_PREDICATE; break; case PIPE_QUERY_PIPELINE_STATISTICS: /* 11 values on EG, 8 on R600. */ @@ -793,16 +789,14 @@ void r600_query_hw_reset_buffers(struct r600_common_context *rctx, query->buffer.results_end = 0; query->buffer.previous = NULL; - if (query->flags & R600_QUERY_HW_FLAG_PREDICATE) { - /* Obtain a new buffer if the current one can't be mapped without a stall. */ - if (r600_rings_is_buffer_referenced(rctx, query->buffer.buf->buf, RADEON_USAGE_READWRITE) || - !rctx->ws->buffer_wait(query->buffer.buf->buf, 0, RADEON_USAGE_READWRITE)) { + /* Obtain a new buffer if the current one can't be mapped without a stall. */ + if (r600_rings_is_buffer_referenced(rctx, query->buffer.buf->buf, RADEON_USAGE_READWRITE) || + !rctx->ws->buffer_wait(query->buffer.buf->buf, 0, RADEON_USAGE_READWRITE)) { + r600_resource_reference(&query->buffer.buf, NULL); + query->buffer.buf = r600_new_query_buffer(rctx, query); + } else { + if (!query->ops->prepare_buffer(rctx, query, query->buffer.buf)) r600_resource_reference(&query->buffer.buf, NULL); - query->buffer.buf = r600_new_query_buffer(rctx, query); - } else { - if (!query->ops->prepare_buffer(rctx, query, query->buffer.buf)) - r600_resource_reference(&query->buffer.buf, NULL); - } } } diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h index 4f5aa3ac1bf..8c637a547fb 100644 --- a/src/gallium/drivers/radeon/r600_query.h +++ b/src/gallium/drivers/radeon/r600_query.h @@ -99,7 +99,7 @@ struct r600_query { enum { R600_QUERY_HW_FLAG_NO_START = (1 << 0), - R600_QUERY_HW_FLAG_PREDICATE = (1 << 1), + /* gap */ /* whether begin_query doesn't clear the result */ R600_QUERY_HW_FLAG_BEGIN_RESUMES = (1 << 2), }; |