anv/tr-tt: assert the bind size is a multiple of the granularity

If the size here is not a multiple of the granularity (64kb) then
we'll miss our "pages" estimation by 1. We could fix this with
DIV_ROUND_UP() or by simply putting a "+1" there, but the upper layers
should now be preventing this case so let's just put the assertion
here.

Previously it was possible to hit this case with Zink by running
under certain conditions piglit/arb_sparse_buffer-basic.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26454>
This commit is contained in:
Paulo Zanoni
2023-11-30 16:01:38 -08:00
committed by Marge Bot
parent c87f7c13fa
commit 181aa83027
+1
View File
@@ -545,6 +545,7 @@ anv_sparse_bind_trtt(struct anv_device *device,
int l3l2_binds_capacity = 1;
int l1_binds_capacity = 0;
for (int b = 0; b < sparse_submit->binds_len; b++) {
assert(sparse_submit->binds[b].size % (64 * 1024) == 0);
int pages = sparse_submit->binds[b].size / (64 * 1024);
l1_binds_capacity += pages;
l3l2_binds_capacity += (pages / 1024 + 1) * 2;