From 315eb0acb48a30f9a8defa73a78055e441b5ee6c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 28 Oct 2016 01:55:17 +0200 Subject: [PATCH] radeonsi: add a driver query for counting CP DMA calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit CP DMA calls are synchronous with regard to shaders, but can be made asynchronous if needed. Reviewed-by: Nicolai Hähnle --- src/gallium/drivers/radeon/r600_pipe_common.h | 1 + src/gallium/drivers/radeon/r600_query.c | 7 +++++++ src/gallium/drivers/radeon/r600_query.h | 1 + src/gallium/drivers/radeonsi/si_cp_dma.c | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 9356274791a..a33e290fabb 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -570,6 +570,7 @@ struct r600_common_context { unsigned num_compute_calls; unsigned num_spill_compute_calls; unsigned num_dma_calls; + unsigned num_cp_dma_calls; unsigned num_vs_flushes; unsigned num_ps_flushes; unsigned num_cs_flushes; diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 9c9694a1cf4..0e4270a58cf 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -101,6 +101,9 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx, case R600_QUERY_DMA_CALLS: query->begin_result = rctx->num_dma_calls; break; + case R600_QUERY_CP_DMA_CALLS: + query->begin_result = rctx->num_cp_dma_calls; + break; case R600_QUERY_NUM_VS_FLUSHES: query->begin_result = rctx->num_vs_flushes; break; @@ -182,6 +185,9 @@ static bool r600_query_sw_end(struct r600_common_context *rctx, case R600_QUERY_DMA_CALLS: query->end_result = rctx->num_dma_calls; break; + case R600_QUERY_CP_DMA_CALLS: + query->end_result = rctx->num_cp_dma_calls; + break; case R600_QUERY_NUM_VS_FLUSHES: query->end_result = rctx->num_vs_flushes; break; @@ -1655,6 +1661,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = { X("compute-calls", COMPUTE_CALLS, UINT64, AVERAGE), X("spill-compute-calls", SPILL_COMPUTE_CALLS, UINT64, AVERAGE), X("dma-calls", DMA_CALLS, UINT64, AVERAGE), + X("cp-dma-calls", CP_DMA_CALLS, UINT64, AVERAGE), X("num-vs-flushes", NUM_VS_FLUSHES, UINT64, AVERAGE), X("num-ps-flushes", NUM_PS_FLUSHES, UINT64, AVERAGE), X("num-cs-flushes", NUM_CS_FLUSHES, UINT64, AVERAGE), diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h index 0e14753754c..2ff586ac11d 100644 --- a/src/gallium/drivers/radeon/r600_query.h +++ b/src/gallium/drivers/radeon/r600_query.h @@ -48,6 +48,7 @@ enum { R600_QUERY_COMPUTE_CALLS, R600_QUERY_SPILL_COMPUTE_CALLS, R600_QUERY_DMA_CALLS, + R600_QUERY_CP_DMA_CALLS, R600_QUERY_NUM_VS_FLUSHES, R600_QUERY_NUM_PS_FLUSHES, R600_QUERY_NUM_CS_FLUSHES, diff --git a/src/gallium/drivers/radeonsi/si_cp_dma.c b/src/gallium/drivers/radeonsi/si_cp_dma.c index 6667ae302b4..58093177b93 100644 --- a/src/gallium/drivers/radeonsi/si_cp_dma.c +++ b/src/gallium/drivers/radeonsi/si_cp_dma.c @@ -214,6 +214,8 @@ static void si_clear_buffer(struct pipe_context *ctx, struct pipe_resource *dst, if (tc_l2_flag) r600_resource(dst)->TC_L2_dirty = true; + + sctx->b.num_cp_dma_calls++; } /** @@ -338,6 +340,8 @@ void si_copy_buffer(struct si_context *sctx, if (tc_l2_flag) r600_resource(dst)->TC_L2_dirty = true; + + sctx->b.num_cp_dma_calls++; } void si_init_cp_dma_functions(struct si_context *sctx) -- 2.30.2