sna: Downgrade tiling in order to fit within fence constraints

Fixes a later assert that the fenced size is valid for kgem_create_2d()

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42888
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-11-14 09:27:49 +00:00
parent 1baff9f8cf
commit 0c405595fb
1 changed files with 12 additions and 0 deletions

View File

@ -1332,6 +1332,8 @@ struct kgem_bo *kgem_create_linear(struct kgem *kgem, int size)
int kgem_choose_tiling(struct kgem *kgem, int tiling, int width, int height, int bpp)
{
uint32_t pitch;
if (DBG_NO_TILING)
return I915_TILING_NONE;
@ -1401,6 +1403,16 @@ int kgem_choose_tiling(struct kgem *kgem, int tiling, int width, int height, int
}
}
/* And finally check that we can fence the whole object */
if (tiling &&
kgem_surface_size(kgem, false,
width, height, bpp, tiling,
&pitch) >= kgem->max_object_size) {
DBG(("%s: too large (%dx%d) to be fenced, discarding tiling\n",
__FUNCTION__, width, height));
tiling = I915_TILING_NONE;
}
DBG(("%s: %dx%d -> %d\n", __FUNCTION__, width, height, tiling));
return tiling;
}