diff options
author | Marek Olšák <[email protected]> | 2012-03-29 16:45:44 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-03-30 17:12:52 +0200 |
commit | ead0a89c9661135d66e086bbe524f9623b00af5b (patch) | |
tree | c13b788e6ce682dba5887f925853a7d23991405d | |
parent | 6d73382afc1d2a5e5815d0e6e7f39e0bf8138002 (diff) |
r600g: cleanup after get_query_result change
Finally, union r600_query_result can be removed.
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 6 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_query.c | 38 |
2 files changed, 9 insertions, 35 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index e77e185dd1c..60b5694a6df 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -167,12 +167,6 @@ struct r600_query_buffer { struct r600_query_buffer *previous; }; -union r600_query_result { - uint64_t u64; - boolean b; - struct pipe_query_data_so_statistics so; -}; - struct r600_query { /* The query buffer and how many results are in it. */ struct r600_query_buffer buffer; diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 8a7c7e30738..8cf78905e3d 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -401,7 +401,7 @@ static boolean r600_get_query_buffer_result(struct r600_context *ctx, struct r600_query *query, struct r600_query_buffer *qbuf, boolean wait, - union r600_query_result *result) + union pipe_query_result *result) { unsigned results_base = 0; char *map; @@ -458,9 +458,9 @@ static boolean r600_get_query_buffer_result(struct r600_context *ctx, break; case PIPE_QUERY_SO_STATISTICS: while (results_base != qbuf->results_end) { - result->so.num_primitives_written += + result->so_statistics.num_primitives_written += r600_query_read_result(map + results_base, 2, 6, true); - result->so.primitives_storage_needed += + result->so_statistics.primitives_storage_needed += r600_query_read_result(map + results_base, 0, 4, true); results_base += query->result_size; } @@ -483,43 +483,23 @@ static boolean r600_get_query_buffer_result(struct r600_context *ctx, static boolean r600_get_query_result(struct pipe_context *ctx, struct pipe_query *query, - boolean wait, union pipe_query_result *vresult) + boolean wait, union pipe_query_result *result) { struct r600_context *rctx = (struct r600_context *)ctx; struct r600_query *rquery = (struct r600_query *)query; - boolean *result_b = (boolean*)vresult; - uint64_t *result_u64 = (uint64_t*)vresult; - union r600_query_result result; - struct pipe_query_data_so_statistics *result_so = - (struct pipe_query_data_so_statistics*)vresult; struct r600_query_buffer *qbuf; - memset(&result, 0, sizeof(result)); + util_query_clear_result(result, rquery->type); for (qbuf = &rquery->buffer; qbuf; qbuf = qbuf->previous) { - if (!r600_get_query_buffer_result(rctx, rquery, qbuf, wait, &result)) { + if (!r600_get_query_buffer_result(rctx, rquery, qbuf, wait, result)) { return FALSE; } } - switch (rquery->type) { - case PIPE_QUERY_OCCLUSION_COUNTER: - case PIPE_QUERY_PRIMITIVES_EMITTED: - case PIPE_QUERY_PRIMITIVES_GENERATED: - *result_u64 = result.u64; - break; - case PIPE_QUERY_OCCLUSION_PREDICATE: - case PIPE_QUERY_SO_OVERFLOW_PREDICATE: - *result_b = result.b; - break; - case PIPE_QUERY_TIME_ELAPSED: - *result_u64 = (1000000 * result.u64) / rctx->screen->info.r600_clock_crystal_freq; - break; - case PIPE_QUERY_SO_STATISTICS: - *result_so = result.so; - break; - default: - assert(0); + /* Convert the time to expected units. */ + if (rquery->type == PIPE_QUERY_TIME_ELAPSED) { + result->u64 = (1000000 * result->u64) / rctx->screen->info.r600_clock_crystal_freq; } return TRUE; } |