i965/miptree: Add a return for updating of winsys
authorBen Widawsky <ben@bwidawsk.net>
Tue, 30 May 2017 11:53:57 +0000 (17:23 +0530)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 13 Jul 2017 04:15:46 +0000 (21:15 -0700)
There is nothing particularly useful to do currently if the update
fails, but there is no point carrying on either. As a result, this has a
behavior change.

v2: Make the return type a bool (Topi)

v3: Don't leak the bo if update_winsys_renderbuffer fails. (Jason)

Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> (v2)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
src/mesa/drivers/dri/i965/brw_context.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.c
src/mesa/drivers/dri/i965/intel_mipmap_tree.h

index 8a3ffab443f9c72eb43e4a404c04335c5cf32dcf..9d108fe31d894e39c9386cbf2316cdfde49170c1 100644 (file)
@@ -1504,9 +1504,12 @@ intel_process_dri2_buffer(struct brw_context *brw,
       return;
    }
 
-   intel_update_winsys_renderbuffer_miptree(brw, rb, bo,
-                                            drawable->w, drawable->h,
-                                            buffer->pitch);
+   if (!intel_update_winsys_renderbuffer_miptree(brw, rb, bo,
+                                                 drawable->w, drawable->h,
+                                                 buffer->pitch)) {
+      brw_bo_unreference(bo);
+      return;
+   }
 
    if (_mesa_is_front_buffer_drawing(fb) &&
        (buffer->attachment == __DRI_BUFFER_FRONT_LEFT ||
@@ -1562,9 +1565,10 @@ intel_update_image_buffer(struct brw_context *intel,
    if (last_mt && last_mt->bo == buffer->bo)
       return;
 
-   intel_update_winsys_renderbuffer_miptree(intel, rb, buffer->bo,
-                                            buffer->width, buffer->height,
-                                            buffer->pitch);
+   if (!intel_update_winsys_renderbuffer_miptree(intel, rb, buffer->bo,
+                                                 buffer->width, buffer->height,
+                                                 buffer->pitch))
+      return;
 
    if (_mesa_is_front_buffer_drawing(fb) &&
        buffer_type == __DRI_IMAGE_BUFFER_FRONT &&
index 0d989d5b0639bebed0a87e7e3a1314af2a436193..c018c7f6a87254ceaef420f8f8530d864fee91ad 100644 (file)
@@ -1112,7 +1112,7 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,
  * that will contain the actual rendering (which is lazily resolved to
  * irb->singlesample_mt).
  */
-void
+bool
 intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
                                          struct intel_renderbuffer *irb,
                                          struct brw_bo *bo,
@@ -1168,12 +1168,12 @@ intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
          irb->mt = multisample_mt;
       }
    }
-   return;
+   return true;
 
 fail:
    intel_miptree_release(&irb->singlesample_mt);
    intel_miptree_release(&irb->mt);
-   return;
+   return false;
 }
 
 struct intel_mipmap_tree*
index cb1dcc161de9b76eb76e272eb29672b38d163448..c588f255d1b1a47159318ad3d397564895478517 100644 (file)
@@ -691,7 +691,7 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,
                                    __DRIimage *image,
                                    GLenum target);
 
-void
+bool
 intel_update_winsys_renderbuffer_miptree(struct brw_context *intel,
                                          struct intel_renderbuffer *irb,
                                          struct brw_bo *bo,