summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorCaio Marcelo de Oliveira Filho <[email protected]>2019-06-10 14:23:34 -0700
committerCaio Marcelo de Oliveira Filho <[email protected]>2019-06-12 15:57:16 -0700
commit608257cf82f49109c8f1a2bab1d6e30fa14f9ba7 (patch)
tree7ada03a436109d63f7338c1b222225edac1f122a /src/util
parenteb41ce1b012f24fc7cba664dcc12129342e26843 (diff)
i965: Fix INTEL_DEBUG=bat
Use hash_table_u64 instead of hash_table directly, since the former will also handle the special keys (deleted and freed) and allow use the whole u64 space. Fixes crash in INTEL_DEBUG=bat when using a key with value 0 -- the current value for a freed key. Fixes: b38dab101ca "util/hash_table: Assert that keys are not reserved pointers" Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/hash_table.c15
-rw-r--r--src/util/hash_table.h4
2 files changed, 17 insertions, 2 deletions
diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index 58104abd739..f58575de558 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -655,8 +655,8 @@ _mesa_hash_table_u64_create(void *mem_ctx)
}
void
-_mesa_hash_table_u64_destroy(struct hash_table_u64 *ht,
- void (*delete_function)(struct hash_entry *entry))
+_mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
+ void (*delete_function)(struct hash_entry *entry))
{
if (!ht)
return;
@@ -691,6 +691,17 @@ _mesa_hash_table_u64_destroy(struct hash_table_u64 *ht,
ht->freed_key_data = NULL;
}
+ _mesa_hash_table_clear(ht->table, delete_function);
+}
+
+void
+_mesa_hash_table_u64_destroy(struct hash_table_u64 *ht,
+ void (*delete_function)(struct hash_entry *entry))
+{
+ if (!ht)
+ return;
+
+ _mesa_hash_table_u64_clear(ht, delete_function);
_mesa_hash_table_destroy(ht->table, delete_function);
free(ht);
}
diff --git a/src/util/hash_table.h b/src/util/hash_table.h
index be7b50ff1fe..87b1409c457 100644
--- a/src/util/hash_table.h
+++ b/src/util/hash_table.h
@@ -194,6 +194,10 @@ _mesa_hash_table_u64_search(struct hash_table_u64 *ht, uint64_t key);
void
_mesa_hash_table_u64_remove(struct hash_table_u64 *ht, uint64_t key);
+void
+_mesa_hash_table_u64_clear(struct hash_table_u64 *ht,
+ void (*delete_function)(struct hash_entry *entry));
+
#ifdef __cplusplus
} /* extern C */
#endif