summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
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/mesa/drivers
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/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h2
-rw-r--r--src/mesa/drivers/dri/i965/intel_batchbuffer.c30
2 files changed, 9 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 46791c7d2c8..25ae25e06ff 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -524,7 +524,7 @@ struct intel_batchbuffer {
} saved;
/** Map from batch offset to brw_state_batch data (with DEBUG_BATCH) */
- struct hash_table *state_batch_sizes;
+ struct hash_table_u64 *state_batch_sizes;
struct gen_batch_decode_ctx decoder;
};
diff --git a/src/mesa/drivers/dri/i965/intel_batchbuffer.c b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
index a701f3bd353..af076f65f0b 100644
--- a/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ b/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -108,22 +108,9 @@ decode_get_state_size(void *v_brw, uint32_t offset_from_dsba)
{
struct brw_context *brw = v_brw;
struct intel_batchbuffer *batch = &brw->batch;
- struct hash_entry *entry =
- _mesa_hash_table_search(batch->state_batch_sizes,
- (void *) (uintptr_t) offset_from_dsba);
- return entry ? (uintptr_t) entry->data : 0;
-}
-
-static bool
-uint_key_compare(const void *a, const void *b)
-{
- return a == b;
-}
-
-static uint32_t
-uint_key_hash(const void *key)
-{
- return (uintptr_t) key;
+ unsigned size = (uintptr_t) _mesa_hash_table_u64_search(
+ batch->state_batch_sizes, offset_from_dsba);
+ return size;
}
static void
@@ -158,7 +145,7 @@ intel_batchbuffer_init(struct brw_context *brw)
if (INTEL_DEBUG & DEBUG_BATCH) {
batch->state_batch_sizes =
- _mesa_hash_table_create(NULL, uint_key_hash, uint_key_compare);
+ _mesa_hash_table_u64_create(NULL);
const unsigned decode_flags =
GEN_BATCH_DECODE_FULL |
@@ -284,7 +271,7 @@ intel_batchbuffer_reset(struct brw_context *brw)
batch->state_base_address_emitted = false;
if (batch->state_batch_sizes)
- _mesa_hash_table_clear(batch->state_batch_sizes, NULL);
+ _mesa_hash_table_u64_clear(batch->state_batch_sizes, NULL);
}
static void
@@ -346,7 +333,7 @@ intel_batchbuffer_free(struct intel_batchbuffer *batch)
brw_bo_unreference(batch->batch.bo);
brw_bo_unreference(batch->state.bo);
if (batch->state_batch_sizes) {
- _mesa_hash_table_destroy(batch->state_batch_sizes, NULL);
+ _mesa_hash_table_u64_destroy(batch->state_batch_sizes, NULL);
gen_batch_decode_ctx_finish(&batch->decoder);
}
}
@@ -1052,9 +1039,8 @@ brw_state_batch(struct brw_context *brw,
}
if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) {
- _mesa_hash_table_insert(batch->state_batch_sizes,
- (void *) (uintptr_t) offset,
- (void *) (uintptr_t) size);
+ _mesa_hash_table_u64_insert(batch->state_batch_sizes,
+ offset, (void *) (uintptr_t) size);
}
batch->state_used = offset + size;