Works on r600g, Turks XT / HD6670.
I'm running my whole system with Marek's / Gregory's fixed glthread branch.
https://cgit.freedesktop.org/~mareko/mesa/?h=glthread
I have mesa_glthread=true in /etc/environment ;-)

Tested-by: Dieter Nützel <die...@nuetzel-hh.de>

Cheers,
Dieter

Am 04.03.2017 22:07, schrieb Timothy Arceri:
Previously we were deleting the entire cache if a user switched
between 32 and 64 bit applications.

V2: make the check more generic, it should now work with any
platform we are likely to support.

V3: Use suggestion from Emil to make even more generic/fix issue
with __ILP32__ not being declared on gcc for regular 32-bit builds.
---
 src/util/disk_cache.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index 3abdec4..7543b0d 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -67,20 +67,37 @@ struct disk_cache {
/* Pointer to total size of all objects in cache (within index_mmap) */
    uint64_t *size;

    /* Pointer to stored keys, (within index_mmap). */
    uint8_t *stored_keys;

    /* Maximum size of all cached objects (in bytes). */
    uint64_t max_size;
 };

+static const char *
+get_arch_bitness_str(void)
+{
+    if (sizeof(void *) == 4)
+#ifdef __ILP32__
+        return "ilp-32";
+#else
+        return "32";
+#endif
+    if (sizeof(void *) == 8)
+        return "64";
+
+    /* paranoia check which will be dropped by the optimiser */
+    assert(!"unknown_arch");
+    return "unknown_arch";
+}
+
 /* Create a directory named 'path' if it does not already exist.
  *
  * Returns: 0 if path already exists as a directory or if created.
  *         -1 in all other cases.
  */
 static int
 mkdir_if_needed(char *path)
 {
    struct stat sb;

@@ -170,20 +187,29 @@ remove_old_cache_directories(void *mem_ctx, char
*path, const char *timestamp)
 }

 static char *
create_mesa_cache_dir(void *mem_ctx, char *path, const char *timestamp,
                       const char *gpu_name)
 {
    char *new_path = concatenate_and_mkdir(mem_ctx, path, "mesa");
    if (new_path == NULL)
       return NULL;

+ /* Create a parent architecture directory so that we don't remove cache + * files for other architectures. In theory we could share the cache + * between architectures but we have no way of knowing if they were created
+    * by a compatible Mesa version.
+    */
+ new_path = concatenate_and_mkdir(mem_ctx, new_path, get_arch_bitness_str());
+   if (new_path == NULL)
+      return NULL;
+
    /* Remove cache directories for old Mesa versions */
    remove_old_cache_directories(mem_ctx, new_path, timestamp);

    new_path = concatenate_and_mkdir(mem_ctx, new_path, timestamp);
    if (new_path == NULL)
       return NULL;

    new_path = concatenate_and_mkdir(mem_ctx, new_path, gpu_name);
    if (new_path == NULL)
       return NULL;
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to