Mesa (staging/19.2): ac: fix incorrect vram_size reported by the kernel

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 1 22:31:05 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: 0a2285b1d455067cddec763b65a21631db0faf0f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a2285b1d455067cddec763b65a21631db0faf0f

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Tue Sep 24 16:47:05 2019 -0400

ac: fix incorrect vram_size reported by the kernel

Cc: 19.2 <mesa-stable at lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
(cherry picked from commit 7d97013294816db46abb7d1e7c6871fe73dfac93)

---

 src/amd/common/ac_gpu_info.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c
index 9ec7359ed79..4b49845360d 100644
--- a/src/amd/common/ac_gpu_info.c
+++ b/src/amd/common/ac_gpu_info.c
@@ -92,6 +92,14 @@ static bool has_syncobj(int fd)
 	return value ? true : false;
 }
 
+static uint64_t fix_vram_size(uint64_t size)
+{
+	/* The VRAM size is underreported, so we need to fix it, because
+	 * it's used to compute the number of memory modules for harvesting.
+	 */
+	return align64(size, 256*1024*1024);
+}
+
 bool ac_query_gpu_info(int fd, void *dev_p,
 		       struct radeon_info *info,
 		       struct amdgpu_gpu_info *amdinfo)
@@ -265,7 +273,7 @@ bool ac_query_gpu_info(int fd, void *dev_p,
 
 		/* Note: usable_heap_size values can be random and can't be relied on. */
 		info->gart_size = meminfo.gtt.total_heap_size;
-		info->vram_size = meminfo.vram.total_heap_size;
+		info->vram_size = fix_vram_size(meminfo.vram.total_heap_size);
 		info->vram_vis_size = meminfo.cpu_accessible_vram.total_heap_size;
 	} else {
 		/* This is a deprecated interface, which reports usable sizes
@@ -296,7 +304,7 @@ bool ac_query_gpu_info(int fd, void *dev_p,
 		}
 
 		info->gart_size = gtt.heap_size;
-		info->vram_size = vram.heap_size;
+		info->vram_size = fix_vram_size(vram.heap_size);
 		info->vram_vis_size = vram_vis.heap_size;
 	}
 




More information about the mesa-commit mailing list