radeonsi: return correct eviction stats for NVX_gpu_memory_info
authorMarek Olšák <marek.olsak@amd.com>
Sun, 21 Aug 2016 10:00:01 +0000 (12:00 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 5 Sep 2016 16:01:15 +0000 (18:01 +0200)
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_pipe_common.c

index 1b15594bbd20e5c6d4adc3ac7e9912d0f6a4dace..825e4e98658e4dad2410baeea8882f281e9f2690 100644 (file)
@@ -1070,8 +1070,13 @@ static void r600_query_memory_info(struct pipe_screen *screen,
 
        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,