drm/i915: Reserve shadow batch VMA analogue to others
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Wed, 7 Jan 2015 17:32:39 +0000 (17:32 +0000)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 8 Jan 2015 08:34:58 +0000 (09:34 +0100)
If not pinned VMA can become an eviction target just before it needs to be
executed which breaks the internal object lifetime rules.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87399
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_execbuffer.c

index 8330660af978e5f7b103b380c351f6bcf3688c12..6c21c59ed71deb2912372a6e38c8c2b33ccbf376 100644 (file)
@@ -1084,6 +1084,7 @@ i915_gem_execbuffer_parse(struct intel_engine_cs *ring,
 {
        struct drm_i915_private *dev_priv = to_i915(batch_obj->base.dev);
        struct drm_i915_gem_object *shadow_batch_obj;
+       bool need_reloc = false;
        int ret;
 
        shadow_batch_obj = i915_gem_batch_pool_get(&dev_priv->mm.batch_pool,
@@ -1109,6 +1110,7 @@ i915_gem_execbuffer_parse(struct intel_engine_cs *ring,
                vma->exec_entry = shadow_exec_entry;
                vma->exec_entry->flags = __EXEC_OBJECT_PURGEABLE;
                drm_gem_object_reference(&shadow_batch_obj->base);
+               i915_gem_execbuffer_reserve_vma(vma, ring, &need_reloc);
                list_add_tail(&vma->exec_list, &eb->vmas);
 
                shadow_batch_obj->base.pending_read_domains =