On Thu, 2018-05-17 at 14:01 -0700, Nanley Chery wrote: > On Thu, May 17, 2018 at 09:25:18AM -0700, Dylan Baker wrote: > > Quoting Nanley Chery (2018-05-03 12:03:48) > > > Before this patch, if we failed to initialize an MCS buffer, we'd > > > end up in a state in which the miptree thinks it has an MCS buffer, > > > but doesn't. We also leaked the clear_color_bo if it existed. > > > > > > With this patch, we now free the miptree aux buffer resources and let > > > intel_miptree_alloc_mcs() know that the MCS buffer no longer exists. > > > > > > Cc: <mesa-sta...@lists.freedesktop.org> > > > --- > > > src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 14 +++++++------- > > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > > > diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > index b9a564552df..377efae32c9 100644 > > > --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c > > > @@ -1658,7 +1658,7 @@ intel_miptree_copy_teximage(struct brw_context *brw, > > > intel_obj->needs_validate = true; > > > } > > > > > > -static void > > > +static bool > > > intel_miptree_init_mcs(struct brw_context *brw, > > > struct intel_mipmap_tree *mt, > > > int init_value) > > > @@ -1678,13 +1678,14 @@ intel_miptree_init_mcs(struct brw_context *brw, > > > void *map = brw_bo_map(brw, mt->aux_buf->bo, MAP_WRITE | MAP_RAW); > > > if (unlikely(map == NULL)) { > > > fprintf(stderr, "Failed to map mcs buffer into GTT\n"); > > > - brw_bo_unreference(mt->aux_buf->bo); > > > - free(mt->aux_buf); > > > - return; > > > + intel_miptree_aux_buffer_free(mt->aux_buf); > > > + mt->aux_buf = NULL; > > > + return false; > > > } > > > void *data = map; > > > memset(data, init_value, mt->aux_buf->size); > > > brw_bo_unmap(mt->aux_buf->bo); > > > + return true; > > > } > > > > > > static struct intel_miptree_aux_buffer * > > > @@ -1764,15 +1765,14 @@ intel_miptree_alloc_mcs(struct brw_context *brw, > > > const uint32_t alloc_flags = 0; > > > mt->aux_buf = intel_alloc_aux_buffer(brw, "mcs-miptree", > > > &temp_mcs_surf, alloc_flags, mt); > > > - if (!mt->aux_buf) { > > > + if (!mt->aux_buf || > > > + !intel_miptree_init_mcs(brw, mt, 0xFF)) { > > > free(aux_state); > > > return false; > > > } > > > > > > mt->aux_state = aux_state; > > > > > > - intel_miptree_init_mcs(brw, mt, 0xFF); > > > - > > > return true; > > > } > > > > > > -- > > > 2.16.2 > > > > > > _______________________________________________ > > > mesa-stable mailing list > > > mesa-sta...@lists.freedesktop.org > > > https://lists.freedesktop.org/mailman/listinfo/mesa-stable > > > > > > Hi Nanley, > > > > Neither this patch or the next one cleanly apply to the 18.1 branch (or, I > > assume, 18.0), it looks like this depends on > > af4e9295febe966ace7793e43ba35705521749e8, which was not CC'd to stable. I'm > > not > > sure how to resolve the rebase conflicts, what would you like to do? > > > > Hi Dylan, > > I'd like to cherry-pick af4e9295febe966ace7793e43ba35705521749e8 and > it's parent for 18.1. We can ignore 18.0. Sorry for not checking on this > in advance. >
Thanks, Nanley. I'll leave this patch out for next 18.0 release. J.A. > -Nanley > > > Dylan > > > _______________________________________________ > mesa-stable mailing list > mesa-sta...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-stable _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev