sna: Fallback after a bo allocation failure for the batch

If we fail to allocate the next bo to use for the next_request, we can
just fallback to the delayed allocation used by !llc.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-08-07 10:15:42 +01:00
parent 69d8edc111
commit 8c465d0fbf
1 changed files with 12 additions and 6 deletions

View File

@ -3716,12 +3716,10 @@ static int compact_batch_surface(struct kgem *kgem, int *shrink)
static struct kgem_bo *
kgem_create_batch(struct kgem *kgem)
{
#if !DBG_NO_SHRINK_BATCHES
struct drm_i915_gem_set_domain set_domain;
struct kgem_bo *bo;
int shrink = 0;
int size;
int size, shrink = 0;
#if !DBG_NO_SHRINK_BATCHES
if (kgem->surface != kgem->batch_size)
size = compact_batch_surface(kgem, &shrink);
else
@ -3779,6 +3777,8 @@ out_16384:
}
if (size < 16384) {
struct drm_i915_gem_set_domain set_domain;
bo = list_first_entry(&kgem->pinned_batches[size > 4096],
struct kgem_bo,
list);
@ -3802,8 +3802,14 @@ out_16384:
goto write;
}
}
#else
if (kgem->surface != kgem->batch_size)
size = kgem->batch_size * sizeof(uint32_t);
else
size = kgem->nbatch * sizeof(uint32_t);
#endif
if (!kgem->has_llc) {
if (!kgem->batch_bo) {
bo = kgem_create_linear(kgem, size, CREATE_NO_THROTTLE);
if (bo) {
write:
@ -3815,7 +3821,7 @@ write:
return bo;
}
}
#endif
return kgem_new_batch(kgem);
}