[Mesa-dev] [PATCH 05/20] radeonsi: return correct eviction stats for NVX_gpu_memory_info

Marek Olšák maraeo at gmail.com
Mon Aug 29 15:28:20 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeon/r600_pipe_common.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index b1da22f..32486c8 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -1055,22 +1055,27 @@ static void r600_query_memory_info(struct pipe_screen *screen,
 
 	info->avail_device_memory =
 		vram_usage <= info->total_device_memory ?
 				info->total_device_memory - vram_usage : 0;
 	info->avail_staging_memory =
 		gtt_usage <= info->total_staging_memory ?
 				info->total_staging_memory - gtt_usage : 0;
 
 	info->device_memory_evicted =
 		ws->query_value(ws, RADEON_NUM_BYTES_MOVED) / 1024;
-	/* Just return the number of evicted 64KB pages. */
-	info->nr_device_memory_evictions = info->device_memory_evicted / 64;
+
+	if (rscreen->info.drm_major == 3 && rscreen->info.drm_minor >= 4)
+		info->nr_device_memory_evictions =
+			ws->query_value(ws, RADEON_NUM_EVICTIONS);
+	else
+		/* Just return the number of evicted 64KB pages. */
+		info->nr_device_memory_evictions = info->device_memory_evicted / 64;
 }
 
 struct pipe_resource *r600_resource_create_common(struct pipe_screen *screen,
 						  const struct pipe_resource *templ)
 {
 	struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
 
 	if (templ->target == PIPE_BUFFER) {
 		return r600_buffer_create(screen, templ,
 					  rscreen->info.gart_page_size);
-- 
2.7.4



More information about the mesa-dev mailing list