Mesa (staging/21.1): llvmpipe: add the interesting bit of cpu detection to the cache.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 5 16:30:18 UTC 2021


Module: Mesa
Branch: staging/21.1
Commit: 33681771435cee15a2762f04384814d0acd9f103
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=33681771435cee15a2762f04384814d0acd9f103

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon May 24 05:19:43 2021 +1000

llvmpipe: add the interesting bit of cpu detection to the cache.

This should detect if someone changes CPU configuration that matters like in a VM

Reviewed-by: Emma Anholt <emma at anholt.net>
Fixes: 6c0c61cb48e8 ("llvmpipe: add infrastructure for disk cache support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10946>
(cherry picked from commit 9520b70f75d7a695966f36ff619557c88c25a0dc)

---

 .pick_status.json                        |  2 +-
 src/gallium/drivers/llvmpipe/lp_screen.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 5bca2eec712..cdf6db18649 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1201,7 +1201,7 @@
         "description": "llvmpipe: add the interesting bit of cpu detection to the cache.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "6c0c61cb48e87d9b0fc545cf30016d3947a47b6a"
     },
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 0f7083b5c38..2adf8b78670 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -818,6 +818,17 @@ llvmpipe_get_timestamp(struct pipe_screen *_screen)
    return os_time_get_nano();
 }
 
+static void update_cache_sha1_cpu(struct mesa_sha1 *ctx)
+{
+   const struct util_cpu_caps_t *cpu_caps = util_get_cpu_caps();
+   /*
+    * Don't need the cpu cache affinity stuff. The rest
+    * is contained in first 5 dwords.
+    */
+   STATIC_ASSERT(offsetof(struct util_cpu_caps_t, num_L3_caches) == 5 * sizeof(uint32_t));
+   _mesa_sha1_update(ctx, cpu_caps, 5 * sizeof(uint32_t));
+}
+
 static void lp_disk_cache_create(struct llvmpipe_screen *screen)
 {
    struct mesa_sha1 ctx;
@@ -831,6 +842,7 @@ static void lp_disk_cache_create(struct llvmpipe_screen *screen)
       return;
 
    _mesa_sha1_update(&ctx, &gallivm_perf, sizeof(gallivm_perf));
+   update_cache_sha1_cpu(&ctx);
    _mesa_sha1_final(&ctx, sha1);
    disk_cache_format_hex_id(cache_id, sha1, 20 * 2);
 



More information about the mesa-commit mailing list