summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
diff options
context:
space:
mode:
authorJunwei Zhang <Jerry.Zhang@amd.com>2018-06-25 13:32:24 +0800
committerAlex Deucher <alexander.deucher@amd.com>2018-07-10 14:15:58 -0500
commitbb812f1ea87dd7a4f336242212219268393ed308 (patch)
tree2bc46b9bf43e7dd0882c867912e15e2d75cad4f8 /drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
parent7b7c6c81b3a370b46b0c48f4ab7ac3be83237a12 (diff)
downloadlinux-bb812f1ea87dd7a4f336242212219268393ed308.tar.gz
linux-bb812f1ea87dd7a4f336242212219268393ed308.tar.bz2
linux-bb812f1ea87dd7a4f336242212219268393ed308.zip
drm/amdgpu: allocate gart memory when it's required (v3)
Instead of calling gart address space on every bo pin, allocates it on demand v2: fix error handling v3: drop the change on amdgpu_amdkfd_gpuvm.c, not needed. Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com> Acked-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c')
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 02d83c97f10b..d2cc32add5f7 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3095,13 +3095,22 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
domain = AMDGPU_GEM_DOMAIN_VRAM;
r = amdgpu_bo_pin(rbo, domain);
- amdgpu_bo_unreserve(rbo);
-
if (unlikely(r != 0)) {
if (r != -ERESTARTSYS)
DRM_ERROR("Failed to pin framebuffer with error %d\n", r);
+ amdgpu_bo_unreserve(rbo);
+ return r;
+ }
+
+ r = amdgpu_ttm_alloc_gart(&rbo->tbo);
+ if (unlikely(r != 0)) {
+ amdgpu_bo_unpin(rbo);
+ amdgpu_bo_unreserve(rbo);
+ DRM_ERROR("%p bind failed\n", rbo);
return r;
}
+ amdgpu_bo_unreserve(rbo);
+
afb->address = amdgpu_bo_gpu_offset(rbo);
amdgpu_bo_ref(rbo);