aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_wakeref.h
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-11-18 23:02:46 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-11-19 18:02:48 +0000
commitf4ba0707c825d60f1d0f5ce7bd3d875e68f3e204 (patch)
treeb42c7d592edd7418a4d7d7cf81c69610068dc0c2 /drivers/gpu/drm/i915/intel_wakeref.h
parentdrm/i915/gem: Manually dump the debug trace on GEM_BUG_ON (diff)
downloadlinux-dev-f4ba0707c825d60f1d0f5ce7bd3d875e68f3e204.tar.xz
linux-dev-f4ba0707c825d60f1d0f5ce7bd3d875e68f3e204.zip
drm/i915: Wait until the intel_wakeref idle callback is complete
When waiting for idle, serialise with any ongoing callback so that it will have completed before completing the wait. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191118230254.2615942-12-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/intel_wakeref.h')
-rw-r--r--drivers/gpu/drm/i915/intel_wakeref.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_wakeref.h b/drivers/gpu/drm/i915/intel_wakeref.h
index 5f0c972a80fb..affe4de3746b 100644
--- a/drivers/gpu/drm/i915/intel_wakeref.h
+++ b/drivers/gpu/drm/i915/intel_wakeref.h
@@ -152,6 +152,21 @@ intel_wakeref_unlock(struct intel_wakeref *wf)
}
/**
+ * intel_wakeref_unlock_wait: Wait until the active callback is complete
+ * @wf: the wakeref
+ *
+ * Waits for the active callback (under the @wf->mutex or another CPU) is
+ * complete.
+ */
+static inline void
+intel_wakeref_unlock_wait(struct intel_wakeref *wf)
+{
+ mutex_lock(&wf->mutex);
+ mutex_unlock(&wf->mutex);
+ flush_work(&wf->work);
+}
+
+/**
* intel_wakeref_is_active: Query whether the wakeref is currently held
* @wf: the wakeref
*