Commit f2863650 authored by Yunxiang Li's avatar Yunxiang Li Committed by Alex Deucher
Browse files

drm/amdgpu: make drm-memory-* report resident memory



The old behavior reports the resident memory usage for this key and the
documentation say so as well. However this was accidentally changed to
include buffers that was evicted.

Fixes: 04bdba46 ("drm/amdgpu: Use drm_print_memory_stats helper from fdinfo")
Signed-off-by: default avatarYunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent a1144da7
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <drm/amdgpu_drm.h>
#include <drm/drm_debugfs.h>
#include <drm/drm_drv.h>
#include <drm/drm_file.h>

#include "amdgpu.h"
#include "amdgpu_vm.h"
@@ -95,11 +96,11 @@ void amdgpu_show_fdinfo(struct drm_printer *p, struct drm_file *file)

	/* Legacy amdgpu keys, alias to drm-resident-memory-: */
	drm_printf(p, "drm-memory-vram:\t%llu KiB\n",
		   stats[TTM_PL_VRAM].total/1024UL);
		   stats[TTM_PL_VRAM].drm.resident/1024UL);
	drm_printf(p, "drm-memory-gtt: \t%llu KiB\n",
		   stats[TTM_PL_TT].total/1024UL);
		   stats[TTM_PL_TT].drm.resident/1024UL);
	drm_printf(p, "drm-memory-cpu: \t%llu KiB\n",
		   stats[TTM_PL_SYSTEM].total/1024UL);
		   stats[TTM_PL_SYSTEM].drm.resident/1024UL);

	/* Amdgpu specific memory accounting keys: */
	drm_printf(p, "amd-memory-visible-vram:\t%llu KiB\n",
+0 −1
Original line number Diff line number Diff line
@@ -1224,7 +1224,6 @@ void amdgpu_bo_get_memory(struct amdgpu_bo *bo,

	/* DRM stats common fields: */

	stats[type].total += size;
	if (drm_gem_object_is_shared_for_memory_stats(obj))
		stats[type].drm.shared += size;
	else
+0 −1
Original line number Diff line number Diff line
@@ -142,7 +142,6 @@ struct amdgpu_bo_vm {
struct amdgpu_mem_stats {
	struct drm_memory_stats drm;

	uint64_t total;
	uint64_t visible;
	uint64_t evicted;
	uint64_t evicted_visible;