anv/allocator: Don't shrink either end of the block pool
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 21 Apr 2018 04:52:41 +0000 (21:52 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 26 Apr 2018 20:17:14 +0000 (13:17 -0700)
Previously, we only tried to ensure that we didn't shrink either end
below what was already handed out.  However, due to the way we handle
relocations with block pools, we can't shrink the back end at all.  It's
probably best to not shrink in either direction.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105374
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106147
Tested-by: Eero Tamminen <eero.t.tamminen@intel.com>
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
Cc: mesa-stable@lists.freedesktop.org
src/intel/vulkan/anv_allocator.c

index f884ac3b8270f5e051827a6ea9fd077770629ccf..642e1618c10233befca6aee85f1d6c93e3825c29 100644 (file)
@@ -508,12 +508,12 @@ anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state)
       assert(center_bo_offset >= back_used);
 
       /* Make sure we don't shrink the back end of the pool */
-      if (center_bo_offset < pool->back_state.end)
-         center_bo_offset = pool->back_state.end;
+      if (center_bo_offset < back_required)
+         center_bo_offset = back_required;
 
       /* Make sure that we don't shrink the front end of the pool */
-      if (size - center_bo_offset < pool->state.end)
-         center_bo_offset = size - pool->state.end;
+      if (size - center_bo_offset < front_required)
+         center_bo_offset = size - front_required;
    }
 
    assert(center_bo_offset % PAGE_SIZE == 0);