svga: separate HUD counters for state objects
authorBrian Paul <brianp@vmware.com>
Fri, 15 Apr 2016 21:30:34 +0000 (15:30 -0600)
committerBrian Paul <brianp@vmware.com>
Mon, 25 Apr 2016 15:45:16 +0000 (09:45 -0600)
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>
src/gallium/drivers/svga/svga_context.h
src/gallium/drivers/svga/svga_pipe_blend.c
src/gallium/drivers/svga/svga_pipe_depthstencil.c
src/gallium/drivers/svga/svga_pipe_query.c
src/gallium/drivers/svga/svga_pipe_rasterizer.c
src/gallium/drivers/svga/svga_pipe_sampler.c
src/gallium/drivers/svga/svga_pipe_vertex.c

index ead47c07980ada79d71922a6d52ebe852d6f8922..b485485f0be84502475a0757dd2ca5860febe392 100644 (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 */
index 0ba9313fd5e3f8b3fe7306961a452080112b2adf..9a4fcc35d380456e92083c63987a86cd4d06a29e 100644 (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,
index c5d83c33f2905640eb68e3bb8a7014f417801aed..9ebb5d4b40564fef6aaf8f04749f386f08d478ba 100644 (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--;
 }
 
 
index 05b756a71c7f33845a7e45d8dbc53ada1e7cb1fb..c7eb3f63e584bf92c2205738d506d0b096ecf841 100644 (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;
index d397c95da98cd92e24fb7f1c156bb552f7e42ca5..968770c6faa9fe40b177b38488321341e8a64077 100644 (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--;
 }
 
 
index 3e778f0a087952a3e6ca46d373672f45cb73c681..f1bb82a905bb719d91ea206bbfe28bc6a88a2317 100644 (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
index b932c568f539d8be0811b2ad0d4de4975cb82943..99757e4e1358addebc17b2948274b4b0db0a0b6d 100644 (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 )