Skip to content
This repository was archived by the owner on Sep 4, 2024. It is now read-only.

Commit 117130b

Browse files
lumag1ace
authored andcommitted
tu: Pass real size of prime buffers to allocator
The msm driver reserves the actual DMABUF size in the memory map, while TU can request smaller memory chunk to be allocated. This potentially can lead to a situation when next allocation IOVA will be in the middle of the address space which is reserved for the DMABUF. Pass the `real_size' to TU allocator instead, so that kernel and userspace have the same picture of memory allocations. Cc: mesa-stable Signed-off-by: Dmitry Baryshkov <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24861> (cherry picked from commit 2fdcc00)
1 parent ea31da6 commit 117130b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.pick_status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
"description": "tu: Pass real size of prime buffers to allocator",
356356
"nominated": true,
357357
"nomination_type": 0,
358-
"resolution": 0,
358+
"resolution": 1,
359359
"main_sha": null,
360360
"because_sha": null
361361
},

src/freedreno/vulkan/tu_knl_drm_msm.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,9 @@ msm_bo_init_dmabuf(struct tu_device *dev,
491491
if (real_size < 0 || (uint64_t) real_size < size)
492492
return vk_error(dev, VK_ERROR_INVALID_EXTERNAL_HANDLE);
493493

494+
/* iova allocation needs to consider the object's *real* size: */
495+
size = real_size;
496+
494497
/* Importing the same dmabuf several times would yield the same
495498
* gem_handle. Thus there could be a race when destroying
496499
* BO and importing the same dmabuf from different threads.

0 commit comments

Comments
 (0)