[Intel-gfx] [PATCH 144/190] drm/i915: Bump the inactive MRU tracking for all VMA accessed
Chris Wilson
chris at chris-wilson.co.uk
Mon Jan 11 03:00:45 PST 2016
When we bump the MRU access tracking on set-to-gtt, we need to not only
bump the primary GGTT VMA but all partials as well. Similarly we want to
bump the MRU access for when unpinning an object from the scanout.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index fa518764c32c..6ceed074f738 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3003,6 +3003,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 (!vma->is_ggtt)
+ continue;
+
+ if (vma->active)
+ 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.
*
@@ -3013,7 +3031,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;
if (obj->base.write_domain == I915_GEM_DOMAIN_GTT)
@@ -3063,9 +3080,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) && !vma->active)
- list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
+ i915_gem_object_bump_inactive_ggtt(obj);
return 0;
}
@@ -3373,6 +3388,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 (!vma->active)
+ list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
+
i915_vma_unpin(vma);
WARN_ON(vma->obj->pin_display > vma->pin_count);
}
--
2.7.0.rc3
More information about the Intel-gfx
mailing list