SVGA_QUERY_NUM_STATE_OBJECTS,
SVGA_QUERY_NUM_SURFACE_VIEWS,
SVGA_QUERY_NUM_GENERATE_MIPMAP,
+ SVGA_QUERY_NUM_FAILED_ALLOCATIONS,
/*SVGA_QUERY_MAX has to be last because it is size of an array*/
SVGA_QUERY_MAX
case SVGA_QUERY_NUM_BUFFER_UPLOADS:
case SVGA_QUERY_NUM_CONST_BUF_UPDATES:
case SVGA_QUERY_NUM_CONST_UPDATES:
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:
break;
case SVGA_QUERY_FLUSH_TIME:
case SVGA_QUERY_MAP_BUFFER_TIME:
case SVGA_QUERY_NUM_BUFFER_UPLOADS:
case SVGA_QUERY_NUM_CONST_BUF_UPDATES:
case SVGA_QUERY_NUM_CONST_UPDATES:
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:
/* nothing */
break;
default:
case SVGA_QUERY_NUM_STATE_OBJECTS:
case SVGA_QUERY_NUM_SURFACE_VIEWS:
case SVGA_QUERY_NUM_GENERATE_MIPMAP:
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:
/* nothing */
break;
default:
case SVGA_QUERY_NUM_STATE_OBJECTS:
case SVGA_QUERY_NUM_SURFACE_VIEWS:
case SVGA_QUERY_NUM_GENERATE_MIPMAP:
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:
/* nothing */
break;
default:
case SVGA_QUERY_NUM_GENERATE_MIPMAP:
vresult->u64 = svga->hud.num_generate_mipmap;
break;
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:
+ vresult->u64 = svgascreen->hud.num_failed_allocations;
+ break;
default:
assert(!"unexpected query type in svga_get_query_result");
}
#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;
}
PIPE_DRIVER_QUERY_TYPE_UINT64),
QUERY("num-generate-mipmap", SVGA_QUERY_NUM_GENERATE_MIPMAP,
PIPE_DRIVER_QUERY_TYPE_UINT64),
+ QUERY("num-failed-allocations", SVGA_QUERY_NUM_FAILED_ALLOCATIONS,
+ PIPE_DRIVER_QUERY_TYPE_UINT64),
};
#undef QUERY
/** Memory used by all resources (buffers and surfaces) */
uint64_t total_resource_bytes;
uint64_t num_resources;
+ uint64_t num_failed_allocations;
} hud;
};