aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_context.c2
-rw-r--r--src/gallium/drivers/svga/svga_context.h34
-rw-r--r--src/gallium/drivers/svga/svga_pipe_blend.c3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_depthstencil.c3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_draw.c4
-rw-r--r--src/gallium/drivers/svga/svga_pipe_query.c97
-rw-r--r--src/gallium/drivers/svga/svga_pipe_rasterizer.c3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_vertex.c4
-rw-r--r--src/gallium/drivers/svga/svga_resource_buffer.c17
-rw-r--r--src/gallium/drivers/svga/svga_resource_texture.c27
-rw-r--r--src/gallium/drivers/svga/svga_screen.c19
-rw-r--r--src/gallium/drivers/svga/svga_screen.h8
-rw-r--r--src/gallium/drivers/svga/svga_shader.c3
-rw-r--r--src/gallium/drivers/svga/svga_state.c3
-rw-r--r--src/gallium/drivers/svga/svga_surface.c4
16 files changed, 196 insertions, 38 deletions
diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c
index 2bf795de22d..f8622b96f45 100644
--- a/src/gallium/drivers/svga/svga_context.c
+++ b/src/gallium/drivers/svga/svga_context.c
@@ -312,6 +312,8 @@ void svga_context_flush( struct svga_context *svga,
*/
svga->swc->flush(svga->swc, &fence);
+ svga->hud.num_flushes++;
+
svga_screen_cache_flush(svgascreen, fence);
/* To force the re-emission of rendertargets and texture sampler bindings on
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index e8575f36c3b..bcce18a3502 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -44,10 +44,21 @@
/** Non-GPU queries for gallium HUD */
-#define SVGA_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0)
-#define SVGA_QUERY_FALLBACKS (PIPE_QUERY_DRIVER_SPECIFIC + 1)
-#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 2)
-#define SVGA_QUERY_MAX (PIPE_QUERY_DRIVER_SPECIFIC + 3)
+/* per-frame counters */
+#define SVGA_QUERY_NUM_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0)
+#define SVGA_QUERY_NUM_FALLBACKS (PIPE_QUERY_DRIVER_SPECIFIC + 1)
+#define SVGA_QUERY_NUM_FLUSHES (PIPE_QUERY_DRIVER_SPECIFIC + 2)
+#define SVGA_QUERY_NUM_VALIDATIONS (PIPE_QUERY_DRIVER_SPECIFIC + 3)
+#define SVGA_QUERY_MAP_BUFFER_TIME (PIPE_QUERY_DRIVER_SPECIFIC + 4)
+#define SVGA_QUERY_NUM_RESOURCES_MAPPED (PIPE_QUERY_DRIVER_SPECIFIC + 5)
+/* running total counters */
+#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 6)
+#define SVGA_QUERY_NUM_SHADERS (PIPE_QUERY_DRIVER_SPECIFIC + 7)
+#define SVGA_QUERY_NUM_RESOURCES (PIPE_QUERY_DRIVER_SPECIFIC + 8)
+#define SVGA_QUERY_NUM_STATE_OBJECTS (PIPE_QUERY_DRIVER_SPECIFIC + 9)
+#define SVGA_QUERY_NUM_SURFACE_VIEWS (PIPE_QUERY_DRIVER_SPECIFIC + 10)
+/*SVGA_QUERY_MAX has to be last because it is size of an array*/
+#define SVGA_QUERY_MAX (PIPE_QUERY_DRIVER_SPECIFIC + 11)
/**
* Maximum supported number of constant buffers per shader
@@ -463,9 +474,18 @@ struct svga_context
/** List of buffers with queued transfers */
struct list_head dirty_buffers;
- /** performance / info queries */
- uint64_t num_draw_calls; /**< SVGA_QUERY_DRAW_CALLS */
- uint64_t num_fallbacks; /**< SVGA_QUERY_FALLBACKS */
+ /** performance / info queries for HUD */
+ struct {
+ uint64_t num_draw_calls; /**< SVGA_QUERY_DRAW_CALLS */
+ uint64_t num_fallbacks; /**< SVGA_QUERY_NUM_FALLBACKS */
+ uint64_t num_flushes; /**< SVGA_QUERY_NUM_FLUSHES */
+ uint64_t num_validations; /**< SVGA_QUERY_NUM_VALIDATIONS */
+ uint64_t map_buffer_time; /**< SVGA_QUERY_MAP_BUFFER_TIME */
+ uint64_t num_resources_mapped; /**< SVGA_QUERY_NUM_RESOURCES_MAPPED */
+ uint64_t num_shaders; /**< SVGA_QUERY_NUM_SHADERS */
+ uint64_t num_state_objects; /**< SVGA_QUERY_NUM_STATE_OBJECTS */
+ uint64_t num_surface_views; /**< SVGA_QUERY_NUM_SURFACE_VIEWS */
+ } hud;
/** The currently bound stream output targets */
unsigned num_so_targets;
diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c b/src/gallium/drivers/svga/svga_pipe_blend.c
index 06bb3e3bd7e..0c9d6129b53 100644
--- a/src/gallium/drivers/svga/svga_pipe_blend.c
+++ b/src/gallium/drivers/svga/svga_pipe_blend.c
@@ -321,6 +321,8 @@ svga_create_blend_state(struct pipe_context *pipe,
define_blend_state_object(svga, blend);
}
+ svga->hud.num_state_objects++;
+
return blend;
}
@@ -359,6 +361,7 @@ static void svga_delete_blend_state(struct pipe_context *pipe,
}
FREE(blend);
+ svga->hud.num_state_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 5ea623be4d9..d84ed1df48e 100644
--- a/src/gallium/drivers/svga/svga_pipe_depthstencil.c
+++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
@@ -202,6 +202,8 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
define_depth_stencil_state_object(svga, ds);
}
+ svga->hud.num_state_objects++;
+
return ds;
}
@@ -248,6 +250,7 @@ static void svga_delete_depth_stencil_state(struct pipe_context *pipe,
}
FREE(depth_stencil);
+ svga->hud.num_state_objects--;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c
index 303d4565cdb..50ebb53df90 100644
--- a/src/gallium/drivers/svga/svga_pipe_draw.c
+++ b/src/gallium/drivers/svga/svga_pipe_draw.c
@@ -177,7 +177,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
enum pipe_error ret = 0;
boolean needed_swtnl;
- svga->num_draw_calls++; /* for SVGA_QUERY_DRAW_CALLS */
+ svga->hud.num_draw_calls++; /* for SVGA_QUERY_NUM_DRAW_CALLS */
if (u_reduced_prim(info->mode) == PIPE_PRIM_TRIANGLES &&
svga->curr.rast->templ.cull_face == PIPE_FACE_FRONT_AND_BACK)
@@ -219,7 +219,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
#endif
if (svga->state.sw.need_swtnl) {
- svga->num_fallbacks++; /* for SVGA_QUERY_FALLBACKS */
+ svga->hud.num_fallbacks++; /* for SVGA_QUERY_NUM_FALLBACKS */
if (!needed_swtnl) {
/*
* We're switching from HW to SW TNL. SW TNL will require mapping all
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index 7081e5a1c43..8b9818334ca 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -720,9 +720,17 @@ svga_create_query(struct pipe_context *pipe,
define_query_vgpu10(svga, sq,
sizeof(SVGADXTimestampQueryResult));
break;
- case SVGA_QUERY_DRAW_CALLS:
- case SVGA_QUERY_FALLBACKS:
+ case SVGA_QUERY_NUM_DRAW_CALLS:
+ case SVGA_QUERY_NUM_FALLBACKS:
+ case SVGA_QUERY_NUM_FLUSHES:
case SVGA_QUERY_MEMORY_USED:
+ case SVGA_QUERY_NUM_SHADERS:
+ case SVGA_QUERY_NUM_RESOURCES:
+ case SVGA_QUERY_NUM_STATE_OBJECTS:
+ case SVGA_QUERY_NUM_VALIDATIONS:
+ case SVGA_QUERY_MAP_BUFFER_TIME:
+ case SVGA_QUERY_NUM_SURFACE_VIEWS:
+ case SVGA_QUERY_NUM_RESOURCES_MAPPED:
break;
default:
assert(!"unexpected query type in svga_create_query()");
@@ -778,9 +786,17 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
destroy_query_vgpu10(svga, sq);
sws->fence_reference(sws, &sq->fence, NULL);
break;
- case SVGA_QUERY_DRAW_CALLS:
- case SVGA_QUERY_FALLBACKS:
+ case SVGA_QUERY_NUM_DRAW_CALLS:
+ case SVGA_QUERY_NUM_FALLBACKS:
+ case SVGA_QUERY_NUM_FLUSHES:
case SVGA_QUERY_MEMORY_USED:
+ case SVGA_QUERY_NUM_SHADERS:
+ case SVGA_QUERY_NUM_RESOURCES:
+ case SVGA_QUERY_NUM_STATE_OBJECTS:
+ case SVGA_QUERY_NUM_VALIDATIONS:
+ case SVGA_QUERY_MAP_BUFFER_TIME:
+ case SVGA_QUERY_NUM_SURFACE_VIEWS:
+ case SVGA_QUERY_NUM_RESOURCES_MAPPED:
/* nothing */
break;
default:
@@ -842,13 +858,29 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q)
ret = begin_query_vgpu10(svga, sq);
assert(ret == PIPE_OK);
break;
- case SVGA_QUERY_DRAW_CALLS:
- sq->begin_count = svga->num_draw_calls;
+ case SVGA_QUERY_NUM_DRAW_CALLS:
+ sq->begin_count = svga->hud.num_draw_calls;
break;
- case SVGA_QUERY_FALLBACKS:
- sq->begin_count = svga->num_fallbacks;
+ case SVGA_QUERY_NUM_FALLBACKS:
+ sq->begin_count = svga->hud.num_fallbacks;
+ break;
+ case SVGA_QUERY_NUM_FLUSHES:
+ sq->begin_count = svga->hud.num_flushes;
+ break;
+ case SVGA_QUERY_NUM_VALIDATIONS:
+ sq->begin_count = svga->hud.num_validations;
+ break;
+ case SVGA_QUERY_MAP_BUFFER_TIME:
+ sq->begin_count = svga->hud.map_buffer_time;
+ break;
+ case SVGA_QUERY_NUM_RESOURCES_MAPPED:
+ sq->begin_count = svga->hud.num_resources_mapped;
break;
case SVGA_QUERY_MEMORY_USED:
+ case SVGA_QUERY_NUM_SHADERS:
+ case SVGA_QUERY_NUM_RESOURCES:
+ case SVGA_QUERY_NUM_STATE_OBJECTS:
+ case SVGA_QUERY_NUM_SURFACE_VIEWS:
/* nothing */
break;
default:
@@ -916,13 +948,29 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
ret = end_query_vgpu10(svga, sq);
assert(ret == PIPE_OK);
break;
- case SVGA_QUERY_DRAW_CALLS:
- sq->end_count = svga->num_draw_calls;
+ case SVGA_QUERY_NUM_DRAW_CALLS:
+ sq->end_count = svga->hud.num_draw_calls;
+ break;
+ case SVGA_QUERY_NUM_FALLBACKS:
+ sq->end_count = svga->hud.num_fallbacks;
+ break;
+ case SVGA_QUERY_NUM_FLUSHES:
+ sq->end_count = svga->hud.num_flushes;
break;
- case SVGA_QUERY_FALLBACKS:
- sq->end_count = svga->num_fallbacks;
+ case SVGA_QUERY_NUM_VALIDATIONS:
+ sq->end_count = svga->hud.num_validations;
+ break;
+ case SVGA_QUERY_MAP_BUFFER_TIME:
+ sq->end_count = svga->hud.map_buffer_time;
+ break;
+ case SVGA_QUERY_NUM_RESOURCES_MAPPED:
+ sq->end_count = svga->hud.num_resources_mapped;
break;
case SVGA_QUERY_MEMORY_USED:
+ case SVGA_QUERY_NUM_SHADERS:
+ case SVGA_QUERY_NUM_RESOURCES:
+ case SVGA_QUERY_NUM_STATE_OBJECTS:
+ case SVGA_QUERY_NUM_SURFACE_VIEWS:
/* nothing */
break;
default:
@@ -1007,13 +1055,30 @@ svga_get_query_result(struct pipe_context *pipe,
*result = (uint64_t)sResult.numPrimitivesWritten;
break;
}
- case SVGA_QUERY_DRAW_CALLS:
- /* fall-through */
- case SVGA_QUERY_FALLBACKS:
+ /* These are per-frame counters */
+ case SVGA_QUERY_NUM_DRAW_CALLS:
+ case SVGA_QUERY_NUM_FALLBACKS:
+ case SVGA_QUERY_NUM_FLUSHES:
+ case SVGA_QUERY_NUM_VALIDATIONS:
+ case SVGA_QUERY_NUM_RESOURCES_MAPPED:
+ case SVGA_QUERY_MAP_BUFFER_TIME:
vresult->u64 = sq->end_count - sq->begin_count;
break;
+ /* These are running total counters */
case SVGA_QUERY_MEMORY_USED:
- vresult->u64 = svgascreen->total_resource_bytes;
+ vresult->u64 = svgascreen->hud.total_resource_bytes;
+ break;
+ case SVGA_QUERY_NUM_SHADERS:
+ vresult->u64 = svga->hud.num_shaders;
+ break;
+ case SVGA_QUERY_NUM_RESOURCES:
+ vresult->u64 = svgascreen->hud.num_resources;
+ break;
+ case SVGA_QUERY_NUM_STATE_OBJECTS:
+ vresult->u64 = svga->hud.num_state_objects;
+ break;
+ case SVGA_QUERY_NUM_SURFACE_VIEWS:
+ vresult->u64 = svga->hud.num_surface_views;
break;
default:
assert(!"unexpected query type in svga_get_query_result");
diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
index a7aadac0111..6310b7a5e86 100644
--- a/src/gallium/drivers/svga/svga_pipe_rasterizer.c
+++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c
@@ -352,6 +352,8 @@ svga_create_rasterizer_state(struct pipe_context *pipe,
define_rasterizer_object(svga, rast);
}
+ svga->hud.num_state_objects++;
+
return rast;
}
@@ -392,6 +394,7 @@ svga_delete_rasterizer_state(struct pipe_context *pipe, void *state)
}
FREE(state);
+ svga->hud.num_state_objects--;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 60e2d44ace4..95241176510 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -273,6 +273,8 @@ 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++;
+
return cso;
}
@@ -328,6 +330,7 @@ static void svga_delete_sampler_state(struct pipe_context *pipe,
}
FREE(sampler);
+ svga->hud.num_state_objects--;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c
index e0932a9dbc1..b932c568f53 100644
--- a/src/gallium/drivers/svga/svga_pipe_vertex.c
+++ b/src/gallium/drivers/svga/svga_pipe_vertex.c
@@ -274,6 +274,9 @@ svga_create_vertex_elements_state(struct pipe_context *pipe,
translate_vertex_decls(svga, velems);
}
}
+
+ svga->hud.num_state_objects++;
+
return velems;
}
@@ -315,6 +318,7 @@ svga_delete_vertex_elements_state(struct pipe_context *pipe, void *state)
}
FREE(velems);
+ svga->hud.num_state_objects--;
}
void svga_cleanup_vertex_state( struct svga_context *svga )
diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c
index 57e37fcfe14..6a8fff454e4 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer.c
@@ -29,6 +29,7 @@
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "os/os_thread.h"
+#include "os/os_time.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "util/u_resource.h"
@@ -77,6 +78,7 @@ svga_buffer_transfer_map(struct pipe_context *pipe,
struct svga_buffer *sbuf = svga_buffer(resource);
struct pipe_transfer *transfer;
uint8_t *map;
+ int64_t begin = os_time_get();
transfer = CALLOC_STRUCT(pipe_transfer);
if (transfer == NULL) {
@@ -244,6 +246,9 @@ svga_buffer_transfer_map(struct pipe_context *pipe,
FREE(transfer);
}
+ svga->hud.map_buffer_time += (os_time_get() - begin);
+ svga->hud.num_resources_mapped++;
+
return map;
}
@@ -331,7 +336,10 @@ svga_buffer_destroy( struct pipe_screen *screen,
if (sbuf->swbuf && !sbuf->user)
align_free(sbuf->swbuf);
- ss->total_resource_bytes -= sbuf->size;
+ ss->hud.total_resource_bytes -= sbuf->size;
+ assert(ss->hud.num_resources > 0);
+ if (ss->hud.num_resources > 0)
+ ss->hud.num_resources--;
FREE(sbuf);
}
@@ -409,7 +417,9 @@ svga_buffer_create(struct pipe_screen *screen,
(debug_reference_descriptor)debug_describe_resource, 0);
sbuf->size = util_resource_size(&sbuf->b.b);
- ss->total_resource_bytes += sbuf->size;
+ ss->hud.total_resource_bytes += sbuf->size;
+
+ ss->hud.num_resources++;
return &sbuf->b.b;
@@ -427,6 +437,7 @@ svga_user_buffer_create(struct pipe_screen *screen,
unsigned bind)
{
struct svga_buffer *sbuf;
+ struct svga_screen *ss = svga_screen(screen);
sbuf = CALLOC_STRUCT(svga_buffer);
if (!sbuf)
@@ -450,6 +461,8 @@ svga_user_buffer_create(struct pipe_screen *screen,
debug_reference(&sbuf->b.b.reference,
(debug_reference_descriptor)debug_describe_resource, 0);
+ ss->hud.num_resources++;
+
return &sbuf->b.b;
no_sbuf:
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index 90787be8073..a02d1e495ff 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -29,6 +29,7 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
#include "os/os_thread.h"
+#include "os/os_time.h"
#include "util/u_format.h"
#include "util/u_inlines.h"
#include "util/u_math.h"
@@ -229,11 +230,15 @@ svga_texture_destroy(struct pipe_screen *screen,
SVGA_DBG(DEBUG_DMA, "unref sid %p (texture)\n", tex->handle);
svga_screen_surface_destroy(ss, &tex->key, &tex->handle);
- ss->total_resource_bytes -= tex->size;
+ ss->hud.total_resource_bytes -= tex->size;
FREE(tex->defined);
FREE(tex->rendered_to);
FREE(tex);
+
+ assert(ss->hud.num_resources > 0);
+ if (ss->hud.num_resources > 0)
+ ss->hud.num_resources--;
}
@@ -322,6 +327,8 @@ svga_texture_transfer_map(struct pipe_context *pipe,
boolean use_direct_map = svga_have_gb_objects(svga) &&
!svga_have_gb_dma(svga);
unsigned d;
+ void *returnVal;
+ int64_t begin = os_time_get();
/* We can't map texture storage directly unless we have GB objects */
if (usage & PIPE_TRANSFER_MAP_DIRECTLY) {
@@ -464,10 +471,10 @@ svga_texture_transfer_map(struct pipe_context *pipe,
* Begin mapping code
*/
if (st->swbuf) {
- return st->swbuf;
+ returnVal = st->swbuf;
}
else if (!st->use_direct_map) {
- return sws->buffer_map(sws, st->hwbuf, usage);
+ returnVal = sws->buffer_map(sws, st->hwbuf, usage);
}
else {
SVGA3dSize baseLevelSize;
@@ -518,9 +525,13 @@ svga_texture_transfer_map(struct pipe_context *pipe,
offset += svga3dsurface_get_pixel_offset(tex->key.format,
mip_width, mip_height,
xoffset, yoffset, zoffset);
-
- return (void *) (map + offset);
+ returnVal = (void *) (map + offset);
}
+
+ svga->hud.map_buffer_time += (os_time_get() - begin);
+ svga->hud.num_resources_mapped++;
+
+ return returnVal;
}
@@ -889,7 +900,8 @@ svga_texture_create(struct pipe_screen *screen,
(debug_reference_descriptor)debug_describe_resource, 0);
tex->size = util_resource_size(template);
- svgascreen->total_resource_bytes += tex->size;
+ svgascreen->hud.total_resource_bytes += tex->size;
+ svgascreen->hud.num_resources++;
return &tex->b.b;
}
@@ -901,6 +913,7 @@ svga_texture_from_handle(struct pipe_screen *screen,
struct winsys_handle *whandle)
{
struct svga_winsys_screen *sws = svga_winsys_screen(screen);
+ struct svga_screen *ss = svga_screen(screen);
struct svga_winsys_surface *srf;
struct svga_texture *tex;
enum SVGA3dSurfaceFormat format = 0;
@@ -970,5 +983,7 @@ svga_texture_from_handle(struct pipe_screen *screen,
tex->rendered_to = CALLOC(1, sizeof(tex->rendered_to[0]));
tex->imported = TRUE;
+ ss->hud.num_resources++;
+
return &tex->b.b;
}
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index e0a28788238..dab89814334 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -772,9 +772,22 @@ svga_get_driver_query_info(struct pipe_screen *screen,
struct pipe_driver_query_info *info)
{
static const struct pipe_driver_query_info queries[] = {
- {"draw-calls", SVGA_QUERY_DRAW_CALLS, {0}},
- {"fallbacks", SVGA_QUERY_FALLBACKS, {0}},
- {"memory-used", SVGA_QUERY_MEMORY_USED, {0}, PIPE_DRIVER_QUERY_TYPE_BYTES}
+ /* per-frame counters */
+ {"num-draw-calls", SVGA_QUERY_NUM_DRAW_CALLS, {0}},
+ {"num-fallbacks", SVGA_QUERY_NUM_FALLBACKS, {0}},
+ {"num-flushes", SVGA_QUERY_NUM_FLUSHES, {0}},
+ {"num-validations", SVGA_QUERY_NUM_VALIDATIONS, {0}},
+ {"map-buffer-time", SVGA_QUERY_MAP_BUFFER_TIME, {0},
+ PIPE_DRIVER_QUERY_TYPE_MICROSECONDS},
+ {"num-resources-mapped", SVGA_QUERY_NUM_RESOURCES_MAPPED, {0}},
+
+ /* running total counters */
+ {"memory-used", SVGA_QUERY_MEMORY_USED, {0},
+ PIPE_DRIVER_QUERY_TYPE_BYTES},
+ {"num-shaders", SVGA_QUERY_NUM_SHADERS, {0}},
+ {"num-resources", SVGA_QUERY_NUM_RESOURCES, {0}},
+ {"num-state-objects", SVGA_QUERY_NUM_STATE_OBJECTS, {0}},
+ {"num-surface-views", SVGA_QUERY_NUM_SURFACE_VIEWS, {0}},
};
if (!info)
diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h
index 5581d2e1ffd..98b56b2a6d1 100644
--- a/src/gallium/drivers/svga/svga_screen.h
+++ b/src/gallium/drivers/svga/svga_screen.h
@@ -80,8 +80,12 @@ struct svga_screen
struct svga_host_surface_cache cache;
- /** Memory used by all resources (buffers and surfaces) */
- uint64_t total_resource_bytes;
+ /** HUD counters */
+ struct {
+ /** Memory used by all resources (buffers and surfaces) */
+ uint64_t total_resource_bytes;
+ uint64_t num_resources;
+ } hud;
};
#ifndef DEBUG
diff --git a/src/gallium/drivers/svga/svga_shader.c b/src/gallium/drivers/svga/svga_shader.c
index 7b847558db1..5c99e16d976 100644
--- a/src/gallium/drivers/svga/svga_shader.c
+++ b/src/gallium/drivers/svga/svga_shader.c
@@ -417,6 +417,7 @@ svga_set_shader(struct svga_context *svga,
struct svga_shader_variant *
svga_new_shader_variant(struct svga_context *svga)
{
+ svga->hud.num_shaders++;
return CALLOC_STRUCT(svga_shader_variant);
}
@@ -462,6 +463,8 @@ svga_destroy_shader_variant(struct svga_context *svga,
FREE((unsigned *)variant->tokens);
FREE(variant);
+ svga->hud.num_shaders--;
+
return ret;
}
diff --git a/src/gallium/drivers/svga/svga_state.c b/src/gallium/drivers/svga/svga_state.c
index 37d16dc9afe..722b369fd4b 100644
--- a/src/gallium/drivers/svga/svga_state.c
+++ b/src/gallium/drivers/svga/svga_state.c
@@ -225,6 +225,9 @@ svga_update_state(struct svga_context *svga, unsigned max_level)
svga->state.dirty[i] |= svga->dirty;
svga->dirty = 0;
+
+ svga->hud.num_validations++;
+
return PIPE_OK;
}
diff --git a/src/gallium/drivers/svga/svga_surface.c b/src/gallium/drivers/svga/svga_surface.c
index aca5abcdfce..9f09311116e 100644
--- a/src/gallium/drivers/svga/svga_surface.c
+++ b/src/gallium/drivers/svga/svga_surface.c
@@ -317,6 +317,8 @@ svga_create_surface_view(struct pipe_context *pipe,
s->real_level = surf_tmpl->u.tex.level;
}
+ svga->hud.num_surface_views++;
+
return &s->base;
}
@@ -509,6 +511,8 @@ svga_surface_destroy(struct pipe_context *pipe,
pipe_resource_reference(&surf->texture, NULL);
FREE(surf);
+
+ svga->hud.num_surface_views--;
}