summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_device.c
diff options
context:
space:
mode:
authorScott D Phillips <[email protected]>2018-04-19 07:54:28 -0700
committerKenneth Graunke <[email protected]>2018-04-30 11:34:19 -0700
commit8ffc6ee251bdcf4a91916b73c1be71d58e680d34 (patch)
tree091d1ce053cd9ef6c35e4677b123187effd62816 /src/intel/vulkan/anv_device.c
parent1c5f4f4e17f74d823d9e38c678e40e9f49e2c053 (diff)
intel: fix check for 48b ppgtt support
The previous logic of the supports_48b_addresses wasn't actually checking if i915.ko was running with full_48bit_ppgtt. The ENOENT it was checking for was actually coming from the invalid context id provided in the test execbuffer. There is no path in the kernel driver where the presence of EXEC_OBJECT_SUPPORTS_48B_ADDRESS leads to an error. Instead, check the default context's GTT_SIZE param for a value greater than 4 GiB v2 (Ken): Fix in i965 as well. v3 Check GTT_SIZE instead of HAS_ALIASING_PPGTT (Chris Wilson) Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r--src/intel/vulkan/anv_device.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index b456d3d4c52..1c5dbb5189c 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -58,23 +58,8 @@ compiler_perf_log(void *data, const char *fmt, ...)
}
static VkResult
-anv_compute_heap_size(int fd, uint64_t *heap_size)
+anv_compute_heap_size(int fd, uint64_t gtt_size, uint64_t *heap_size)
{
- uint64_t gtt_size;
- if (anv_gem_get_context_param(fd, 0, I915_CONTEXT_PARAM_GTT_SIZE,
- &gtt_size) == -1) {
- /* If, for whatever reason, we can't actually get the GTT size from the
- * kernel (too old?) fall back to the aperture size.
- */
- anv_perf_warn(NULL, NULL,
- "Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");
-
- if (anv_gem_get_aperture(fd, &gtt_size) == -1) {
- return vk_errorf(NULL, NULL, VK_ERROR_INITIALIZATION_FAILED,
- "failed to get aperture size: %m");
- }
- }
-
/* Query the total ram from the system */
struct sysinfo info;
sysinfo(&info);
@@ -103,15 +88,26 @@ anv_compute_heap_size(int fd, uint64_t *heap_size)
static VkResult
anv_physical_device_init_heaps(struct anv_physical_device *device, int fd)
{
- /* The kernel query only tells us whether or not the kernel supports the
- * EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag and not whether or not the
- * hardware has actual 48bit address support.
- */
- device->supports_48bit_addresses =
- (device->info.gen >= 8) && anv_gem_supports_48b_addresses(fd);
+ uint64_t gtt_size;
+ if (anv_gem_get_context_param(fd, 0, I915_CONTEXT_PARAM_GTT_SIZE,
+ &gtt_size) == -1) {
+ /* If, for whatever reason, we can't actually get the GTT size from the
+ * kernel (too old?) fall back to the aperture size.
+ */
+ anv_perf_warn(NULL, NULL,
+ "Failed to get I915_CONTEXT_PARAM_GTT_SIZE: %m");
+
+ if (anv_gem_get_aperture(fd, &gtt_size) == -1) {
+ return vk_errorf(NULL, NULL, VK_ERROR_INITIALIZATION_FAILED,
+ "failed to get aperture size: %m");
+ }
+ }
+
+ device->supports_48bit_addresses = (device->info.gen >= 8) &&
+ gtt_size > (4ULL << 30 /* GiB */);
uint64_t heap_size = 0;
- VkResult result = anv_compute_heap_size(fd, &heap_size);
+ VkResult result = anv_compute_heap_size(fd, gtt_size, &heap_size);
if (result != VK_SUCCESS)
return result;