aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-06-30 04:41:07 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-07-14 11:05:59 -0400
commit98a7f88ce9a9ed26cea939558f33e3d483cfb4f0 (patch)
tree9a7b8c40e96b9e8ec7128cc66b2f369f30c39bfe /drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
parent92c60d9cf6636fdf740ebc98af0d68426f07b19b (diff)
drm/amdgpu: bind BOs with GTT space allocated directly v2
This avoids binding them later on. v2: fix typo in function name Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
index f7d22c44034d..1ef625550442 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
@@ -81,6 +81,20 @@ static int amdgpu_gtt_mgr_fini(struct ttm_mem_type_manager *man)
81} 81}
82 82
83/** 83/**
84 * amdgpu_gtt_mgr_is_allocated - Check if mem has address space
85 *
86 * @mem: the mem object to check
87 *
88 * Check if a mem object has already address space allocated.
89 */
90bool amdgpu_gtt_mgr_is_allocated(struct ttm_mem_reg *mem)
91{
92 struct drm_mm_node *node = mem->mm_node;
93
94 return (node->start != AMDGPU_BO_INVALID_OFFSET);
95}
96
97/**
84 * amdgpu_gtt_mgr_alloc - allocate new ranges 98 * amdgpu_gtt_mgr_alloc - allocate new ranges
85 * 99 *
86 * @man: TTM memory type manager 100 * @man: TTM memory type manager
@@ -101,7 +115,7 @@ int amdgpu_gtt_mgr_alloc(struct ttm_mem_type_manager *man,
101 unsigned long fpfn, lpfn; 115 unsigned long fpfn, lpfn;
102 int r; 116 int r;
103 117
104 if (node->start != AMDGPU_BO_INVALID_OFFSET) 118 if (amdgpu_gtt_mgr_is_allocated(mem))
105 return 0; 119 return 0;
106 120
107 if (place) 121 if (place)