<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
{margin-top:0;
margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><span style="font-size:11pt">For the series,</span></p>
<p><br>
</p>
<p><span style="font-size:11pt">Reviewed-by: Neha Bhende<bhenden@vmware.com></span><br>
</p>
<p><br>
</p>
<div id="x_Signature"><span style="font-size:11pt"></span>
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<span style="font-size:11pt"></span>
<p><span style="font-size:11pt">Regards,</span></p>
<span style="font-size:11pt"></span>
<p><span style="font-size:11pt">Neha</span><br>
</p>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Brian Paul <brianp@vmware.com><br>
<b>Sent:</b> Friday, June 16, 2017 3:39:12 PM<br>
<b>To:</b> mesa-dev@lists.freedesktop.org<br>
<b>Cc:</b> Charmaine Lee; Neha Bhende<br>
<b>Subject:</b> [PATCH 2/2] svga: add new num-failed-allocations HUD query</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">This counter is incremented if we fail to allocate memory for<br>
vertex/index/const buffers, textures, etc.<br>
---<br>
src/gallium/drivers/svga/svga_context.h | 1 +<br>
src/gallium/drivers/svga/svga_pipe_query.c | 7 +++++++<br>
src/gallium/drivers/svga/svga_resource.c | 17 +++++++++++++++--<br>
src/gallium/drivers/svga/svga_screen.c | 2 ++<br>
src/gallium/drivers/svga/svga_screen.h | 1 +<br>
5 files changed, 26 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h<br>
index 2987c70..b1ccfc8 100644<br>
--- a/src/gallium/drivers/svga/svga_context.h<br>
+++ b/src/gallium/drivers/svga/svga_context.h<br>
@@ -72,6 +72,7 @@ enum svga_hud {<br>
SVGA_QUERY_NUM_STATE_OBJECTS,<br>
SVGA_QUERY_NUM_SURFACE_VIEWS,<br>
SVGA_QUERY_NUM_GENERATE_MIPMAP,<br>
+ SVGA_QUERY_NUM_FAILED_ALLOCATIONS,<br>
<br>
/*SVGA_QUERY_MAX has to be last because it is size of an array*/<br>
SVGA_QUERY_MAX<br>
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c<br>
index 76360fd..6703b72 100644<br>
--- a/src/gallium/drivers/svga/svga_pipe_query.c<br>
+++ b/src/gallium/drivers/svga/svga_pipe_query.c<br>
@@ -747,6 +747,7 @@ svga_create_query(struct pipe_context *pipe,<br>
case SVGA_QUERY_NUM_BUFFER_UPLOADS:<br>
case SVGA_QUERY_NUM_CONST_BUF_UPDATES:<br>
case SVGA_QUERY_NUM_CONST_UPDATES:<br>
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:<br>
break;<br>
case SVGA_QUERY_FLUSH_TIME:<br>
case SVGA_QUERY_MAP_BUFFER_TIME:<br>
@@ -826,6 +827,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)<br>
case SVGA_QUERY_NUM_BUFFER_UPLOADS:<br>
case SVGA_QUERY_NUM_CONST_BUF_UPDATES:<br>
case SVGA_QUERY_NUM_CONST_UPDATES:<br>
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:<br>
/* nothing */<br>
break;<br>
default:<br>
@@ -937,6 +939,7 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q)<br>
case SVGA_QUERY_NUM_STATE_OBJECTS:<br>
case SVGA_QUERY_NUM_SURFACE_VIEWS:<br>
case SVGA_QUERY_NUM_GENERATE_MIPMAP:<br>
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:<br>
/* nothing */<br>
break;<br>
default:<br>
@@ -1049,6 +1052,7 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q)<br>
case SVGA_QUERY_NUM_STATE_OBJECTS:<br>
case SVGA_QUERY_NUM_SURFACE_VIEWS:<br>
case SVGA_QUERY_NUM_GENERATE_MIPMAP:<br>
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:<br>
/* nothing */<br>
break;<br>
default:<br>
@@ -1182,6 +1186,9 @@ svga_get_query_result(struct pipe_context *pipe,<br>
case SVGA_QUERY_NUM_GENERATE_MIPMAP:<br>
vresult->u64 = svga->hud.num_generate_mipmap;<br>
break;<br>
+ case SVGA_QUERY_NUM_FAILED_ALLOCATIONS:<br>
+ vresult->u64 = svgascreen->hud.num_failed_allocations;<br>
+ break;<br>
default:<br>
assert(!"unexpected query type in svga_get_query_result");<br>
}<br>
diff --git a/src/gallium/drivers/svga/svga_resource.c b/src/gallium/drivers/svga/svga_resource.c<br>
index 6a297a2..874cfa0 100644<br>
--- a/src/gallium/drivers/svga/svga_resource.c<br>
+++ b/src/gallium/drivers/svga/svga_resource.c<br>
@@ -33,14 +33,27 @@<br>
#include "svga_format.h"<br>
<br>
<br>
+/**<br>
+ * This is the primary driver entrypoint for allocating graphics memory<br>
+ * (vertex/index/constant buffers, textures, etc)<br>
+ */<br>
static struct pipe_resource *<br>
svga_resource_create(struct pipe_screen *screen,<br>
const struct pipe_resource *template)<br>
{<br>
+ struct pipe_resource *r;<br>
+<br>
if (template->target == PIPE_BUFFER)<br>
- return svga_buffer_create(screen, template);<br>
+ r = svga_buffer_create(screen, template);<br>
else<br>
- return svga_texture_create(screen, template);<br>
+ r = svga_texture_create(screen, template);<br>
+<br>
+ if (!r) {<br>
+ struct svga_screen *svgascreen = svga_screen(screen);<br>
+ svgascreen->hud.num_failed_allocations++;<br>
+ }<br>
+<br>
+ return r;<br>
}<br>
<br>
<br>
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c<br>
index 3aa9945..0b63525 100644<br>
--- a/src/gallium/drivers/svga/svga_screen.c<br>
+++ b/src/gallium/drivers/svga/svga_screen.c<br>
@@ -916,6 +916,8 @@ svga_get_driver_query_info(struct pipe_screen *screen,<br>
PIPE_DRIVER_QUERY_TYPE_UINT64),<br>
QUERY("num-generate-mipmap", SVGA_QUERY_NUM_GENERATE_MIPMAP,<br>
PIPE_DRIVER_QUERY_TYPE_UINT64),<br>
+ QUERY("num-failed-allocations", SVGA_QUERY_NUM_FAILED_ALLOCATIONS,<br>
+ PIPE_DRIVER_QUERY_TYPE_UINT64),<br>
};<br>
#undef QUERY<br>
<br>
diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h<br>
index 68834a6..12b9346 100644<br>
--- a/src/gallium/drivers/svga/svga_screen.h<br>
+++ b/src/gallium/drivers/svga/svga_screen.h<br>
@@ -86,6 +86,7 @@ struct svga_screen<br>
/** Memory used by all resources (buffers and surfaces) */<br>
uint64_t total_resource_bytes;<br>
uint64_t num_resources;<br>
+ uint64_t num_failed_allocations;<br>
} hud;<br>
};<br>
<br>
-- <br>
1.9.1<br>
<br>
</div>
</span></font>
</body>
</html>