<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 23, 2017 at 10:21 PM, Ben Widawsky <span dir="ltr"><<a href="mailto:ben@bwidawsk.net" target="_blank">ben@bwidawsk.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There is nothing particularly useful to do currently if the update<br>
fails, but there is no point carrying on either. As a result, this has a<br>
behavior change.<br>
<br>
v2: Make the return type a bool (Topi)<br>
<br>
Signed-off-by: Ben Widawsky <<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.com</a>><br>
Acked-by: Daniel Stone <<a href="mailto:daniels@collabora.com">daniels@collabora.com</a>><br>
Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/brw_<wbr>context.c | 14 ++++++++------<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 6 +++---<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h | 2 +-<br>
3 files changed, 12 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_context.c b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
index 0b3ac897aa..d2b3140ea1 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_context.c<br>
@@ -1646,9 +1646,10 @@ intel_process_dri2_buffer(<wbr>struct brw_context *brw,<br>
return;<br>
}<br>
<br>
- intel_update_winsys_<wbr>renderbuffer_miptree(brw, rb, bo,<br>
- drawable->w, drawable->h,<br>
- buffer->pitch);<br>
+ if (!intel_update_winsys_<wbr>renderbuffer_miptree(brw, rb, bo,<br>
+ drawable->w, drawable->h,<br>
+ buffer->pitch))<br>
+ return;<br></blockquote><div><br></div><div>This causes us to leak the bo we created 5 lines earlier.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
if (_mesa_is_front_buffer_<wbr>drawing(fb) &&<br>
(buffer->attachment == __DRI_BUFFER_FRONT_LEFT ||<br>
@@ -1704,9 +1705,10 @@ intel_update_image_buffer(<wbr>struct brw_context *intel,<br>
if (last_mt && last_mt->bo == buffer->bo)<br>
return;<br>
<br>
- intel_update_winsys_<wbr>renderbuffer_miptree(intel, rb, buffer->bo,<br>
- buffer->width, buffer->height,<br>
- buffer->pitch);<br>
+ if (!intel_update_winsys_<wbr>renderbuffer_miptree(intel, rb, buffer->bo,<br>
+ buffer->width, buffer->height,<br>
+ buffer->pitch))<br>
+ return;<br>
<br>
if (_mesa_is_front_buffer_<wbr>drawing(fb) &&<br>
buffer_type == __DRI_IMAGE_BUFFER_FRONT &&<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
index 8a30d72d4c..7d08bb6920 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
@@ -915,7 +915,7 @@ intel_miptree_create_for_<wbr>image(struct brw_context *intel,<br>
* that will contain the actual rendering (which is lazily resolved to<br>
* irb->singlesample_mt).<br>
*/<br>
-void<br>
+bool<br>
intel_update_winsys_<wbr>renderbuffer_miptree(struct brw_context *intel,<br>
struct intel_renderbuffer *irb,<br>
drm_intel_bo *bo,<br>
@@ -981,12 +981,12 @@ intel_update_winsys_<wbr>renderbuffer_miptree(struct brw_context *intel,<br>
irb->mt = multisample_mt;<br>
}<br>
}<br>
- return;<br>
+ return true;<br>
<br>
fail:<br>
intel_miptree_release(&irb-><wbr>singlesample_mt);<br>
intel_miptree_release(&irb-><wbr>mt);<br>
- return;<br>
+ return false;<br>
}<br>
<br>
struct intel_mipmap_tree*<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
index cf8f1a7687..9b4c85e509 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.h<br>
@@ -730,7 +730,7 @@ intel_miptree_create_for_<wbr>image(struct brw_context *intel,<br>
uint32_t pitch,<br>
uint32_t layout_flags);<br>
<br>
-void<br>
+bool<br>
intel_update_winsys_<wbr>renderbuffer_miptree(struct brw_context *intel,<br>
struct intel_renderbuffer *irb,<br>
drm_intel_bo *bo,<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>