svga: add guest statistic gathering interface
[mesa.git] / src / gallium / drivers / svga / svga_swtnl_state.c
index 4d21f4f0e6029bf238e11c7bbe7895f31dc9b037..db41f3cdab0083b1816cc6803294612563283675 100644 (file)
@@ -97,6 +97,8 @@ static enum pipe_error
 update_swtnl_draw( struct svga_context *svga,
                    unsigned dirty )
 {
+   SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_SWTNLUPDATEDRAW);
+
    draw_flush( svga->swtnl.draw );
 
    if (dirty & SVGA_NEW_VS) 
@@ -141,6 +143,7 @@ update_swtnl_draw( struct svga_context *svga,
          (svga->curr.framebuffer.zsbuf) ?
              svga->curr.framebuffer.zsbuf->format : PIPE_FORMAT_NONE);
 
+   SVGA_STATS_TIME_POP(svga_sws(svga));
    return PIPE_OK;
 }
 
@@ -227,6 +230,8 @@ svga_swtnl_update_vdecl( struct svga_context *svga )
    unsigned i;
    int any_change;
 
+   SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_SWTNLUPDATEVDECL);
+
    memset(vinfo, 0, sizeof(*vinfo));
    memset(vdecl, 0, sizeof(vdecl));
 
@@ -299,7 +304,7 @@ svga_swtnl_update_vdecl( struct svga_context *svga )
       enum pipe_error ret;
 
       if (!any_change && svga_render->layout_id != SVGA3D_INVALID_ID) {
-         return PIPE_OK;
+         goto done;
       }
 
       if (svga_render->layout_id != SVGA3D_INVALID_ID) {
@@ -343,13 +348,15 @@ svga_swtnl_update_vdecl( struct svga_context *svga )
    }
    else {
       if (!any_change)
-         return PIPE_OK;
+         goto done;
    }
 
    memcpy(svga_render->vdecl, vdecl, sizeof(vdecl));
    svga->swtnl.new_vdecl = TRUE;
 
-   return 0;
+done:
+   SVGA_STATS_TIME_POP(svga_sws(svga));
+   return PIPE_OK;
 }