diff options
author | Marek Olšák <[email protected]> | 2012-07-05 20:06:41 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-08-15 19:20:58 +0200 |
commit | 44f14ebd7b9ba7186342039d2602fdd6ea5077f5 (patch) | |
tree | d254c299e3e40d31079d0604f4c86f5d440b351f /src/gallium/drivers/r600/r600_query.c | |
parent | 1932bc8aaeb59287a7f769b0cb9a55f49dd6d553 (diff) |
r600g: implement timestamp query and get_timestamp hook
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_query.c')
-rw-r--r-- | src/gallium/drivers/r600/r600_query.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 90b7a66d614..440b8c9d186 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -69,6 +69,7 @@ static struct r600_resource *r600_new_query_buffer(struct r600_context *ctx, uns ctx->ws->buffer_unmap(buf->cs_buf); break; case PIPE_QUERY_TIME_ELAPSED: + case PIPE_QUERY_TIMESTAMP: break; case PIPE_QUERY_PRIMITIVES_EMITTED: case PIPE_QUERY_PRIMITIVES_GENERATED: @@ -174,6 +175,8 @@ static void r600_emit_query_end(struct r600_context *ctx, struct r600_query *que break; case PIPE_QUERY_TIME_ELAPSED: va += query->buffer.results_end + query->result_size/2; + /* fall through */ + case PIPE_QUERY_TIMESTAMP: cs->buf[cs->cdw++] = PKT3(PKT3_EVENT_WRITE_EOP, 4, 0); cs->buf[cs->cdw++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT) | EVENT_INDEX(5); cs->buf[cs->cdw++] = va; @@ -267,6 +270,10 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q query->result_size = 16; query->num_cs_dw = 8; break; + case PIPE_QUERY_TIMESTAMP: + query->result_size = 8; + query->num_cs_dw = 8; + break; case PIPE_QUERY_PRIMITIVES_EMITTED: case PIPE_QUERY_PRIMITIVES_GENERATED: case PIPE_QUERY_SO_STATISTICS: @@ -435,6 +442,13 @@ static boolean r600_get_query_buffer_result(struct r600_context *ctx, results_base += query->result_size; } break; + case PIPE_QUERY_TIMESTAMP: + { + uint32_t *current_result = (uint32_t*)map; + result->u64 = (uint64_t)current_result[0] | + (uint64_t)current_result[1] << 32; + break; + } case PIPE_QUERY_PRIMITIVES_EMITTED: /* SAMPLE_STREAMOUTSTATS stores this structure: * { @@ -498,7 +512,8 @@ static boolean r600_get_query_result(struct pipe_context *ctx, } /* Convert the time to expected units. */ - if (rquery->type == PIPE_QUERY_TIME_ELAPSED) { + if (rquery->type == PIPE_QUERY_TIME_ELAPSED || + rquery->type == PIPE_QUERY_TIMESTAMP) { result->u64 = (1000000 * result->u64) / rctx->screen->info.r600_clock_crystal_freq; } return TRUE; |