From 464d6080c60e6f97d286b16f5b09fde94ab37cfc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 15 Apr 2016 15:30:34 -0600 Subject: svga: separate HUD counters for state objects Count depth/stencil, blend, sampler, etc. state objects separately but just report the sum for the HUD. This change lets us use gdb to see the breakdown of state objects in more detail. Also, count sampler views too. Reviewed-by: Charmaine Lee --- src/gallium/drivers/svga/svga_context.h | 10 +++++++++- src/gallium/drivers/svga/svga_pipe_blend.c | 4 ++-- src/gallium/drivers/svga/svga_pipe_depthstencil.c | 4 ++-- src/gallium/drivers/svga/svga_pipe_query.c | 7 ++++++- src/gallium/drivers/svga/svga_pipe_rasterizer.c | 4 ++-- src/gallium/drivers/svga/svga_pipe_sampler.c | 8 ++++++-- src/gallium/drivers/svga/svga_pipe_vertex.c | 4 ++-- 7 files changed, 29 insertions(+), 12 deletions(-) (limited to 'src/gallium/drivers/svga') diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index ead47c07980..b485485f0be 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -519,7 +519,15 @@ struct svga_context uint64_t num_const_buf_updates; /**< SVGA_QUERY_NUM_CONST_BUF_UPDATES */ uint64_t num_const_updates; /**< SVGA_QUERY_NUM_CONST_UPDATES */ uint64_t num_shaders; /**< SVGA_QUERY_NUM_SHADERS */ - uint64_t num_state_objects; /**< SVGA_QUERY_NUM_STATE_OBJECTS */ + + /** The following are summed for SVGA_QUERY_NUM_STATE_OBJECTS */ + uint64_t num_blend_objects; + uint64_t num_depthstencil_objects; + uint64_t num_rasterizer_objects; + uint64_t num_sampler_objects; + uint64_t num_samplerview_objects; + uint64_t num_vertexelement_objects; + uint64_t num_surface_views; /**< SVGA_QUERY_NUM_SURFACE_VIEWS */ uint64_t num_bytes_uploaded; /**< SVGA_QUERY_NUM_BYTES_UPLOADED */ uint64_t num_generate_mipmap; /**< SVGA_QUERY_NUM_GENERATE_MIPMAP */ diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c b/src/gallium/drivers/svga/svga_pipe_blend.c index 0ba9313fd5e..9a4fcc35d38 100644 --- a/src/gallium/drivers/svga/svga_pipe_blend.c +++ b/src/gallium/drivers/svga/svga_pipe_blend.c @@ -333,7 +333,7 @@ svga_create_blend_state(struct pipe_context *pipe, define_blend_state_object(svga, blend); } - svga->hud.num_state_objects++; + svga->hud.num_blend_objects++; return blend; } @@ -373,7 +373,7 @@ static void svga_delete_blend_state(struct pipe_context *pipe, } FREE(blend); - svga->hud.num_state_objects--; + svga->hud.num_blend_objects--; } static void svga_set_blend_color( struct pipe_context *pipe, diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c b/src/gallium/drivers/svga/svga_pipe_depthstencil.c index c5d83c33f29..9ebb5d4b405 100644 --- a/src/gallium/drivers/svga/svga_pipe_depthstencil.c +++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c @@ -205,7 +205,7 @@ svga_create_depth_stencil_state(struct pipe_context *pipe, define_depth_stencil_state_object(svga, ds); } - svga->hud.num_state_objects++; + svga->hud.num_depthstencil_objects++; return ds; } @@ -253,7 +253,7 @@ static void svga_delete_depth_stencil_state(struct pipe_context *pipe, } FREE(depth_stencil); - svga->hud.num_state_objects--; + svga->hud.num_depthstencil_objects--; } diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 05b756a71c7..c7eb3f63e58 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -1165,7 +1165,12 @@ svga_get_query_result(struct pipe_context *pipe, vresult->u64 = svgascreen->hud.num_resources; break; case SVGA_QUERY_NUM_STATE_OBJECTS: - vresult->u64 = svga->hud.num_state_objects; + vresult->u64 = (svga->hud.num_blend_objects + + svga->hud.num_depthstencil_objects + + svga->hud.num_rasterizer_objects + + svga->hud.num_sampler_objects + + svga->hud.num_samplerview_objects + + svga->hud.num_vertexelement_objects); break; case SVGA_QUERY_NUM_SURFACE_VIEWS: vresult->u64 = svga->hud.num_surface_views; diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c index d397c95da98..968770c6faa 100644 --- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -360,7 +360,7 @@ svga_create_rasterizer_state(struct pipe_context *pipe, "GL_POLYGON_SMOOTH not supported"); } - svga->hud.num_state_objects++; + svga->hud.num_rasterizer_objects++; return rast; } @@ -405,7 +405,7 @@ svga_delete_rasterizer_state(struct pipe_context *pipe, void *state) } FREE(state); - svga->hud.num_state_objects--; + svga->hud.num_rasterizer_objects--; } diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 3e778f0a087..f1bb82a905b 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -273,7 +273,7 @@ svga_create_sampler_state(struct pipe_context *pipe, cso->min_lod, cso->view_min_lod, cso->view_max_lod, cso->mipfilter == SVGA3D_TEX_FILTER_NONE ? "SVGA3D_TEX_FILTER_NONE" : "SOMETHING"); - svga->hud.num_state_objects++; + svga->hud.num_sampler_objects++; return cso; } @@ -338,7 +338,7 @@ static void svga_delete_sampler_state(struct pipe_context *pipe, } FREE(sampler); - svga->hud.num_state_objects--; + svga->hud.num_sampler_objects--; } @@ -347,6 +347,7 @@ svga_create_sampler_view(struct pipe_context *pipe, struct pipe_resource *texture, const struct pipe_sampler_view *templ) { + struct svga_context *svga = svga_context(pipe); struct svga_pipe_sampler_view *sv = CALLOC_STRUCT(svga_pipe_sampler_view); if (!sv) { @@ -361,6 +362,8 @@ svga_create_sampler_view(struct pipe_context *pipe, sv->base.context = pipe; sv->id = SVGA3D_INVALID_ID; + svga->hud.num_samplerview_objects++; + return &sv->base; } @@ -400,6 +403,7 @@ svga_sampler_view_destroy(struct pipe_context *pipe, pipe_resource_reference(&sv->base.texture, NULL); FREE(sv); + svga->hud.num_samplerview_objects--; } static void diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c index b932c568f53..99757e4e135 100644 --- a/src/gallium/drivers/svga/svga_pipe_vertex.c +++ b/src/gallium/drivers/svga/svga_pipe_vertex.c @@ -275,7 +275,7 @@ svga_create_vertex_elements_state(struct pipe_context *pipe, } } - svga->hud.num_state_objects++; + svga->hud.num_vertexelement_objects++; return velems; } @@ -318,7 +318,7 @@ svga_delete_vertex_elements_state(struct pipe_context *pipe, void *state) } FREE(velems); - svga->hud.num_state_objects--; + svga->hud.num_vertexelement_objects--; } void svga_cleanup_vertex_state( struct svga_context *svga ) -- cgit v1.2.3