Commit 818c158f authored by Pierre-Eric Pelloux-Prayer's avatar Pierre-Eric Pelloux-Prayer Committed by Alex Deucher
Browse files

drm/amdgpu: add VISIBLE info in amdgpu_bo_print_info



This allows tools to distinguish between VRAM and visible VRAM.

Use the opportunity to fix locking before accessing bo.

v2: squash in unused variable fix

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 8923137d
Loading
Loading
Loading
Loading
+21 −13
Original line number Diff line number Diff line
@@ -1575,14 +1575,18 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)
{
	struct dma_buf_attachment *attachment;
	struct dma_buf *dma_buf;
	unsigned int domain;
	const char *placement;
	unsigned int pin_count;
	u64 size;

	if (dma_resv_trylock(bo->tbo.base.resv)) {
		unsigned int domain;
		domain = amdgpu_mem_type_to_domain(bo->tbo.resource->mem_type);
		switch (domain) {
		case AMDGPU_GEM_DOMAIN_VRAM:
			if (amdgpu_bo_in_cpu_visible_vram(bo))
				placement = "VRAM VISIBLE";
			else
				placement = "VRAM";
			break;
		case AMDGPU_GEM_DOMAIN_GTT:
@@ -1593,6 +1597,10 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m)
			placement = "CPU";
			break;
		}
		dma_resv_unlock(bo->tbo.base.resv);
	} else {
		placement = "UNKNOWN";
	}

	size = amdgpu_bo_size(bo);
	seq_printf(m, "\t\t0x%08x: %12lld byte %s",