mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 23:03:57 -04:00
drm/amdgpu: expose more memory stats in fdinfo
This will be used for performance investigations. Signed-off-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
28f7e89718
commit
d6530c33a9
@@ -1265,24 +1265,41 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
|
||||
trace_amdgpu_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
|
||||
}
|
||||
|
||||
void amdgpu_bo_get_memory(struct amdgpu_bo *bo, uint64_t *vram_mem,
|
||||
uint64_t *gtt_mem, uint64_t *cpu_mem)
|
||||
void amdgpu_bo_get_memory(struct amdgpu_bo *bo,
|
||||
struct amdgpu_mem_stats *stats)
|
||||
{
|
||||
unsigned int domain;
|
||||
uint64_t size = amdgpu_bo_size(bo);
|
||||
|
||||
domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
|
||||
switch (domain) {
|
||||
case AMDGPU_GEM_DOMAIN_VRAM:
|
||||
*vram_mem += amdgpu_bo_size(bo);
|
||||
stats->vram += size;
|
||||
if (amdgpu_bo_in_cpu_visible_vram(bo))
|
||||
stats->visible_vram += size;
|
||||
break;
|
||||
case AMDGPU_GEM_DOMAIN_GTT:
|
||||
*gtt_mem += amdgpu_bo_size(bo);
|
||||
stats->gtt += size;
|
||||
break;
|
||||
case AMDGPU_GEM_DOMAIN_CPU:
|
||||
default:
|
||||
*cpu_mem += amdgpu_bo_size(bo);
|
||||
stats->cpu += size;
|
||||
break;
|
||||
}
|
||||
|
||||
if (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) {
|
||||
stats->requested_vram += size;
|
||||
if (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
|
||||
stats->requested_visible_vram += size;
|
||||
|
||||
if (domain != AMDGPU_GEM_DOMAIN_VRAM) {
|
||||
stats->evicted_vram += size;
|
||||
if (bo->flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
|
||||
stats->evicted_visible_vram += size;
|
||||
}
|
||||
} else if (bo->preferred_domains & AMDGPU_GEM_DOMAIN_GTT) {
|
||||
stats->requested_gtt += size;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user