summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-08 14:24:57 -0800
committerJason Ekstrand <[email protected]>2017-11-13 07:37:23 -0800
commit54a6f7eacaa25b328f8ed3cbfc0fd37bbbc59336 (patch)
tree05d256760b84c7d28a6436d734ceda549b5fcd9d
parent4122d008466cef47eaa3f958924618060f4e4330 (diff)
anv: Don't crash on invalid heap sizes when the PCI ID is overriden
-rw-r--r--src/intel/vulkan/anv_device.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 67028e8da9f..3aa213e205b 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -113,6 +113,18 @@ anv_physical_device_init_heaps(struct anv_physical_device *device, int fd)
if (result != VK_SUCCESS)
return result;
+ if (heap_size > (2ull << 30) && !device->supports_48bit_addresses) {
+ /* When running with an overridden PCI ID, we may get a GTT size from
+ * the kernel that is greater than 2 GiB but the execbuf check for 48bit
+ * address support can still fail. Just clamp the address space size to
+ * 2 GiB if we don't have 48-bit support.
+ */
+ intel_logw("%s:%d: The kernel reported a GTT size larger than 2 GiB but "
+ "not support for 48-bit addresses",
+ __FILE__, __LINE__);
+ heap_size = 2ull << 30;
+ }
+
if (heap_size <= 3ull * (1ull << 30)) {
/* In this case, everything fits nicely into the 32-bit address space,
* so there's no need for supporting 48bit addresses on client-allocated