public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Bump the inactive LRU on set-to-GTT-domain
@ 2012-04-24 14:52 Chris Wilson
  2012-04-25  9:04 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2012-04-24 14:52 UTC (permalink / raw)
  To: intel-gfx

Currently, we only bump the LRU of an object when we bind into the GTT
for a page-fault. As the object may be used many times before its
mapping is zapped, we do not mark it as active as frequently as we
should. Userspace should be calling set-to-GTT-domain before each
pointer deference (for synchronous access) and so is a good place
to mark the buffer as active.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 1cff8b1..2fc7c55 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -132,7 +132,7 @@ int i915_mutex_lock_interruptible(struct drm_device *dev)
 static inline bool
 i915_gem_object_is_inactive(struct drm_i915_gem_object *obj)
 {
-	return obj->gtt_space && !obj->active && obj->pin_count == 0;
+	return !obj->active && obj->pin_count == 0;
 }
 
 int
@@ -2737,6 +2737,7 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj)
 int
 i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
 {
+	drm_i915_private_t *dev_priv = obj->base.dev->dev_private;
 	uint32_t old_write_domain, old_read_domains;
 	int ret;
 
@@ -2777,6 +2778,10 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
 					    old_read_domains,
 					    old_write_domain);
 
+	/* And bump the LRU for this access */
+	if (i915_gem_object_is_inactive(obj))
+		list_move_tail(&obj->mm_list, &dev_priv->mm.inactive_list);
+
 	return 0;
 }
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/i915: Bump the inactive LRU on set-to-GTT-domain
  2012-04-24 14:52 [PATCH] drm/i915: Bump the inactive LRU on set-to-GTT-domain Chris Wilson
@ 2012-04-25  9:04 ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2012-04-25  9:04 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Tue, Apr 24, 2012 at 03:52:35PM +0100, Chris Wilson wrote:
> Currently, we only bump the LRU of an object when we bind into the GTT
> for a page-fault. As the object may be used many times before its
> mapping is zapped, we do not mark it as active as frequently as we
> should. Userspace should be calling set-to-GTT-domain before each
> pointer deference (for synchronous access) and so is a good place
> to mark the buffer as active.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Queued for -next (with an extended commit message as discussed on irc),
thanks for the patch.
-Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-25  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-24 14:52 [PATCH] drm/i915: Bump the inactive LRU on set-to-GTT-domain Chris Wilson
2012-04-25  9:04 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox