]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Mark shadow batch buffers as purgeable
authorBrad Volkin <bradley.d.volkin@intel.com>
Thu, 11 Dec 2014 20:13:11 +0000 (12:13 -0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 16 Dec 2014 09:39:09 +0000 (10:39 +0100)
By adding a new exec_entry flag, we cleanly mark the shadow objects
as purgeable after they are on the active list.

v2:
- Move 'shadow_batch_obj->madv = I915_MADV_WILLNEED' inside _get
  fnc (danvet, from v4 6/7 feedback)

v3:
- Remove duplicate 'madv = I915_MADV_WILLNEED' (danvet, from v6 4/5)

Issue: VIZ-4719
Signed-off-by: Brad Volkin <bradley.d.volkin@intel.com>
Reviewed-By: Jon Bloomfield <jon.bloomfield@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_batch_pool.c
drivers/gpu/drm/i915/i915_gem_execbuffer.c

index 6016125a4d1ec68a5a0240514caa274bec9c5127..c690170a1c4fbacbe82ba059c5566571e7acb989 100644 (file)
@@ -131,5 +131,7 @@ i915_gem_batch_pool_get(struct i915_gem_batch_pool *pool,
                /* Keep list in LRU order */
                list_move_tail(&obj->batch_pool_list, &pool->cache_list);
 
+       obj->madv = I915_MADV_WILLNEED;
+
        return obj;
 }
index 5973e2005e894ca1d2249f39fc75b4eee9093ddb..86de3720527bcb5a23590902af728d491be380a9 100644 (file)
@@ -37,6 +37,7 @@
 #define  __EXEC_OBJECT_HAS_FENCE (1<<30)
 #define  __EXEC_OBJECT_NEEDS_MAP (1<<29)
 #define  __EXEC_OBJECT_NEEDS_BIAS (1<<28)
+#define  __EXEC_OBJECT_PURGEABLE (1<<27)
 
 #define BATCH_OFFSET_BIAS (256*1024)
 
@@ -226,7 +227,12 @@ i915_gem_execbuffer_unreserve_vma(struct i915_vma *vma)
        if (entry->flags & __EXEC_OBJECT_HAS_PIN)
                vma->pin_count--;
 
-       entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE | __EXEC_OBJECT_HAS_PIN);
+       if (entry->flags & __EXEC_OBJECT_PURGEABLE)
+               obj->madv = I915_MADV_DONTNEED;
+
+       entry->flags &= ~(__EXEC_OBJECT_HAS_FENCE |
+                         __EXEC_OBJECT_HAS_PIN |
+                         __EXEC_OBJECT_PURGEABLE);
 }
 
 static void eb_destroy(struct eb_vmas *eb)
@@ -1436,6 +1442,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 
                        vma = i915_gem_obj_to_ggtt(shadow_batch_obj);
                        vma->exec_entry = &shadow_exec_entry;
+                       vma->exec_entry->flags = __EXEC_OBJECT_PURGEABLE;
                        drm_gem_object_reference(&shadow_batch_obj->base);
                        list_add_tail(&vma->exec_list, &eb->vmas);