diff options
author | Chunming Zhou <david1.zhou@amd.com> | 2018-04-16 23:52:53 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-15 14:43:31 -0400 |
commit | aa2b2e2822831d78a283edb12cf8b7da21bdd0ed (patch) | |
tree | 745a77d0e92a3e04254a8b0bb2c4dfc113afebcf /drivers/gpu/drm/amd/amdgpu | |
parent | 58cd8fbc64b03d0e9961d627526bd07edbea00b9 (diff) |
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: Chunming Zhou <david1.zhou@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/amdgpu')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 |
3 files changed, 11 insertions, 6 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 1200c5ba37da..ff606ce88837 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | |||
@@ -62,6 +62,7 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size, | |||
62 | bp.byte_align = alignment; | 62 | bp.byte_align = alignment; |
63 | bp.type = type; | 63 | bp.type = type; |
64 | bp.resv = resv; | 64 | bp.resv = resv; |
65 | bp.preferred_domain = initial_domain; | ||
65 | retry: | 66 | retry: |
66 | bp.flags = flags; | 67 | bp.flags = flags; |
67 | bp.domain = initial_domain; | 68 | bp.domain = initial_domain; |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index cac65e32a0b9..9258f0694922 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
@@ -360,6 +360,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
360 | }; | 360 | }; |
361 | struct amdgpu_bo *bo; | 361 | struct amdgpu_bo *bo; |
362 | unsigned long page_align, size = bp->size; | 362 | unsigned long page_align, size = bp->size; |
363 | u32 preferred_domains; | ||
363 | size_t acc_size; | 364 | size_t acc_size; |
364 | int r; | 365 | int r; |
365 | 366 | ||
@@ -380,12 +381,14 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
380 | drm_gem_private_object_init(adev->ddev, &bo->gem_base, size); | 381 | drm_gem_private_object_init(adev->ddev, &bo->gem_base, size); |
381 | INIT_LIST_HEAD(&bo->shadow_list); | 382 | INIT_LIST_HEAD(&bo->shadow_list); |
382 | INIT_LIST_HEAD(&bo->va); | 383 | INIT_LIST_HEAD(&bo->va); |
383 | bo->preferred_domains = bp->domain & (AMDGPU_GEM_DOMAIN_VRAM | | 384 | preferred_domains = bp->preferred_domain ? bp->preferred_domain : |
384 | AMDGPU_GEM_DOMAIN_GTT | | 385 | bp->domain; |
385 | AMDGPU_GEM_DOMAIN_CPU | | 386 | bo->preferred_domains = preferred_domains & (AMDGPU_GEM_DOMAIN_VRAM | |
386 | AMDGPU_GEM_DOMAIN_GDS | | 387 | AMDGPU_GEM_DOMAIN_GTT | |
387 | AMDGPU_GEM_DOMAIN_GWS | | 388 | AMDGPU_GEM_DOMAIN_CPU | |
388 | AMDGPU_GEM_DOMAIN_OA); | 389 | AMDGPU_GEM_DOMAIN_GDS | |
390 | AMDGPU_GEM_DOMAIN_GWS | | ||
391 | AMDGPU_GEM_DOMAIN_OA); | ||
389 | bo->allowed_domains = bo->preferred_domains; | 392 | bo->allowed_domains = bo->preferred_domains; |
390 | if (bp->type != ttm_bo_type_kernel && | 393 | if (bp->type != ttm_bo_type_kernel && |
391 | bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM) | 394 | bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index e9a21d991e77..540e03fa159f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | |||
@@ -37,6 +37,7 @@ struct amdgpu_bo_param { | |||
37 | unsigned long size; | 37 | unsigned long size; |
38 | int byte_align; | 38 | int byte_align; |
39 | u32 domain; | 39 | u32 domain; |
40 | u32 preferred_domain; | ||
40 | u64 flags; | 41 | u64 flags; |
41 | enum ttm_bo_type type; | 42 | enum ttm_bo_type type; |
42 | struct reservation_object *resv; | 43 | struct reservation_object *resv; |