aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/gem/i915_gem_domain.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-08-22 07:15:57 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-08-22 08:53:42 +0100
commit1f7fd484fff1b432373f0d0682fb0e2015113161 (patch)
tree1154402998a28db068e05c7960f6d09fe249c3dc /drivers/gpu/drm/i915/gem/i915_gem_domain.c
parentdrm/i915: Pull obj->userfault tracking under the ggtt->mutex (diff)
downloadlinux-dev-1f7fd484fff1b432373f0d0682fb0e2015113161.tar.xz
linux-dev-1f7fd484fff1b432373f0d0682fb0e2015113161.zip
drm/i915: Replace i915_vma_put_fence()
Avoid calling i915_vma_put_fence() by using our alternate paths that bind a secondary vma avoiding the original fenced vma. For the few instances where we need to release the fence (i.e. on binding when the GGTT range becomes invalid), replace the put_fence with a revoke_fence. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190822061557.18402-1-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/gem/i915_gem_domain.c')
-rw-r--r--drivers/gpu/drm/i915/gem/i915_gem_domain.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
index a1afc2690e9e..9c58e8fac1d9 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c
@@ -221,6 +221,8 @@ restart:
* state and so involves less work.
*/
if (atomic_read(&obj->bind_count)) {
+ struct drm_i915_private *i915 = to_i915(obj->base.dev);
+
/* Before we change the PTE, the GPU must not be accessing it.
* If we wait upon the object, we know that all the bound
* VMA are no longer active.
@@ -232,18 +234,30 @@ restart:
if (ret)
return ret;
- if (!HAS_LLC(to_i915(obj->base.dev)) &&
- cache_level != I915_CACHE_NONE) {
- /* Access to snoopable pages through the GTT is
+ if (!HAS_LLC(i915) && cache_level != I915_CACHE_NONE) {
+ intel_wakeref_t wakeref =
+ intel_runtime_pm_get(&i915->runtime_pm);
+
+ /*
+ * Access to snoopable pages through the GTT is
* incoherent and on some machines causes a hard
* lockup. Relinquish the CPU mmaping to force
* userspace to refault in the pages and we can
* then double check if the GTT mapping is still
* valid for that pointer access.
*/
- i915_gem_object_release_mmap(obj);
+ ret = mutex_lock_interruptible(&i915->ggtt.vm.mutex);
+ if (ret) {
+ intel_runtime_pm_put(&i915->runtime_pm,
+ wakeref);
+ return ret;
+ }
- /* As we no longer need a fence for GTT access,
+ if (obj->userfault_count)
+ __i915_gem_object_release_mmap(obj);
+
+ /*
+ * As we no longer need a fence for GTT access,
* we can relinquish it now (and so prevent having
* to steal a fence from someone else on the next
* fence request). Note GPU activity would have
@@ -251,12 +265,17 @@ restart:
* supposed to be linear.
*/
for_each_ggtt_vma(vma, obj) {
- ret = i915_vma_put_fence(vma);
+ ret = i915_vma_revoke_fence(vma);
if (ret)
- return ret;
+ break;
}
+ mutex_unlock(&i915->ggtt.vm.mutex);
+ intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+ if (ret)
+ return ret;
} else {
- /* We either have incoherent backing store and
+ /*
+ * We either have incoherent backing store and
* so no GTT access or the architecture is fully
* coherent. In such cases, existing GTT mmaps
* ignore the cache bit in the PTE and we can