sna: Include Pineview in fence over-allocation checks
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 3 Dec 2013 09:37:37 +0000 (09:37 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 3 Dec 2013 09:37:37 +0000 (09:37 +0000)
When creating the object, we need to take account that fenced regions
in the aperture are in power-of-two sizes and so can be much larger than
the actual object. This includes Pineview, which although is more
relaxed with regards to fence alignment of GPU operations, still imposes
the same restrictions on the fence registers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/kgem.c

index 4305c76..0d1368c 100644 (file)
@@ -3933,13 +3933,6 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
                        flags |= KGEM_CAN_CREATE_GPU;
                if (size > kgem->max_gpu_size)
                        flags &= ~KGEM_CAN_CREATE_GPU;
-               if (kgem->gen < 033) {
-                       int fence_size = 1024 * 1024;
-                       while (fence_size < size)
-                               fence_size <<= 1;
-                       if (fence_size > kgem->max_gpu_size)
-                               flags &= ~KGEM_CAN_CREATE_GPU;
-               }
                if (size > 0 && size <= PAGE_SIZE*kgem->aperture_mappable/4)
                        flags |= KGEM_CAN_CREATE_GTT;
                if (size > PAGE_SIZE*kgem->aperture_mappable/4)
@@ -3951,6 +3944,15 @@ unsigned kgem_can_create_2d(struct kgem *kgem,
                             __FUNCTION__, size, kgem->max_object_size));
                        return 0;
                }
+               if (kgem->gen < 040) {
+                       int fence_size = 1024 * 1024;
+                       while (fence_size < size)
+                               fence_size <<= 1;
+                       if (fence_size > kgem->max_gpu_size)
+                               flags &= ~KGEM_CAN_CREATE_GPU;
+                       if (fence_size > PAGE_SIZE*kgem->aperture_mappable/4)
+                               flags &= ~KGEM_CAN_CREATE_GTT;
+               }
        }
 
        return flags;