[Mesa-dev] [PATCH 1/3] intel: fix check for 48b ppgtt support

Kenneth Graunke kenneth at whitecape.org
Wed Apr 18 21:22:54 UTC 2018


From: Scott D Phillips <scott.d.phillips at intel.com>

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 HAS_ALIASING_PPGTT param for the value 3 which
corresponds with full_48bit_ppgtt.

v2 (Ken): Fix in i965 as well.
---
 src/intel/vulkan/anv_device.c          |  4 ++--
 src/intel/vulkan/anv_gem.c             | 18 ------------------
 src/intel/vulkan/anv_gem_stubs.c       |  6 ------
 src/intel/vulkan/anv_private.h         |  1 -
 src/mesa/drivers/dri/i965/brw_bufmgr.c | 22 ++--------------------
 5 files changed, 4 insertions(+), 47 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 7522b7865c2..116574cb978 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -107,8 +107,8 @@ anv_physical_device_init_heaps(struct anv_physical_device *device, int fd)
     * 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);
+   device->supports_48bit_addresses = (device->info.gen >= 8) &&
+      anv_gem_get_param(fd, I915_PARAM_HAS_ALIASING_PPGTT) == 3;
 
    uint64_t heap_size = 0;
    VkResult result = anv_compute_heap_size(fd, &heap_size);
diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c
index 2a8f8b14b7e..3ba6d198a8a 100644
--- a/src/intel/vulkan/anv_gem.c
+++ b/src/intel/vulkan/anv_gem.c
@@ -377,24 +377,6 @@ anv_gem_get_aperture(int fd, uint64_t *size)
    return 0;
 }
 
-bool
-anv_gem_supports_48b_addresses(int fd)
-{
-   struct drm_i915_gem_exec_object2 obj = {
-      .flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS,
-   };
-
-   struct drm_i915_gem_execbuffer2 execbuf = {
-      .buffers_ptr = (uintptr_t)&obj,
-      .buffer_count = 1,
-      .rsvd1 = 0xffffffu,
-   };
-
-   int ret = anv_ioctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
-
-   return ret == -1 && errno == ENOENT;
-}
-
 int
 anv_gem_gpu_get_reset_stats(struct anv_device *device,
                             uint32_t *active, uint32_t *pending)
diff --git a/src/intel/vulkan/anv_gem_stubs.c b/src/intel/vulkan/anv_gem_stubs.c
index 0f4a3f5da00..5093bd5db1a 100644
--- a/src/intel/vulkan/anv_gem_stubs.c
+++ b/src/intel/vulkan/anv_gem_stubs.c
@@ -170,12 +170,6 @@ anv_gem_get_aperture(int fd, uint64_t *size)
    unreachable("Unused");
 }
 
-bool
-anv_gem_supports_48b_addresses(int fd)
-{
-   unreachable("Unused");
-}
-
 int
 anv_gem_gpu_get_reset_stats(struct anv_device *device,
                             uint32_t *active, uint32_t *pending)
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 52d4ba58dc9..d8b34b149e4 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -956,7 +956,6 @@ int anv_gem_get_param(int fd, uint32_t param);
 int anv_gem_get_tiling(struct anv_device *device, uint32_t gem_handle);
 bool anv_gem_get_bit6_swizzle(int fd, uint32_t tiling);
 int anv_gem_get_aperture(int fd, uint64_t *size);
-bool anv_gem_supports_48b_addresses(int fd);
 int anv_gem_gpu_get_reset_stats(struct anv_device *device,
                                 uint32_t *active, uint32_t *pending);
 int anv_gem_handle_to_fd(struct anv_device *device, uint32_t gem_handle);
diff --git a/src/mesa/drivers/dri/i965/brw_bufmgr.c b/src/mesa/drivers/dri/i965/brw_bufmgr.c
index 8ba915b179a..8decf8883bb 100644
--- a/src/mesa/drivers/dri/i965/brw_bufmgr.c
+++ b/src/mesa/drivers/dri/i965/brw_bufmgr.c
@@ -1385,24 +1385,6 @@ gem_param(int fd, int name)
    return v;
 }
 
-static bool
-gem_supports_48b_addresses(int fd)
-{
-   struct drm_i915_gem_exec_object2 obj = {
-      .flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS,
-   };
-
-   struct drm_i915_gem_execbuffer2 execbuf = {
-      .buffers_ptr = (uintptr_t)&obj,
-      .buffer_count = 1,
-      .rsvd1 = 0xffffffu,
-   };
-
-   int ret = drmIoctl(fd, DRM_IOCTL_I915_GEM_EXECBUFFER2, &execbuf);
-
-   return ret == -1 && errno == ENOENT;
-}
-
 /**
  * Initializes the GEM buffer manager, which uses the kernel to allocate, map,
  * and manage map buffer objections.
@@ -1436,8 +1418,8 @@ brw_bufmgr_init(struct gen_device_info *devinfo, int fd)
 
    bufmgr->has_llc = devinfo->has_llc;
    bufmgr->has_mmap_wc = gem_param(fd, I915_PARAM_MMAP_VERSION) > 0;
-   bufmgr->supports_48b_addresses =
-      devinfo->gen >= 8 && gem_supports_48b_addresses(fd);
+   bufmgr->supports_48b_addresses = devinfo->gen >= 8 &&
+      gem_param(fd, I915_PARAM_HAS_ALIASING_PPGTT) == 3;
 
    init_cache_buckets(bufmgr);
 
-- 
2.16.3



More information about the mesa-dev mailing list