Mesa (master): radv/winsys: Fix inequality for sparse buffer remapping.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jan 11 12:20:21 UTC 2021
Module: Mesa
Branch: master
Commit: 2b12e6931ef240df44d2c0f9374d6575ad202675
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2b12e6931ef240df44d2c0f9374d6575ad202675
Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date: Sun Dec 6 16:05:41 2020 +0100
radv/winsys: Fix inequality for sparse buffer remapping.
Found a case where we mapped a range too many.
Per the comment the constraint is:
/* [first, last] is exactly the range of ranges that either overlap the
* new parent, or are adjacent to it. This corresponds to the bind ranges
* that may change.
*/
So that means that after the ++last we the ranges[last] should still
be adjacent. So we need to test the post-increment value to see whether
it is adjacent.
Failure case:
ranges:
0: 0 - ffff
1: 10000 - 1ffff
2: 20000 - 2ffff
3: 30000 - 3ffff
new range: 10000 - 1ffff
wrong first, last: 0,3
However range 3 clearly isn't adjacent at all.
Fixes: 715df30a4e2 "radv/amdgpu: Add winsys implementation of virtual buffers."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7953>
---
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index c04767cd3c7..5433bfa4a75 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -194,7 +194,7 @@ radv_amdgpu_winsys_bo_virtual_bind(struct radeon_winsys_bo *_parent,
++first;
last = first;
- while(last + 1 < parent->range_count && parent->ranges[last].offset <= offset + size)
+ while(last + 1 < parent->range_count && parent->ranges[last + 1].offset <= offset + size)
++last;
/* Whether the first or last range are going to be totally removed or just
More information about the mesa-commit
mailing list