All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 21/22] drm/i915: Bump the inactive tracking for all VMA accessed
Date: Tue, 16 Aug 2016 11:42:47 +0100	[thread overview]
Message-ID: <1471344168-28136-22-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1471344168-28136-1-git-send-email-chris@chris-wilson.co.uk>

We track the LRU access for eviction and bump the last access for the
user GGTT on set-to-gtt. When we do so we need to not only bump the
primary GGTT VMA but all partials as well. Similarly we want to
bump the last access tracking for when unpinning an object from the
scanout so that they do not get promptly evicted and hopefully remain
available for reuse on the next frame.

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

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index a76dffd3fbd7..ab3c96f09050 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3242,6 +3242,24 @@ i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj)
 					    I915_GEM_DOMAIN_CPU);
 }
 
+static void i915_gem_object_bump_inactive_ggtt(struct drm_i915_gem_object *obj)
+{
+	struct i915_vma *vma;
+
+	list_for_each_entry(vma, &obj->vma_list, obj_link) {
+		if (!i915_vma_is_ggtt(vma))
+			continue;
+
+		if (i915_vma_is_active(vma))
+			continue;
+
+		if (!drm_mm_node_allocated(&vma->node))
+			continue;
+
+		list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
+	}
+}
+
 /**
  * Moves a single object to the GTT read, and possibly write domain.
  * @obj: object to act on
@@ -3254,7 +3272,6 @@ int
 i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
 {
 	uint32_t old_write_domain, old_read_domains;
-	struct i915_vma *vma;
 	int ret;
 
 	ret = i915_gem_object_wait_rendering(obj, !write);
@@ -3304,11 +3321,7 @@ i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write)
 					    old_write_domain);
 
 	/* And bump the LRU for this access */
-	vma = i915_gem_object_to_ggtt(obj, NULL);
-	if (vma &&
-	    drm_mm_node_allocated(&vma->node) &&
-	    !i915_vma_is_active(vma))
-		list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
+	i915_gem_object_bump_inactive_ggtt(obj);
 
 	return 0;
 }
@@ -3611,6 +3624,10 @@ i915_gem_object_unpin_from_display_plane(struct i915_vma *vma)
 	if (--vma->obj->pin_display == 0)
 		vma->display_alignment = 0;
 
+	/* Bump the LRU to try and avoid premature eviction whilst flipping  */
+	if (!i915_vma_is_active(vma))
+		list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
+
 	i915_vma_unpin(vma);
 	WARN_ON(vma->obj->pin_display > i915_vma_pin_count(vma));
 }
-- 
2.8.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-08-16 10:43 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-16 10:42 An almost complete set of reviewed patches for tiled partial Chris Wilson
2016-08-16 10:42 ` [PATCH 01/22] drm/i915: Cache kmap between relocations Chris Wilson
2016-08-16 10:42 ` [PATCH 02/22] drm/i915: Extract i915_gem_obj_prepare_shmem_write() Chris Wilson
2016-08-16 10:42 ` [PATCH 03/22] drm/i915: Before accessing an object via the cpu, flush GTT writes Chris Wilson
2016-08-16 10:42 ` [PATCH 04/22] drm/i915: Wait for writes through the GTT to land before reading back Chris Wilson
2016-08-16 10:42 ` [PATCH 05/22] drm/i915: Pin the pages first in shmem prepare read/write Chris Wilson
2016-08-16 11:57   ` Joonas Lahtinen
2016-08-16 12:02     ` Chris Wilson
2016-08-16 12:46       ` Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 06/22] drm/i915: Tidy up flush cpu/gtt write domains Chris Wilson
2016-08-16 10:42 ` [PATCH 07/22] drm/i915: Refactor execbuffer relocation writing Chris Wilson
2016-08-17  8:47   ` Joonas Lahtinen
2016-08-17  8:57     ` Chris Wilson
2016-08-17  9:26       ` Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 08/22] drm/i915: Fallback to single page GTT mmappings for relocations Chris Wilson
2016-08-17  7:19   ` Joonas Lahtinen
2016-08-17  7:57     ` Chris Wilson
2016-08-16 10:42 ` [PATCH 09/22] drm/i915: Disallow direct CPU access to stolen pages " Chris Wilson
2016-08-16 11:49   ` Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 10/22] drm/i915: Move map-and-fenceable tracking to the VMA Chris Wilson
2016-08-16 10:42 ` [PATCH 11/22] drm/i915: Allow ringbuffers to be bound anywhere Chris Wilson
2016-08-16 12:52   ` Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 12/22] drm/i915: Allocate rings from stolen Chris Wilson
2016-08-16 11:47   ` Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 13/22] drm/i915/userptr: Make gup errors stickier Chris Wilson
2016-08-16 10:42 ` [PATCH 14/22] drm/i915: Rename fence.lru_list to link Chris Wilson
2016-08-16 11:39   ` Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 15/22] drm/i915: Move fence tracking from object to vma Chris Wilson
2016-08-16 11:38   ` Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 16/22] drm/i915: Choose partial chunksize based on tile row size Chris Wilson
2016-08-16 10:42 ` [PATCH 17/22] drm/i915: Fix partial GGTT faulting Chris Wilson
2016-08-16 10:42 ` [PATCH 18/22] drm/i915: Choose not to evict faultable objects from the GGTT Chris Wilson
2016-08-16 11:31   ` Joonas Lahtinen
2016-08-16 11:46     ` Chris Wilson
2016-08-16 10:42 ` [PATCH 19/22] drm/i915: Fallback to using unmappable memory for scanout Chris Wilson
2016-08-16 10:42 ` [PATCH 20/22] drm/i915: Track display alignment on VMA Chris Wilson
2016-08-16 10:42 ` Chris Wilson [this message]
2016-08-16 11:20   ` [PATCH 21/22] drm/i915: Bump the inactive tracking for all VMA accessed Joonas Lahtinen
2016-08-16 10:42 ` [PATCH 22/22] drm/i915: Stop discarding GTT cache-domain on unbind vma Chris Wilson
2016-08-16 11:25 ` ✗ Ro.CI.BAT: failure for series starting with [01/22] drm/i915: Cache kmap between relocations Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471344168-28136-22-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.