diff options
author | Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> | 2020-12-06 16:05:41 +0100 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2021-01-12 15:27:40 -0800 |
commit | 107e4eea53e0bc05ee7176b5d0066416986d7862 (patch) | |
tree | b7f1d58b2b3a7b498f71d90c451367644964ff21 | |
parent | bf4e0a4b3e16fb08382bd404b4178fff657414c3 (diff) |
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@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7953>
(cherry picked from commit 2b12e6931ef240df44d2c0f9374d6575ad202675)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/.pick_status.json b/.pick_status.json index 4695c3c5de0..41e324e0967 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -994,7 +994,7 @@ "description": "radv/winsys: Fix inequality for sparse buffer remapping.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "715df30a4e27a76917d6172e68fd7f4c3ff1fb9d" }, diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c index ee274552355..2f58f4f2edd 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c @@ -193,7 +193,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 |