radeonsi: add a driver query for counting CP DMA calls
authorMarek Olšák <marek.olsak@amd.com>
Thu, 27 Oct 2016 23:55:17 +0000 (01:55 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 1 Nov 2016 21:33:13 +0000 (22:33 +0100)
CP DMA calls are synchronous with regard to shaders, but can be made
asynchronous if needed.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeon/r600_query.c
src/gallium/drivers/radeon/r600_query.h
src/gallium/drivers/radeonsi/si_cp_dma.c

index 9356274791a20941a9552c12e82819d15b1467b4..a33e290fabba46ca063eabd4a6a9d4755b8dc1d0 100644 (file)
@@ -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;
index 9c9694a1cf485975f5b85dfb1e3d3237e1838140..0e4270a58cf1beab2e2d21c372360cff61fbe1a8 100644 (file)
@@ -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),
index 0e14753754c62095f5e90027bd8f6658b7bebd74..2ff586ac11d936ce3f81bb1ce75e24ef60bbd536 100644 (file)
@@ -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,
index 6667ae302b403ac07b7ae40505e6d4200875ee6b..58093177b93e92de7115f6b4b4abb091c2e46206 100644 (file)
@@ -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)