Mesa (master): r600g/compute: solve a bug introduced by 2e01b8b440c1402c88a2755d89f40292e1f36ce5

Tom Stellard tstellar at kemper.freedesktop.org
Thu Jun 12 19:56:57 UTC 2014


Module: Mesa
Branch: master
Commit: 4f70d83089bb1fea3cda9aa050e5bbd7f3768734
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f70d83089bb1fea3cda9aa050e5bbd7f3768734

Author: Bruno Jiménez <brunojimen at gmail.com>
Date:   Wed Jun 11 17:28:01 2014 +0200

r600g/compute: solve a bug introduced by 2e01b8b440c1402c88a2755d89f40292e1f36ce5

That commit made possible that the items could be one just
after the other when their size was a multiple of ITEM_ALIGNMENT.
But compute_memory_prealloc_chunk still looked to leave a gap
between items. Resulting in that we got an infinite loop when
trying to add an item which would left no space between itself and
the next item.

Fixes piglit test: cl-custom-r600-create-release-buffer-bug
And the test for alignment I have just sent:
http://lists.freedesktop.org/archives/piglit/2014-June/011135.html

Sorry about this.

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

---

 src/gallium/drivers/r600/compute_memory_pool.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/compute_memory_pool.c b/src/gallium/drivers/r600/compute_memory_pool.c
index 2050f28..ec8c470 100644
--- a/src/gallium/drivers/r600/compute_memory_pool.c
+++ b/src/gallium/drivers/r600/compute_memory_pool.c
@@ -110,7 +110,7 @@ int64_t compute_memory_prealloc_chunk(
 
 	for (item = pool->item_list; item; item = item->next) {
 		if (item->start_in_dw > -1) {
-			if (item->start_in_dw-last_end > size_in_dw) {
+			if (last_end + size_in_dw <= item->start_in_dw) {
 				return last_end;
 			}
 




More information about the mesa-commit mailing list