summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga/svga_resource.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2017-06-16 16:36:43 -0600
committerBrian Paul <[email protected]>2017-06-16 17:04:08 -0600
commite3f5b8ac168fe3d3afa48906ea56465a5836ac58 (patch)
tree034d27b7040d3df85600b42519e111e77398a59e /src/gallium/drivers/svga/svga_resource.c
parentb27281c1109efc91a3e0e986e8d8f33b2fbb28ed (diff)
svga: add new num-failed-allocations HUD query
This counter is incremented if we fail to allocate memory for vertex/index/const buffers, textures, etc. Reviewed-by: Neha Bhende <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga/svga_resource.c')
-rw-r--r--src/gallium/drivers/svga/svga_resource.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c
index 6a297a2ae02..874cfa07223 100644
--- a/src/gallium/drivers/svga/svga_resource.c
+++ b/src/gallium/drivers/svga/svga_resource.c
@@ -33,14 +33,27 @@
#include "svga_format.h"
+/**
+ * This is the primary driver entrypoint for allocating graphics memory
+ * (vertex/index/constant buffers, textures, etc)
+ */
static struct pipe_resource *
svga_resource_create(struct pipe_screen *screen,
const struct pipe_resource *template)
{
+ struct pipe_resource *r;
+
if (template->target == PIPE_BUFFER)
- return svga_buffer_create(screen, template);
+ r = svga_buffer_create(screen, template);
else
- return svga_texture_create(screen, template);
+ r = svga_texture_create(screen, template);
+
+ if (!r) {
+ struct svga_screen *svgascreen = svga_screen(screen);
+ svgascreen->hud.num_failed_allocations++;
+ }
+
+ return r;
}