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 <jason@jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
This commit is contained in:
Topi Pohjolainen 2017-01-17 10:10:17 +02:00
parent aa9e21a316
commit bcec4113cc
3 changed files with 10 additions and 7 deletions

View file

@ -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;
}

View file

@ -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);

View file

@ -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);