[Mesa-dev] [1.5/27] i965/miptree: Tell when brw_miptree_layout() fails
Topi Pohjolainen
topi.pohjolainen at gmail.com
Tue Jan 17 08:19:18 UTC 2017
In addition, let intel_miptree_create_layout() release the
miptree - it is the allocator.
CC: Jason Ekstrand <jason at jlekstrand.net>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_tex_layout.c | 10 +++++-----
src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 5 ++++-
src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 2 +-
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 768f8a8..9c654d3 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -771,7 +771,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)
@@ -781,10 +781,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
@@ -798,5 +796,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 9488bec..5c80df8 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 476c46b..27bcdfb 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);
--
2.5.5
More information about the mesa-dev
mailing list