]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/xe: Simplify xe_res_get_buddy()
authorBrian Welty <brian.welty@intel.com>
Tue, 26 Sep 2023 20:59:37 +0000 (13:59 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:43:19 +0000 (11:43 -0500)
We can remove the unnecessary indirection thru xe->tiles[] to get
the TTM VRAM manager.  This code can be common for VRAM and STOLEN.

Signed-off-by: Brian Welty <brian.welty@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_res_cursor.h

index 5cb4b66a5d74855884e2c3465c9b9ec863486f46..006fc1361967e00142384ad47f7906d872f61c8b 100644 (file)
@@ -50,14 +50,9 @@ struct xe_res_cursor {
 
 static struct drm_buddy *xe_res_get_buddy(struct ttm_resource *res)
 {
-       struct xe_device *xe = ttm_to_xe_device(res->bo->bdev);
        struct ttm_resource_manager *mgr;
 
-       if (res->mem_type != XE_PL_STOLEN)
-               return &xe->tiles[res->mem_type - XE_PL_VRAM0].mem.vram_mgr->mm;
-
-       mgr = ttm_manager_type(&xe->ttm, XE_PL_STOLEN);
-
+       mgr = ttm_manager_type(res->bo->bdev, res->mem_type);
        return &to_xe_ttm_vram_mgr(mgr)->mm;
 }