r600g: add HUD queries for shaders created and compiler invocations

for easy review, it is based on these commits for radeonsi:

70f5e49ba5ca8eb063a0d7db94fbef1585b21b2d
30a7e0c021c3a77c20c6f041dc80b7dc90ad238f

it is my first patch and I don't have commit access
tested on a richland apu with wine

thanks to all developers for this wonderful library
Trek  -  http://www.trek.eu.org/devel

---
 src/gallium/drivers/r600/r600_state_common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/r600/r600_state_common.c 
b/src/gallium/drivers/r600/r600_state_common.c
index 60490b0..12d06c1 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -790,6 +790,7 @@ static int r600_shader_select(struct pipe_context *ctx,
        }
 
        if (unlikely(!shader)) {
+               struct r600_context *rctx = (struct r600_context *)ctx;
                shader = CALLOC(1, sizeof(struct r600_pipe_shader));
                shader->selector = sel;
 
@@ -813,6 +814,7 @@ static int r600_shader_select(struct pipe_context *ctx,
 
                memcpy(&shader->key, &key, sizeof(key));
                sel->num_shaders++;
+               p_atomic_inc(&rctx->screen->b.num_compilations);
        }
 
        if (dirty)
@@ -828,6 +830,7 @@ static void *r600_create_shader_state(struct pipe_context 
*ctx,
                               const struct pipe_shader_state *state,
                               unsigned pipe_shader_type)
 {
+       struct r600_context *rctx = (struct r600_context *)ctx;
        struct r600_pipe_shader_selector *sel = 
CALLOC_STRUCT(r600_pipe_shader_selector);
        int i;
 
@@ -835,6 +838,7 @@ static void *r600_create_shader_state(struct pipe_context 
*ctx,
        sel->tokens = tgsi_dup_tokens(state->tokens);
        sel->so = state->stream_output;
        tgsi_scan_shader(state->tokens, &sel->info);
+       p_atomic_inc(&rctx->screen->b.num_shaders_created);
 
        switch (pipe_shader_type) {
        case PIPE_SHADER_GEOMETRY:
-- 
2.1.4
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to