[PATCH 2/2] defer
Chris Wilson
chris at chris-wilson.co.uk
Wed Jun 7 22:16:54 UTC 2017
---
drivers/gpu/drm/i915/intel_display.c | 58 +++++++++++++++++++++---------------
1 file changed, 34 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 242d5b805934..e8f4b82c7ab6 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12982,7 +12982,23 @@ static void intel_atomic_helper_free_state_worker(struct work_struct *work)
intel_atomic_helper_free_state(dev_priv);
}
-static void intel_atomic_commit_tail(struct drm_atomic_state *state)
+static void intel_atomic_commit_cleanup(struct work_struct *work)
+{
+ struct drm_atomic_state *state =
+ container_of(work, struct drm_atomic_state, commit_work);
+ struct drm_device *dev = state->dev;
+ struct drm_i915_private *dev_priv = to_i915(dev);
+
+ drm_atomic_helper_cleanup_planes(dev, state);
+ drm_atomic_helper_commit_cleanup_done(state);
+
+ drm_atomic_state_put(state);
+
+ intel_atomic_helper_free_state(dev_priv);
+}
+
+static void intel_atomic_commit_tail(struct drm_atomic_state *state,
+ bool nonblock)
{
struct drm_device *dev = state->dev;
struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
@@ -13123,29 +13139,23 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
drm_atomic_helper_commit_hw_done(state);
- if (intel_state->modeset)
+ if (intel_state->modeset) {
+ /* As one of the primary mmio accessors, KMS has a high
+ * likelihood of triggering bugs in unclaimed access. After we
+ * finish modesetting, see if an error has been flagged, and
+ * if so enable debugging for the next modeset - and hope we
+ * catch the culprit.
+ */
+ intel_uncore_arm_unclaimed_mmio_detection(dev_priv);
intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET);
+ }
- drm_atomic_helper_cleanup_planes(dev, state);
-
- drm_atomic_helper_commit_cleanup_done(state);
-
- drm_atomic_state_put(state);
-
- /* As one of the primary mmio accessors, KMS has a high likelihood
- * of triggering bugs in unclaimed access. After we finish
- * modesetting, see if an error has been flagged, and if so
- * enable debugging for the next modeset - and hope we catch
- * the culprit.
- *
- * XXX note that we assume display power is on at this point.
- * This might hold true now but we need to add pm helper to check
- * unclaimed only when the hardware is on, as atomic commits
- * can happen also when the device is completely off.
- */
- intel_uncore_arm_unclaimed_mmio_detection(dev_priv);
-
- intel_atomic_helper_free_state(dev_priv);
+ if (!nonblock) {
+ INIT_WORK(&state->commit_work, intel_atomic_commit_cleanup);
+ schedule_work(&state->commit_work);
+ } else {
+ intel_atomic_commit_cleanup(&state->commit_work);
+ }
}
static void intel_atomic_commit_work(struct work_struct *work)
@@ -13153,7 +13163,7 @@ static void intel_atomic_commit_work(struct work_struct *work)
struct drm_atomic_state *state =
container_of(work, struct drm_atomic_state, commit_work);
- intel_atomic_commit_tail(state);
+ intel_atomic_commit_tail(state, true);
}
static int __i915_sw_fence_call
@@ -13270,7 +13280,7 @@ static int intel_atomic_commit(struct drm_device *dev,
i915_sw_fence_commit(&intel_state->commit_ready);
if (!nonblock) {
i915_sw_fence_wait(&intel_state->commit_ready);
- intel_atomic_commit_tail(state);
+ intel_atomic_commit_tail(state, false);
}
return 0;
--
2.11.0
More information about the Intel-gfx-trybot
mailing list