Module: Mesa
Branch: main
Commit: 181aa83027e9d48985f625cfdf81fb1953885a97
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=181aa83027e9d48985f625cfdf81fb1953885a97

Author: Paulo Zanoni <paulo.r.zan...@intel.com>
Date:   Thu Nov 30 16:01:38 2023 -0800

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.landwer...@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zan...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26454>

---

 src/intel/vulkan/anv_sparse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c
index 15ea0e3b2df..53002a7cdc2 100644
--- a/src/intel/vulkan/anv_sparse.c
+++ b/src/intel/vulkan/anv_sparse.c
@@ -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;

Reply via email to