radeonsi: add a HUD query for draw calls with primitive restart
authorMarek Olšák <marek.olsak@amd.com>
Mon, 24 Apr 2017 10:10:24 +0000 (12:10 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 28 Apr 2017 19:47:35 +0000 (21:47 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.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_state_draw.c

index fbd0ac7e16c295e6d37c6a39c007cfcd9d8f1b3c..3e83d371b6e7548b10d64bbbc599898820524b52 100644 (file)
@@ -580,6 +580,7 @@ struct r600_common_context {
        unsigned                        num_cs_dw_queries_suspend;
        /* Misc stats. */
        unsigned                        num_draw_calls;
+       unsigned                        num_prim_restart_calls;
        unsigned                        num_spill_draw_calls;
        unsigned                        num_compute_calls;
        unsigned                        num_spill_compute_calls;
index 0980eca7884cfedf312bd8fad141e574fda8f5d9..cbf4bbac3e4779d933789ad905ea2eecb8376e4f 100644 (file)
@@ -97,6 +97,9 @@ static bool r600_query_sw_begin(struct r600_common_context *rctx,
        case R600_QUERY_DRAW_CALLS:
                query->begin_result = rctx->num_draw_calls;
                break;
+       case R600_QUERY_PRIM_RESTART_CALLS:
+               query->begin_result = rctx->num_prim_restart_calls;
+               break;
        case R600_QUERY_SPILL_DRAW_CALLS:
                query->begin_result = rctx->num_spill_draw_calls;
                break;
@@ -221,6 +224,9 @@ static bool r600_query_sw_end(struct r600_common_context *rctx,
        case R600_QUERY_DRAW_CALLS:
                query->end_result = rctx->num_draw_calls;
                break;
+       case R600_QUERY_PRIM_RESTART_CALLS:
+               query->end_result = rctx->num_prim_restart_calls;
+               break;
        case R600_QUERY_SPILL_DRAW_CALLS:
                query->end_result = rctx->num_spill_draw_calls;
                break;
@@ -1761,6 +1767,7 @@ static struct pipe_driver_query_info r600_driver_query_list[] = {
        X("num-shaders-created",        NUM_SHADERS_CREATED,    UINT64, CUMULATIVE),
        X("num-shader-cache-hits",      NUM_SHADER_CACHE_HITS,  UINT64, CUMULATIVE),
        X("draw-calls",                 DRAW_CALLS,             UINT64, AVERAGE),
+       X("prim-restart-calls",         PRIM_RESTART_CALLS,     UINT64, AVERAGE),
        X("spill-draw-calls",           SPILL_DRAW_CALLS,       UINT64, AVERAGE),
        X("compute-calls",              COMPUTE_CALLS,          UINT64, AVERAGE),
        X("spill-compute-calls",        SPILL_COMPUTE_CALLS,    UINT64, AVERAGE),
index b9ab44ca3f757ea814fd39ef75466a70b5a9f043..05aceb72839e799257f49e455b1d68656b229dd3 100644 (file)
@@ -44,6 +44,7 @@ struct r600_resource;
 
 enum {
        R600_QUERY_DRAW_CALLS = PIPE_QUERY_DRIVER_SPECIFIC,
+       R600_QUERY_PRIM_RESTART_CALLS,
        R600_QUERY_SPILL_DRAW_CALLS,
        R600_QUERY_COMPUTE_CALLS,
        R600_QUERY_SPILL_COMPUTE_CALLS,
index 2d5a08e878af1dfb5710f20563c2bb17dee6621f..e6a9ee0d1992573821cc85c982071d929c741c43 100644 (file)
@@ -1396,6 +1396,8 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 
        pipe_resource_reference(&ib_tmp.buffer, NULL);
        sctx->b.num_draw_calls++;
+       if (info->primitive_restart)
+               sctx->b.num_prim_restart_calls++;
        if (G_0286E8_WAVESIZE(sctx->spi_tmpring_size))
                sctx->b.num_spill_draw_calls++;
 }