Skip to content

Commit 073997c

Browse files
amingriyuealexdeucher
authored andcommitted
Revert "drm/amdgpu: Don't change preferred domian when fallback GTT v5"
This reverts commit bbaf1871ea1d7b7021e350a3e8bb1ec8408c2030. Felix reports this commit causes regression. Signed-off-by: Chunming Zhou <david1.zhou@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 46bce67 commit 073997c

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,23 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
5656
alignment = PAGE_SIZE;
5757
}
5858

59+
retry:
5960
r = amdgpu_bo_create(adev, size, alignment, initial_domain,
6061
flags, type, resv, &bo);
6162
if (r) {
62-
DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
63-
size, initial_domain, alignment, r);
63+
if (r != -ERESTARTSYS) {
64+
if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
65+
flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
66+
goto retry;
67+
}
68+
69+
if (initial_domain == AMDGPU_GEM_DOMAIN_VRAM) {
70+
initial_domain |= AMDGPU_GEM_DOMAIN_GTT;
71+
goto retry;
72+
}
73+
DRM_DEBUG("Failed to allocate GEM object (%ld, %d, %u, %d)\n",
74+
size, initial_domain, alignment, r);
75+
}
6476
return r;
6577
}
6678
*obj = &bo->gem_base;

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size,
356356
struct amdgpu_bo *bo;
357357
unsigned long page_align;
358358
size_t acc_size;
359-
u32 domains;
360359
int r;
361360

362361
page_align = roundup(byte_align, PAGE_SIZE) >> PAGE_SHIFT;
@@ -418,23 +417,12 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size,
418417
#endif
419418

420419
bo->tbo.bdev = &adev->mman.bdev;
421-
domains = bo->preferred_domains;
422-
retry:
423-
amdgpu_ttm_placement_from_domain(bo, domains);
420+
amdgpu_ttm_placement_from_domain(bo, domain);
421+
424422
r = ttm_bo_init_reserved(&adev->mman.bdev, &bo->tbo, size, type,
425423
&bo->placement, page_align, &ctx, acc_size,
426424
NULL, resv, &amdgpu_ttm_bo_destroy);
427-
428-
if (unlikely(r && r != -ERESTARTSYS)) {
429-
if (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
430-
bo->flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
431-
goto retry;
432-
} else if (domains != bo->allowed_domains) {
433-
domains = bo->allowed_domains;
434-
goto retry;
435-
}
436-
}
437-
if (unlikely(r))
425+
if (unlikely(r != 0))
438426
return r;
439427

440428
if (adev->gmc.visible_vram_size < adev->gmc.real_vram_size &&

0 commit comments

Comments
 (0)