Commit 36409d12 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: cleanup amdgpu_cs_list_validate

No need to actually check the current placement. Just use the allowed domains
when the threshold is reached.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f69f90a1
...@@ -342,31 +342,29 @@ int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, ...@@ -342,31 +342,29 @@ int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
struct amdgpu_fpriv *fpriv = p->filp->driver_priv; struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
struct amdgpu_vm *vm = &fpriv->vm; struct amdgpu_vm *vm = &fpriv->vm;
struct amdgpu_bo_list_entry *lobj; struct amdgpu_bo_list_entry *lobj;
struct amdgpu_bo *bo;
u64 initial_bytes_moved; u64 initial_bytes_moved;
int r; int r;
list_for_each_entry(lobj, validated, tv.head) { list_for_each_entry(lobj, validated, tv.head) {
bo = lobj->robj; struct amdgpu_bo *bo = lobj->robj;
if (!bo->pin_count) { uint32_t domain;
u32 domain = lobj->prefered_domains;
u32 current_domain = lobj->bo_va = amdgpu_vm_bo_find(vm, bo);
amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); if (bo->pin_count)
continue;
/* Check if this buffer will be moved and don't move it
* if we have moved too many buffers for this IB already. /* Avoid moving this one if we have moved too many buffers
* for this IB already.
* *
* Note that this allows moving at least one buffer of * Note that this allows moving at least one buffer of
* any size, because it doesn't take the current "bo" * any size, because it doesn't take the current "bo"
* into account. We don't want to disallow buffer moves * into account. We don't want to disallow buffer moves
* completely. * completely.
*/ */
if ((lobj->allowed_domains & current_domain) != 0 && if (p->bytes_moved <= p->bytes_moved_threshold)
(domain & current_domain) == 0 && /* will be moved */ domain = lobj->prefered_domains;
p->bytes_moved > p->bytes_moved_threshold) { else
/* don't move it */ domain = lobj->allowed_domains;
domain = current_domain;
}
retry: retry:
amdgpu_ttm_placement_from_domain(bo, domain); amdgpu_ttm_placement_from_domain(bo, domain);
...@@ -383,8 +381,6 @@ int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, ...@@ -383,8 +381,6 @@ int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p,
return r; return r;
} }
} }
lobj->bo_va = amdgpu_vm_bo_find(vm, bo);
}
return 0; return 0;
} }
......
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