sna: Allow gen4+ to use larger GPU bo

As the blitter on gen4+ does not require fence registers, it is not
restricted to operating on large objects within the mappable aperture.
As we do not need to operate on such large GPU bo in place, we can relax
the restriction on the maximum bo size for gen4+ to allocate for use
with the GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-01-26 13:59:24 +00:00
parent d35b6955db
commit b1f9415bf3
2 changed files with 21 additions and 6 deletions

View File

@ -658,15 +658,22 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
* disable dual-stream mode */
kgem->min_alignment = 64;
kgem->max_gpu_size = kgem->aperture_mappable / 2;
if (kgem->max_gpu_size > kgem->aperture_low)
kgem->max_gpu_size = kgem->aperture_low;
if (kgem->max_gpu_size > MAX_OBJECT_SIZE)
kgem->max_gpu_size = MAX_OBJECT_SIZE;
kgem->max_cpu_size = kgem->aperture_total / 2;
if (kgem->max_cpu_size > MAX_OBJECT_SIZE)
kgem->max_cpu_size = MAX_OBJECT_SIZE;
kgem->max_gpu_size = -1;
if (gen < 40) {
/* If we have to use fences for blitting, we have to make
* sure we can fit them into the aperture.
*/
kgem->max_gpu_size = kgem->aperture_mappable / 2;
if (kgem->max_gpu_size > kgem->aperture_low)
kgem->max_gpu_size = kgem->aperture_low;
}
if (kgem->max_gpu_size > kgem->max_cpu_size)
kgem->max_gpu_size = kgem->max_cpu_size;
DBG(("%s: max object size (tiled=%d, linear=%d)\n",
__FUNCTION__, kgem->max_gpu_size, kgem->max_cpu_size));
@ -2729,6 +2736,8 @@ void *kgem_bo_map(struct kgem *kgem, struct kgem_bo *bo)
ptr = bo->map;
if (ptr == NULL) {
assert(bo->size <= kgem->aperture_mappable / 4);
kgem_trim_vma_cache(kgem, MAP_GTT, bo->bucket);
ptr = gem_mmap(kgem->fd, bo->handle, bo->size,

View File

@ -363,10 +363,16 @@ static inline bool kgem_bo_is_mappable(struct kgem *kgem,
if (bo->domain == DOMAIN_GTT)
return true;
if (IS_GTT_MAP(bo->map))
return true;
if (kgem->gen < 40 && bo->tiling &&
bo->presumed_offset & (kgem_bo_fenced_size(kgem, bo) - 1))
return false;
if (!bo->presumed_offset)
return bo->size <= kgem->aperture_mappable / 4;
return bo->presumed_offset + bo->size <= kgem->aperture_mappable;
}