diff options
author | Dave Airlie <airlied@redhat.com> | 2020-08-07 09:04:50 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2020-08-10 10:33:35 +1000 |
commit | 4f297b9c82e1a43d2c02a687aa134e1b7318b7e6 (patch) | |
tree | c77f5992bd548848f03324c5e8688aace8422798 /drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | |
parent | 87154ff86bf69ecf76600e56ecab0b79fc3f71ea (diff) |
drm/amdgpu/ttm: move vram/gtt mgr allocations to mman.
Christian suggested this and it makes sense.
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200806233459.4057784-2-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c index 895634cbf999..a41a8abc9927 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c @@ -28,15 +28,6 @@ #include "amdgpu_atomfirmware.h" #include "atom.h" -struct amdgpu_vram_mgr { - struct ttm_resource_manager manager; - struct drm_mm mm; - spinlock_t lock; - atomic64_t usage; - atomic64_t vis_usage; - struct amdgpu_device *adev; -}; - static inline struct amdgpu_vram_mgr *to_vram_mgr(struct ttm_resource_manager *man) { return container_of(man, struct amdgpu_vram_mgr, manager); @@ -177,16 +168,10 @@ static const struct ttm_resource_manager_func amdgpu_vram_mgr_func; */ int amdgpu_vram_mgr_init(struct amdgpu_device *adev) { - struct ttm_resource_manager *man; - struct amdgpu_vram_mgr *mgr; + struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; + struct ttm_resource_manager *man = &mgr->manager; int ret; - mgr = kzalloc(sizeof(*mgr), GFP_KERNEL); - if (!mgr) - return -ENOMEM; - - man = &mgr->manager; - man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; man->default_caching = TTM_PL_FLAG_WC; @@ -219,8 +204,8 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev) */ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev) { - struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM); - struct amdgpu_vram_mgr *mgr = to_vram_mgr(man); + struct amdgpu_vram_mgr *mgr = &adev->mman.vram_mgr; + struct ttm_resource_manager *man = &mgr->manager; int ret; ttm_resource_manager_set_used(man, false); @@ -237,7 +222,6 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev) ttm_resource_manager_cleanup(man); ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, NULL); - kfree(mgr); } /** |