summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_state_cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_state_cache.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_cache.c73
1 files changed, 6 insertions, 67 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c
index ea81ad1341..b31d84953a 100644
--- a/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -310,9 +310,7 @@ drm_intel_bo *
brw_cache_data(struct brw_cache *cache,
enum brw_cache_id cache_id,
const void *data,
- GLuint data_size,
- drm_intel_bo **reloc_bufs,
- GLuint nr_reloc_bufs)
+ GLuint data_size)
{
drm_intel_bo *bo;
struct brw_cache_item *item, lookup;
@@ -321,8 +319,8 @@ brw_cache_data(struct brw_cache *cache,
lookup.cache_id = cache_id;
lookup.key = data;
lookup.key_size = data_size;
- lookup.reloc_bufs = reloc_bufs;
- lookup.nr_reloc_bufs = nr_reloc_bufs;
+ lookup.reloc_bufs = NULL;
+ lookup.nr_reloc_bufs = 0;
hash = hash_key(&lookup);
lookup.hash = hash;
@@ -335,7 +333,7 @@ brw_cache_data(struct brw_cache *cache,
bo = brw_upload_cache(cache, cache_id,
data, data_size,
- reloc_bufs, nr_reloc_bufs,
+ NULL, 0,
data, data_size);
return bo;
@@ -396,29 +394,10 @@ brw_init_non_surface_cache(struct brw_context *brw)
brw_init_cache_id(cache, "DEPTH_STENCIL_STATE", BRW_DEPTH_STENCIL_STATE);
}
-
-static void
-brw_init_surface_cache(struct brw_context *brw)
-{
- struct brw_cache *cache = &brw->surface_cache;
-
- cache->brw = brw;
-
- cache->size = 7;
- cache->n_items = 0;
- cache->items = (struct brw_cache_item **)
- calloc(1, cache->size * sizeof(struct brw_cache_item));
-
- brw_init_cache_id(cache, "SS_SURFACE", BRW_SS_SURFACE);
- brw_init_cache_id(cache, "SS_SURF_BIND", BRW_SS_SURF_BIND);
-}
-
-
void
brw_init_caches(struct brw_context *brw)
{
brw_init_non_surface_cache(brw);
- brw_init_surface_cache(brw);
}
@@ -452,56 +431,17 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
brw->state.dirty.cache |= ~0;
}
-/* Clear all entries from the cache that point to the given bo.
- *
- * This lets us release memory for reuse earlier for known-dead buffers,
- * at the cost of walking the entire hash table.
- */
-void
-brw_state_cache_bo_delete(struct brw_cache *cache, drm_intel_bo *bo)
-{
- struct brw_cache_item **prev;
- GLuint i;
-
- if (INTEL_DEBUG & DEBUG_STATE)
- printf("%s\n", __FUNCTION__);
-
- for (i = 0; i < cache->size; i++) {
- for (prev = &cache->items[i]; *prev;) {
- struct brw_cache_item *c = *prev;
-
- if (drm_intel_bo_references(c->bo, bo)) {
- int j;
-
- *prev = c->next;
-
- for (j = 0; j < c->nr_reloc_bufs; j++)
- drm_intel_bo_unreference(c->reloc_bufs[j]);
- drm_intel_bo_unreference(c->bo);
- free((void *)c->key);
- free(c);
- cache->n_items--;
- } else {
- prev = &c->next;
- }
- }
- }
-}
-
void
brw_state_cache_check_size(struct brw_context *brw)
{
if (INTEL_DEBUG & DEBUG_STATE)
printf("%s (n_items=%d)\n", __FUNCTION__, brw->cache.n_items);
- /* un-tuned guess. We've got around 20 state objects for a total of around
- * 32k, so 1000 of them is around 1.5MB.
+ /* un-tuned guess. Each object is generally a page, so 1000 of them is 4 MB of
+ * state cache.
*/
if (brw->cache.n_items > 1000)
brw_clear_cache(brw, &brw->cache);
-
- if (brw->surface_cache.n_items > 1000)
- brw_clear_cache(brw, &brw->surface_cache);
}
@@ -528,5 +468,4 @@ void
brw_destroy_caches(struct brw_context *brw)
{
brw_destroy_cache(brw, &brw->cache);
- brw_destroy_cache(brw, &brw->surface_cache);
}