From 0c405595fb8739b22569f81f400100b5dfa472cf Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 14 Nov 2011 09:27:49 +0000 Subject: [PATCH] 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 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42888 Signed-off-by: Chris Wilson --- src/sna/kgem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index ef712e2d..2d6760f3 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -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; }