summaryrefslogtreecommitdiff
path: root/src/sna/kgem.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-11-12 13:15:25 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-11-12 14:43:56 +0000
commita6bd3011710a3fd4cfe21a3d41a6ec9c929681bf (patch)
tree709d6e46a352e8065b2e1f9e18fdea10d157db60 /src/sna/kgem.c
parent4493fb8d21fa013a074f7de66387e92ef23d191a (diff)
sna: Factor available memory into available aperture estimation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/kgem.c')
-rw-r--r--src/sna/kgem.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 8226fd85..7855884f 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1331,6 +1331,14 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen)
if (kgem->max_gpu_size > totalram / 4)
kgem->max_gpu_size = totalram / 4;
+ if (kgem->aperture_high > totalram / 2) {
+ kgem->aperture_high = totalram / 2;
+ kgem->aperture_low = kgem->aperture_high / 4;
+ DBG(("%s: reduced aperture watermaks to fit into ram; low=%d [%d], high=%d [%d]\n", __FUNCTION__,
+ kgem->aperture_low, kgem->aperture_low / (1024*1024),
+ kgem->aperture_high, kgem->aperture_high / (1024*1024)));
+ }
+
kgem->max_cpu_size = kgem->max_object_size;
half_gpu_max = kgem->max_gpu_size / 2;