summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnuj Phogat <[email protected]>2015-06-05 10:56:40 -0700
committerAnuj Phogat <[email protected]>2015-06-29 13:14:48 -0700
commita1afd59662449803fa4a40a79bdf0db16ffcbcf5 (patch)
tree625c0e27ba8316f60b0632dfe8f9d705f403b9a7
parent385cd3e0bed8113659f2db8976b677b090acc9d8 (diff)
i965: Make a helper function intel_miptree_can_use_tr_mode()
Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_tex_layout.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index fc7454b7ef7..389834f012a 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -815,6 +815,23 @@ intel_miptree_release_levels(struct intel_mipmap_tree *mt)
}
}
+static bool
+intel_miptree_can_use_tr_mode(const struct intel_mipmap_tree *mt)
+{
+ if (mt->tiling == I915_TILING_Y ||
+ mt->tiling == (I915_TILING_Y | I915_TILING_X) ||
+ mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
+ /* FIXME: Don't allow YS tiling at the moment. Using 64KB tiling
+ * for small textures might result in to memory wastage. Revisit
+ * this condition when we have more information about the specific
+ * cases where using YS over YF will be useful.
+ */
+ if (mt->tr_mode != INTEL_MIPTREE_TRMODE_YS)
+ return true;
+ }
+ return false;
+}
+
void
brw_miptree_layout(struct brw_context *brw,
struct intel_mipmap_tree *mt,
@@ -882,17 +899,8 @@ brw_miptree_layout(struct brw_context *brw,
mt->tiling = brw_miptree_choose_tiling(brw, requested, mt);
if (is_tr_mode_yf_ys_allowed) {
- if (mt->tiling == I915_TILING_Y ||
- mt->tiling == (I915_TILING_Y | I915_TILING_X) ||
- mt->tr_mode == INTEL_MIPTREE_TRMODE_NONE) {
- /* FIXME: Don't allow YS tiling at the moment. Using 64KB tiling
- * for small textures might result in to memory wastage. Revisit
- * this condition when we have more information about the specific
- * cases where using YS over YF will be useful.
- */
- if (mt->tr_mode != INTEL_MIPTREE_TRMODE_YS)
- break;
- }
+ if (intel_miptree_can_use_tr_mode(mt))
+ break;
/* Failed to use selected tr_mode. Free up the memory allocated
* for miptree levels in intel_miptree_total_width_height().
*/