提交 4a684a41 编写于 作者: C Chris Wilson

drm/i915: Kill GTT mappings when moving from GTT domain

In order to force a page-fault on a GTT mapping after we start using it
from the GPU and so enforce correct CPU/GPU synchronisation, we need to
invalidate the mapping.

Pointed out by Owain G. Ainsworth.
Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
上级 e5281ccd
...@@ -1314,12 +1314,12 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -1314,12 +1314,12 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
ret = i915_gem_object_bind_to_gtt(obj, 0, true); ret = i915_gem_object_bind_to_gtt(obj, 0, true);
if (ret) if (ret)
goto unlock; goto unlock;
ret = i915_gem_object_set_to_gtt_domain(obj, write);
if (ret)
goto unlock;
} }
ret = i915_gem_object_set_to_gtt_domain(obj, write);
if (ret)
goto unlock;
if (!obj_priv->fault_mappable) { if (!obj_priv->fault_mappable) {
obj_priv->fault_mappable = true; obj_priv->fault_mappable = true;
i915_gem_info_update_mappable(dev_priv, obj, true); i915_gem_info_update_mappable(dev_priv, obj, true);
...@@ -2859,6 +2859,8 @@ i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj) ...@@ -2859,6 +2859,8 @@ i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj)
* to it immediately go to main memory as far as we know, so there's * to it immediately go to main memory as far as we know, so there's
* no chipset flush. It also doesn't land in render cache. * no chipset flush. It also doesn't land in render cache.
*/ */
i915_gem_release_mmap(obj);
old_write_domain = obj->write_domain; old_write_domain = obj->write_domain;
obj->write_domain = 0; obj->write_domain = 0;
...@@ -3183,6 +3185,10 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj, ...@@ -3183,6 +3185,10 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_CPU) if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_CPU)
i915_gem_clflush_object(obj); i915_gem_clflush_object(obj);
/* blow away mappings if mapped through GTT */
if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_GTT)
i915_gem_release_mmap(obj);
/* The actual obj->write_domain will be updated with /* The actual obj->write_domain will be updated with
* pending_write_domain after we emit the accumulated flush for all * pending_write_domain after we emit the accumulated flush for all
* of our domain changes in execbuffers (which clears objects' * of our domain changes in execbuffers (which clears objects'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册