}
}
+static struct iris_bo *
+bo_calloc(void)
+{
+ struct iris_bo *bo = calloc(1, sizeof(*bo));
+ if (bo) {
+ bo->hash = _mesa_hash_pointer(bo);
+ }
+ return bo;
+}
+
static struct iris_bo *
bo_alloc_internal(struct iris_bufmgr *bufmgr,
const char *name,
bo->gtt_offset = 0ull;
}
} else {
- bo = calloc(1, sizeof(*bo));
+ bo = bo_calloc();
if (!bo)
goto err;
{
struct iris_bo *bo;
- bo = calloc(1, sizeof(*bo));
+ bo = bo_calloc();
if (!bo)
return NULL;
goto out;
}
- bo = calloc(1, sizeof(*bo));
+ bo = bo_calloc();
if (!bo)
goto out;
goto out;
}
- bo = calloc(1, sizeof(*bo));
+ bo = bo_calloc();
if (!bo)
goto out;
iris_cache_flush_for_read(struct iris_batch *batch,
struct iris_bo *bo)
{
- if (_mesa_hash_table_search(batch->cache.render, bo) ||
- _mesa_set_search(batch->cache.depth, bo))
+ if (_mesa_hash_table_search_pre_hashed(batch->cache.render, bo->hash, bo) ||
+ _mesa_set_search_pre_hashed(batch->cache.depth, bo->hash, bo))
iris_flush_depth_and_render_caches(batch);
}
enum isl_format format,
enum isl_aux_usage aux_usage)
{
- if (_mesa_set_search(batch->cache.depth, bo))
+ if (_mesa_set_search_pre_hashed(batch->cache.depth, bo->hash, bo))
iris_flush_depth_and_render_caches(batch);
/* Check to see if this bo has been used by a previous rendering operation
* and flush on format changes too. We can always relax this later if we
* find it to be a performance problem.
*/
- struct hash_entry *entry = _mesa_hash_table_search(batch->cache.render, bo);
+ struct hash_entry *entry =
+ _mesa_hash_table_search_pre_hashed(batch->cache.render, bo->hash, bo);
if (entry && entry->data != format_aux_tuple(format, aux_usage))
iris_flush_depth_and_render_caches(batch);
}
enum isl_aux_usage aux_usage)
{
#ifndef NDEBUG
- struct hash_entry *entry = _mesa_hash_table_search(batch->cache.render, bo);
+ struct hash_entry *entry =
+ _mesa_hash_table_search_pre_hashed(batch->cache.render, bo->hash, bo);
if (entry) {
/* Otherwise, someone didn't do a flush_for_render and that would be
* very bad indeed.
}
#endif
- _mesa_hash_table_insert(batch->cache.render, bo,
- format_aux_tuple(format, aux_usage));
+ _mesa_hash_table_insert_pre_hashed(batch->cache.render, bo->hash, bo,
+ format_aux_tuple(format, aux_usage));
}
void
iris_cache_flush_for_depth(struct iris_batch *batch,
struct iris_bo *bo)
{
- if (_mesa_hash_table_search(batch->cache.render, bo))
+ if (_mesa_hash_table_search_pre_hashed(batch->cache.render, bo->hash, bo))
iris_flush_depth_and_render_caches(batch);
}
void
iris_depth_cache_add_bo(struct iris_batch *batch, struct iris_bo *bo)
{
- _mesa_set_add(batch->cache.depth, bo);
+ _mesa_set_add_pre_hashed(batch->cache.depth, bo->hash, bo);
}