sna: Trim color cache allocation to a single page

Instead trying to allocate 4100 bytes, fix the logic to only require a
maximum of 4096 bytes in the cache buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-10-07 22:04:22 +01:00
parent 55cd67485f
commit 1fb4f60671
2 changed files with 6 additions and 5 deletions

View File

@ -246,8 +246,8 @@ sna_render_finish_solid(struct sna *sna, bool force)
struct kgem_bo *old;
int i;
DBG(("sna_render_finish_solid(force=%d, domain=%d, busy=%d, dirty=%d)\n",
force, cache->cache_bo->domain, cache->cache_bo->rq != NULL, cache->dirty));
DBG(("sna_render_finish_solid(force=%d, domain=%d, busy=%d, dirty=%d, size=%d)\n",
force, cache->cache_bo->domain, cache->cache_bo->rq != NULL, cache->dirty, cache->size));
if (!force && cache->cache_bo->domain != DOMAIN_GPU)
return;
@ -353,9 +353,10 @@ sna_render_get_solid(struct sna *sna, uint32_t color)
}
}
sna_render_finish_solid(sna, i == 1024);
sna_render_finish_solid(sna, i == ARRAY_SIZE(cache->color));
i = cache->size++;
assert(i < ARRAY_SIZE(cache->color));
cache->color[i] = color;
cache->dirty = 1;
DBG(("sna_render_get_solid(%d) = %x (new)\n", i, color));
@ -429,7 +430,7 @@ static bool sna_solid_cache_init(struct sna *sna)
if (!cache->cache_bo)
return false;
cache->last = 1024;
cache->last = 0;
cache->color[cache->last] = 0;
cache->dirty = 0;
cache->size = 0;

View File

@ -287,7 +287,7 @@ struct sna_render {
struct sna_solid_cache {
struct kgem_bo *cache_bo;
struct kgem_bo *bo[1024];
uint32_t color[1025];
uint32_t color[1024];
int last;
int size;
int dirty;