From: Topi Pohjolainen Date: Tue, 17 Jan 2017 08:10:17 +0000 (+0200) Subject: i965/miptree: Tell when brw_miptree_layout() fails X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bcec4113cc812f604deb8dff2bb91a32340984fa;p=mesa.git i965/miptree: Tell when brw_miptree_layout() fails In addition, let intel_miptree_create_layout() release the miptree - it is the allocator. Reviewed-by: Jason Ekstrand Signed-off-by: Topi Pohjolainen --- diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 684ae769c56..8a528e088a4 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -763,7 +763,7 @@ intel_miptree_set_alignment(struct brw_context *brw, } } -void +bool brw_miptree_layout(struct brw_context *brw, struct intel_mipmap_tree *mt, uint32_t layout_flags) @@ -773,10 +773,8 @@ brw_miptree_layout(struct brw_context *brw, intel_miptree_set_alignment(brw, mt, layout_flags); intel_miptree_set_total_width_height(brw, mt); - if (!mt->total_width || !mt->total_height) { - intel_miptree_release(&mt); - return; - } + if (!mt->total_width || !mt->total_height) + return false; /* On Gen9+ the alignment values are expressed in multiples of the block * size @@ -790,5 +788,7 @@ brw_miptree_layout(struct brw_context *brw, if ((layout_flags & MIPTREE_LAYOUT_FOR_BO) == 0) mt->tiling = brw_miptree_choose_tiling(brw, mt, layout_flags); + + return true; } diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index ed514239e21..f2debae444a 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -526,7 +526,10 @@ intel_miptree_create_layout(struct brw_context *brw, (layout_flags & MIPTREE_LAYOUT_FORCE_HALIGN16) == 0); } - brw_miptree_layout(brw, mt, layout_flags); + if (!brw_miptree_layout(brw, mt, layout_flags)) { + intel_miptree_release(&mt); + return NULL; + } if (mt->aux_disable & INTEL_AUX_DISABLE_MCS) assert(mt->msaa_layout != INTEL_MSAA_LAYOUT_CMS); diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h index 476c46b1355..27bcdfbe334 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h @@ -983,7 +983,7 @@ brw_miptree_get_vertical_slice_pitch(const struct brw_context *brw, const struct intel_mipmap_tree *mt, unsigned level); -void +bool brw_miptree_layout(struct brw_context *brw, struct intel_mipmap_tree *mt, uint32_t layout_flags);