From 81b998ca48fc96753096f22949bf3785b7aa425c Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Tue, 12 Nov 2013 17:51:15 -0800 Subject: [PATCH] i965/gen7: Disallow Y tiling of renderable surfaces with valign of 2. Gen7 does not allow render targets to have a vertical alignment of 2. So, when creating a surface, if its format is renderable, and its vertical alignment is 2, force it to use X tiling. Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 884ddef..292c312 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -478,6 +478,23 @@ intel_miptree_choose_tiling(struct brw_context *brw, if (brw->gen != 7 && mt->cpp >= 16) return I915_TILING_X; + /* From the Ivy Bridge PRM, Vol4 Part1 2.12.2.1 (SURFACE_STATE for most + * messages), on p64, under the heading "Surface Vertical Alignment": + * + * This field must be set to VALIGN_4 for all tiled Y Render Target + * surfaces. + * + * So if the surface is renderable and uses a vertical alignment of 2, + * force it to be X tiled. This is somewhat conservative (it's possible + * that the client won't ever render to this surface), but it's difficult + * to know that ahead of time. And besides, since we use a vertical + * alignment of 4 as often as we can, this shouldn't happen very often. + */ + if (brw->gen == 7 && mt->align_h == 2 && + brw->format_supported_as_render_target[format]) { + return I915_TILING_X; + } + return I915_TILING_Y | I915_TILING_X; } -- 2.7.4