summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2017-01-17 10:10:17 +0200
committerTopi Pohjolainen <[email protected]>2017-01-27 08:57:25 +0200
commitbcec4113cc812f604deb8dff2bb91a32340984fa (patch)
treea8276eb78c5752b3cfc90222873a865a53fb7e2a /src/mesa
parentaa9e21a316f2f180433801ba69c818b9f2ca0948 (diff)
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 <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex_layout.c10
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c5
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.h2
3 files changed, 10 insertions, 7 deletions
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);