Mesa (main): iris/bufmgr: Align vma addresses to 64K for local memory

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 24 16:52:04 UTC 2021


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

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Wed Jul 31 15:18:59 2019 -0700

iris/bufmgr: Align vma addresses to 64K for local memory

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5599>

---

 src/gallium/drivers/iris/iris_bufmgr.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_bufmgr.c b/src/gallium/drivers/iris/iris_bufmgr.c
index 58a062d6d20..c71ef24e4e6 100644
--- a/src/gallium/drivers/iris/iris_bufmgr.c
+++ b/src/gallium/drivers/iris/iris_bufmgr.c
@@ -186,6 +186,8 @@ struct iris_bufmgr {
 
    struct util_vma_heap vma_allocator[IRIS_MEMZONE_COUNT];
 
+   uint64_t vma_min_align;
+
    bool has_llc:1;
    bool has_mmap_offset:1;
    bool has_tiling_uapi:1;
@@ -305,8 +307,9 @@ vma_alloc(struct iris_bufmgr *bufmgr,
           uint64_t size,
           uint64_t alignment)
 {
-   /* Force alignment to be some number of pages */
-   alignment = ALIGN(alignment, PAGE_SIZE);
+   /* Force minimum alignment based on device requirements */
+   assert((alignment & (alignment - 1)) == 0);
+   alignment = MAX2(alignment, bufmgr->vma_min_align);
 
    if (memzone == IRIS_MEMZONE_BORDER_COLOR_POOL)
       return IRIS_BORDER_COLOR_POOL_ADDRESS;
@@ -1655,6 +1658,8 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse)
    bufmgr->handle_table =
       _mesa_hash_table_create(NULL, _mesa_hash_uint, _mesa_key_uint_equal);
 
+   bufmgr->vma_min_align = devinfo->has_local_mem ? 64 * 1024 : PAGE_SIZE;
+
    if (devinfo->has_aux_map) {
       bufmgr->aux_map_ctx = intel_aux_map_init(bufmgr, &aux_map_allocator,
                                                devinfo);



More information about the mesa-commit mailing list