Commit aa2b2e28 authored by Chunming Zhou's avatar Chunming Zhou Committed by Alex Deucher

drm/amdgpu: set preferred_domain independent of fallback handling

When GEM needs to fallback to GTT for VRAM BOs we still want the
preferred domain to be untouched so that the BO has a cance to move back
to VRAM in the future.
Signed-off-by: default avatarChunming Zhou <david1.zhou@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 58cd8fbc
...@@ -62,6 +62,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, ...@@ -62,6 +62,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
bp.byte_align = alignment; bp.byte_align = alignment;
bp.type = type; bp.type = type;
bp.resv = resv; bp.resv = resv;
bp.preferred_domain = initial_domain;
retry: retry:
bp.flags = flags; bp.flags = flags;
bp.domain = initial_domain; bp.domain = initial_domain;
......
...@@ -360,6 +360,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, ...@@ -360,6 +360,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
}; };
struct amdgpu_bo *bo; struct amdgpu_bo *bo;
unsigned long page_align, size = bp->size; unsigned long page_align, size = bp->size;
u32 preferred_domains;
size_t acc_size; size_t acc_size;
int r; int r;
...@@ -380,7 +381,9 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, ...@@ -380,7 +381,9 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev,
drm_gem_private_object_init(adev->ddev, &bo->gem_base, size); drm_gem_private_object_init(adev->ddev, &bo->gem_base, size);
INIT_LIST_HEAD(&bo->shadow_list); INIT_LIST_HEAD(&bo->shadow_list);
INIT_LIST_HEAD(&bo->va); INIT_LIST_HEAD(&bo->va);
bo->preferred_domains = bp->domain & (AMDGPU_GEM_DOMAIN_VRAM | preferred_domains = bp->preferred_domain ? bp->preferred_domain :
bp->domain;
bo->preferred_domains = preferred_domains & (AMDGPU_GEM_DOMAIN_VRAM |
AMDGPU_GEM_DOMAIN_GTT | AMDGPU_GEM_DOMAIN_GTT |
AMDGPU_GEM_DOMAIN_CPU | AMDGPU_GEM_DOMAIN_CPU |
AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GDS |
......
...@@ -37,6 +37,7 @@ struct amdgpu_bo_param { ...@@ -37,6 +37,7 @@ struct amdgpu_bo_param {
unsigned long size; unsigned long size;
int byte_align; int byte_align;
u32 domain; u32 domain;
u32 preferred_domain;
u64 flags; u64 flags;
enum ttm_bo_type type; enum ttm_bo_type type;
struct reservation_object *resv; struct reservation_object *resv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment