Commit 15486fd2 authored by Christian König's avatar Christian König Committed by Alex Deucher

drm/amdgpu: search only the BO list for VM mappings

Make UVD/VCE VM emulation more efficient.
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 1ea863fd
...@@ -928,30 +928,36 @@ struct amdgpu_bo_va_mapping * ...@@ -928,30 +928,36 @@ struct amdgpu_bo_va_mapping *
amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser, amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
uint64_t addr, struct amdgpu_bo **bo) uint64_t addr, struct amdgpu_bo **bo)
{ {
struct amdgpu_bo_list_entry *reloc;
struct amdgpu_bo_va_mapping *mapping; struct amdgpu_bo_va_mapping *mapping;
unsigned i;
if (!parser->bo_list)
return NULL;
addr /= AMDGPU_GPU_PAGE_SIZE; addr /= AMDGPU_GPU_PAGE_SIZE;
list_for_each_entry(reloc, &parser->validated, tv.head) { for (i = 0; i < parser->bo_list->num_entries; i++) {
if (!reloc->bo_va) struct amdgpu_bo_list_entry *lobj;
lobj = &parser->bo_list->array[i];
if (!lobj->bo_va)
continue; continue;
list_for_each_entry(mapping, &reloc->bo_va->valids, list) { list_for_each_entry(mapping, &lobj->bo_va->valids, list) {
if (mapping->it.start > addr || if (mapping->it.start > addr ||
addr > mapping->it.last) addr > mapping->it.last)
continue; continue;
*bo = reloc->bo_va->bo; *bo = lobj->bo_va->bo;
return mapping; return mapping;
} }
list_for_each_entry(mapping, &reloc->bo_va->invalids, list) { list_for_each_entry(mapping, &lobj->bo_va->invalids, list) {
if (mapping->it.start > addr || if (mapping->it.start > addr ||
addr > mapping->it.last) addr > mapping->it.last)
continue; continue;
*bo = reloc->bo_va->bo; *bo = lobj->bo_va->bo;
return mapping; return mapping;
} }
} }
......
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