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 <charmainel@vmware.com>
This commit is contained in:
Brian Paul
2016-04-15 15:30:34 -06:00
parent b87856d25d
commit 464d6080c6
7 changed files with 29 additions and 12 deletions

View File

@@ -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 */

View File

@@ -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,

View File

@@ -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--;
}

View File

@@ -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;

View File

@@ -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--;
}

View File

@@ -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

View File

@@ -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 )