[Mesa-dev] [PATCH] svga: separate HUD counters for state objects
Charmaine Lee
charmainel at vmware.com
Sat Apr 16 03:11:13 UTC 2016
Reviewed-by: Charmaine Lee <charmainel at vmware.com>
________________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Friday, April 15, 2016 2:41 PM
To: mesa-dev at lists.freedesktop.org
Cc: Charmaine Lee
Subject: [PATCH] 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.
---
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(-)
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index ead47c0..b485485 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 0ba9313..9a4fcc3 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 c5d83c3..9ebb5d4 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 75bc9ce..4a06647 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -1164,7 +1164,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 d397c95..968770c 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 3e778f0..f1bb82a 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 b932c56..99757e4 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 )
--
1.9.1
More information about the mesa-dev
mailing list