diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-31 00:35:42 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-31 00:55:12 +0000 |
commit | a4caf67d8da37d04f8915d96b10411ba7267937e (patch) | |
tree | 6725e2a4f710e9db521547450fecb36de3f581ad | |
parent | 3f7c1646c78d8854c88b214d3699e51839ba9711 (diff) |
sna: Trim tile sizes to fit into bo cache
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index ca7eafae..0b2e1d66 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -692,13 +692,14 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen) if (kgem->max_gpu_size > kgem->max_cpu_size) kgem->max_gpu_size = kgem->max_cpu_size; - kgem->max_tile_size = kgem->aperture_total / 4; + kgem->max_tile_size = MAX_CACHE_SIZE; if (kgem->max_tile_size > kgem->max_gpu_size / 2) kgem->max_tile_size = kgem->max_gpu_size / 2; totalram = total_ram_size(); if (totalram == 0) { - DBG(("%s: total ram size unknown, assuming maximum of total aperture\n")); + DBG(("%s: total ram size unknown, assuming maximum of total aperture\n", + __FUNCTION__)); totalram = kgem->aperture_total; } if (kgem->max_object_size > totalram / 2) @@ -3193,7 +3194,9 @@ struct kgem_bo *kgem_create_buffer(struct kgem *kgem, #if !DBG_NO_MAP_UPLOAD /* Be a little more generous and hope to hold fewer mmappings */ alloc = ALIGN(2*size, kgem->partial_buffer_size); - if (alloc > kgem->max_gpu_size) + if (alloc > kgem->max_tile_size) + alloc = ALIGN(size, kgem->partial_buffer_size); + if (alloc > kgem->max_tile_size) alloc = PAGE_ALIGN(size); alloc /= PAGE_SIZE; if (kgem->has_cpu_bo) { |