radv: Fix vram override with fully visible VRAM.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 8 Feb 2021 14:24:30 +0000 (15:24 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 9 Feb 2021 11:58:53 +0000 (11:58 +0000)
Fixes: cf2eebdf4f1 ("radv,gallium: Add driconf option to reduce advertised VRAM size.")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8915>

src/amd/vulkan/radv_device.c

index b0331e9..978bbbe 100644 (file)
@@ -153,7 +153,8 @@ radv_get_visible_vram_size(struct radv_physical_device *device)
 static uint64_t
 radv_get_vram_size(struct radv_physical_device *device)
 {
-       return radv_get_adjusted_vram_size(device) - device->rad_info.vram_vis_size;
+       uint64_t total_size = radv_get_adjusted_vram_size(device);
+       return total_size - MIN2(total_size, device->rad_info.vram_vis_size);
 }
 
 enum radv_heap {