Mesa (main): anv: Add a use_relocations physical device bit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 9 03:12:54 UTC 2021


Module: Mesa
Branch: main
Commit: 2eb9057de024f45c66728e7e2848561b79c87618
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2eb9057de024f45c66728e7e2848561b79c87618

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Nov  3 07:23:22 2021 -0500

anv: Add a use_relocations physical device bit

This is more the bit of information we want to be carrying around
long-term.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13610>

---

 src/intel/vulkan/anv_device.c               | 11 ++++++-----
 src/intel/vulkan/anv_private.h              |  7 ++++---
 src/intel/vulkan/tests/block_pool_no_free.c |  4 +++-
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 8c10788d27d..14935959efe 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -852,8 +852,10 @@ anv_physical_device_try_create(struct anv_instance *instance,
       goto fail_base;
    }
 
-   if (device->info.ver >= 8 &&
-       device->info.platform != INTEL_PLATFORM_CHV &&
+   device->use_relocations = device->info.ver < 8 ||
+                             device->info.platform == INTEL_PLATFORM_CHV;
+
+   if (!device->use_relocations &&
        !anv_gem_get_param(fd, I915_PARAM_HAS_EXEC_SOFTPIN)) {
       result = vk_errorf(device, VK_ERROR_INITIALIZATION_FAILED,
                          "kernel missing softpin");
@@ -894,9 +896,8 @@ anv_physical_device_try_create(struct anv_instance *instance,
    if (result != VK_SUCCESS)
       goto fail_base;
 
-   device->use_softpin = device->info.ver >= 8 &&
-                         device->info.platform != INTEL_PLATFORM_CHV;
-   assert(device->use_softpin == device->supports_48bit_addresses);
+   assert(device->supports_48bit_addresses == !device->use_relocations);
+   device->use_softpin = !device->use_relocations;
 
    device->has_context_isolation =
       anv_gem_get_param(fd, I915_PARAM_HAS_CONTEXT_ISOLATION);
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index e473844b96a..61bc3c13959 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -907,6 +907,7 @@ struct anv_physical_device {
     bool                                        has_userptr_probe;
     uint64_t                                    gtt_size;
 
+    bool                                        use_relocations;
     bool                                        use_softpin;
     bool                                        always_use_bindless;
     bool                                        use_call_secondary;
@@ -1254,18 +1255,18 @@ anv_use_relocations(const struct anv_physical_device *pdevice)
 {
 #if defined(GFX_VERx10) && GFX_VERx10 >= 90
    /* Sky Lake and later always uses softpin */
-   assert(pdevice->use_softpin);
+   assert(!pdevice->use_relocations);
    return false;
 #elif defined(GFX_VERx10) && GFX_VERx10 < 80
    /* Haswell and earlier never use softpin */
-   assert(!pdevice->use_softpin);
+   assert(pdevice->use_relocations);
    return true;
 #else
    /* If we don't have a GFX_VERx10 #define, we need to look at the physical
     * device.  Also, for GFX version 8, we need to look at the physical
     * device because Broadwell softpins but Cherryview doesn't.
     */
-   return !pdevice->use_softpin;
+   return pdevice->use_relocations;
 #endif
 }
 
diff --git a/src/intel/vulkan/tests/block_pool_no_free.c b/src/intel/vulkan/tests/block_pool_no_free.c
index 1dac4f00f23..e2c99e97e64 100644
--- a/src/intel/vulkan/tests/block_pool_no_free.c
+++ b/src/intel/vulkan/tests/block_pool_no_free.c
@@ -110,7 +110,9 @@ static void validate_monotonic(int32_t **blocks)
 
 static void run_test()
 {
-   struct anv_physical_device physical_device = { };
+   struct anv_physical_device physical_device = {
+      .use_relocations = true,
+   };
    struct anv_device device = {
       .physical = &physical_device,
    };



More information about the mesa-commit mailing list