From f749ed618e21b56a36a2feb9b4333ec797ec2ae5 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 5 Jul 2011 21:37:02 +0100 Subject: [PATCH] sna: Reduce tiling if pitch is less than a tile_width/height only on pre-G33 (Note this only applies to 2D pixmaps.) The rationale, borne out by experimentation with cairo-perf-trace, is that on the pre-G33 devices we always need a fence region region for tiled surfaces, i.e. at least .5/1MiB in size, and that combined with the smaller GTT on those devices, we loose the benefit of tiling to the excessive GTT thrashing. Signed-off-by: Chris Wilson --- src/sna/kgem.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 9509dbe3..87acb49b 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -1172,26 +1172,32 @@ int kgem_choose_tiling(struct kgem *kgem, int tiling, int width, int height, int return -tiling; } - if (tiling == I915_TILING_Y && height < 16) { - DBG(("%s: too short [%d] for TILING_Y\n", - __FUNCTION__,height)); - tiling = I915_TILING_X; - } - if (tiling == I915_TILING_X && height < 4) { - DBG(("%s: too short [%d] for TILING_X\n", - __FUNCTION__, height)); - tiling = I915_TILING_NONE; - } + /* Before the G33, we only have a small GTT to play with and tiled + * surfaces always require full fence regions and so cause excessive + * aperture thrashing. + */ + if (kgem->gen < 33) { + if (tiling == I915_TILING_Y && height < 16) { + DBG(("%s: too short [%d] for TILING_Y\n", + __FUNCTION__,height)); + tiling = I915_TILING_X; + } + if (tiling == I915_TILING_X && height < 4) { + DBG(("%s: too short [%d] for TILING_X\n", + __FUNCTION__, height)); + tiling = I915_TILING_NONE; + } - if (tiling == I915_TILING_X && width * bpp < 512/2) { - DBG(("%s: too thin [%d] for TILING_X\n", - __FUNCTION__, width)); - tiling = I915_TILING_NONE; - } - if (tiling == I915_TILING_Y && width * bpp < 32/2) { - DBG(("%s: too thin [%d] for TILING_Y\n", - __FUNCTION__, width)); - tiling = I915_TILING_NONE; + if (tiling == I915_TILING_X && width * bpp < 8*512/2) { + DBG(("%s: too thin [%d] for TILING_X\n", + __FUNCTION__, width)); + tiling = I915_TILING_NONE; + } + if (tiling == I915_TILING_Y && width * bpp < 8*32/2) { + DBG(("%s: too thin [%d] for TILING_Y\n", + __FUNCTION__, width)); + tiling = I915_TILING_NONE; + } } DBG(("%s: %dx%d -> %d\n", __FUNCTION__, width, height, tiling));