mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 00:40:09 +01:00
anv/trtt: fix the creation of sparse buffers of size 2^32 on 32bit systems
When the VkBuffer is of size 2^32 (which matches maxBufferSize), we
have vm_bind->size set to 2^32, which is fine because it fits in an
uint64_t. What is not fine is the 'i' variable being size_t, because
on 32bit systems it will loop forever since it will always be smaller
than 2^32.
Credits to Iván for not only reporting it, but also coming up with the
solution at the same time as I did, then testing it.
Cc: mesa-stable
Reported-by: Iván Briano <ivan.briano@intel.com>
Reviewed-by: Iván Briano <ivan.briano@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31698>
(cherry picked from commit da396a49a0)
This commit is contained in:
parent
62d11bb250
commit
70432dfcfd
2 changed files with 2 additions and 2 deletions
|
|
@ -1354,7 +1354,7 @@
|
|||
"description": "anv/trtt: fix the creation of sparse buffers of size 2^32 on 32bit systems",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -675,7 +675,7 @@ anv_sparse_bind_trtt(struct anv_device *device,
|
|||
uint32_t n_l3l2_binds = 0, n_l1_binds = 0;
|
||||
for (int b = 0; b < sparse_submit->binds_len && result == VK_SUCCESS; b++) {
|
||||
struct anv_vm_bind *vm_bind = &sparse_submit->binds[b];
|
||||
for (size_t i = 0; i < vm_bind->size && result == VK_SUCCESS; i += 64 * 1024) {
|
||||
for (uint64_t i = 0; i < vm_bind->size && result == VK_SUCCESS; i += 64 * 1024) {
|
||||
uint64_t trtt_addr = vm_bind->address + i;
|
||||
uint64_t dest_addr =
|
||||
(vm_bind->op == ANV_VM_BIND && vm_bind->bo) ?
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue