From a2b4f2657f8cd503fce4e3b8cc3240d7b45d36ce Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 5 Mar 2014 09:51:24 +0000 Subject: [PATCH] sna/gen8: Correct MOCS settings for render targets Signed-off-by: Chris Wilson --- src/sna/gen8_render.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c index 2a36795a..855551da 100644 --- a/src/sna/gen8_render.c +++ b/src/sna/gen8_render.c @@ -1281,6 +1281,13 @@ gen8_tiling_bits(uint32_t tiling) } } +#define MOCS_WT (2 << 5) +#define MOCS_WB (3 << 5) +#define MOCS_eLLC_ONLY (0 << 3) +#define MOCS_LLC_ONLY (1 << 3) +#define MOCS_eLLC_LLC (2 << 3) +#define MOCS_ALL_CACHES (3 << 3) + /** * Sets up the common fields for a surface state buffer for the given * picture in the given surface state buffer. @@ -1318,7 +1325,7 @@ gen8_bind_bo(struct sna *sna, domains = I915_GEM_DOMAIN_RENDER << 16 |I915_GEM_DOMAIN_RENDER; } else domains = I915_GEM_DOMAIN_SAMPLER << 16; - ss[1] = (is_scanout || bo->io) ? 0 : 3 << 24; + ss[1] = bo->io ? 0 : is_scanout ? (MOCS_WT | MOCS_ALL_CACHES) << 24 : (MOCS_WB | MOCS_ALL_CACHES) << 24; ss[2] = ((width - 1) << SURFACE_WIDTH_SHIFT | (height - 1) << SURFACE_HEIGHT_SHIFT); ss[3] = (bo->pitch - 1) << SURFACE_PITCH_SHIFT;