summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorJan Vesely <[email protected]>2014-06-19 20:20:00 +0200
committerTom Stellard <[email protected]>2014-06-24 12:36:55 -0400
commit9575225e12c66bf409ce2269400f9ad148ffe0a2 (patch)
tree3fe00a6de301e622627f53e4f38bb47167ee9ecb /src/gallium
parent0c181cdc6c0efdd98927b010239e0376399cecbf (diff)
r600g/compute: Fix possible endless loop in compute_memory_pool allocations.
The important part is the change of the condition to <= 0. Otherwise the loop gets stuck never actually growing the pool. The change in the aux-need calculation guarantees max 2 iterations, and avoids wasting memory in case a smaller item can't fit into a relatively larger pool. Reviewed-by: Bruno JimĂ©nez <[email protected]> Signed-off-by: Jan Vesely <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/r600/compute_memory_pool.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index 691c9383f15..9cb16f8c29e 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -323,8 +323,11 @@ int compute_memory_promote_item(struct compute_memory_pool *pool,
int64_t need = item->size_in_dw + 2048 -
(pool->size_in_dw - allocated);
- if (need < 0) {
- need = pool->size_in_dw / 10;
+ if (need <= 0) {
+ /* There's enough free space, but it's too
+ * fragmented. Assume half of the item can fit
+ * int the last chunk */
+ need = (item->size_in_dw / 2) + ITEM_ALIGNMENT;
}
need = align(need, ITEM_ALIGNMENT);