diff mbox

drm/i915: Use MLC (l3$) for context objects

Message ID 1342697003-4067-1-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson July 19, 2012, 11:23 a.m. UTC
Enabling context support increases SwapBuffers latency by about 20%
(measured on an i7-3720qm). We can offset that loss slightly by enabling
faster caching for the contexts. As they are not backed by any
particular cache (such as the sampler or render caches) our only option
is to select the generic mid-level cache. This reduces the latency of
the swap by about 5%.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Kenneth Graunke <kenneth@whitecape.org>
---
 drivers/gpu/drm/i915/i915_gem_context.c |    7 +++++++
 1 file changed, 7 insertions(+)

Comments

Eric Anholt July 19, 2012, 2:53 p.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> Enabling context support increases SwapBuffers latency by about 20%
> (measured on an i7-3720qm). We can offset that loss slightly by enabling
> faster caching for the contexts. As they are not backed by any
> particular cache (such as the sampler or render caches) our only option
> is to select the generic mid-level cache. This reduces the latency of
> the swap by about 5%.

The UFO driver is doing LLC/MLC on all buffers by using the cacheability
control field.  I think we should do the same by just setting all our
pte fields for LLC+MLC instead of special casing contexts.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 338cdfc..129b63d 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -154,6 +154,13 @@  create_hw_context(struct drm_device *dev,
 		return ERR_PTR(-ENOMEM);
 	}
 
+	if (INTEL_INFO(dev)->gen >= 7) {
+		ret = i915_gem_object_set_cache_level(ctx->obj,
+						      I915_CACHE_LLC_MLC);
+		if (ret)
+			goto err_out;
+	}
+
 	/* The ring associated with the context object is handled by the normal
 	 * object tracking code. We give an initial ring value simple to pass an
 	 * assertion in the context switch code.