[Mesa-dev] [PATCH 3/5] i965: Make a helper function intel_miptree_release_levels()

Anuj Phogat anuj.phogat at gmail.com
Wed Jun 10 15:30:48 PDT 2015


Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
Cc: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/i965/brw_tex_layout.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
index c0ef5cc..c185e41 100644
--- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -801,6 +801,17 @@ intel_miptree_set_alignment(struct brw_context *brw,
    }
 }
 
+static void
+intel_miptree_release_levels(struct intel_mipmap_tree *mt)
+{
+   unsigned int level = 0;
+
+   for (level = mt->first_level; level <= mt->last_level; level++) {
+      free(mt->level[level].slice);
+      mt->level[level].slice = NULL;
+   }
+}
+
 void
 brw_miptree_layout(struct brw_context *brw,
                    bool for_bo,
@@ -866,7 +877,6 @@ brw_miptree_layout(struct brw_context *brw,
          mt->tiling = brw_miptree_choose_tiling(brw, requested, mt);
 
       if (is_tr_mode_yf_ys_allowed) {
-         unsigned int level = 0;
          assert(brw->gen >= 9);
 
          if (mt->tiling == I915_TILING_Y ||
@@ -883,10 +893,7 @@ brw_miptree_layout(struct brw_context *brw,
          /* Failed to use selected tr_mode. Free up the memory allocated
           * for miptree levels in intel_miptree_total_width_height().
           */
-         for (level = mt->first_level; level <= mt->last_level; level++) {
-            free(mt->level[level].slice);
-            mt->level[level].slice = NULL;
-         }
+         intel_miptree_release_levels(mt);
       }
       i++;
    }
-- 
1.9.3



More information about the mesa-dev mailing list