[PATCH 4/6] last-commit

Chris Wilson chris at chris-wilson.co.uk
Thu Jun 8 07:17:00 UTC 2017


---
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++++++++----------
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d5724c8d9528..2abfdd35536e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12752,26 +12752,40 @@ static int intel_atomic_check(struct drm_device *dev,
 }
 
 static int intel_atomic_prepare_commit(struct drm_device *dev,
-				       struct drm_atomic_state *state)
+				       struct intel_atomic_state *state)
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct drm_crtc_state *crtc_state;
-	struct drm_crtc *crtc;
+	struct drm_crtc *drm_crtc;
 	int i, ret;
 
-	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
-		if (state->legacy_cursor_update)
+	for_each_new_crtc_in_state(&state->base, drm_crtc, crtc_state, i) {
+		struct intel_crtc *crtc = to_intel_crtc(drm_crtc);
+
+		if (crtc->last_commit) {
+			ret = i915_sw_fence_await_completion(&state->commit_ready,
+							     &crtc->last_commit->hw_done,
+							     GFP_KERNEL);
+			if (ret < 0)
+				return ret;
+
+			drm_crtc_commit_put(crtc->last_commit);
+		}
+		crtc->last_commit = state->base.crtcs[i].commit;
+		drm_crtc_commit_get(crtc->last_commit);
+
+		if (state->base.legacy_cursor_update)
 			continue;
 
-		ret = intel_crtc_wait_for_pending_flips(crtc);
+		ret = intel_crtc_wait_for_pending_flips(drm_crtc);
 		if (ret)
 			return ret;
 
-		if (atomic_read(&to_intel_crtc(crtc)->unpin_work_count) >= 2)
+		if (atomic_read(&crtc->unpin_work_count) >= 2)
 			flush_workqueue(dev_priv->wq);
 	}
 
-	return drm_atomic_helper_prepare_planes(dev, state);
+	return drm_atomic_helper_prepare_planes(dev, &state->base);
 }
 
 u32 intel_crtc_get_vblank_counter(struct intel_crtc *crtc)
@@ -13011,8 +13025,6 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state,
 	unsigned crtc_vblank_mask = 0;
 	int i;
 
-	drm_atomic_helper_wait_for_dependencies(state);
-
 	if (intel_state->modeset)
 		intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET);
 
@@ -13250,7 +13262,7 @@ static int intel_atomic_commit(struct drm_device *dev,
 	i915_sw_fence_init(&intel_state->commit_ready,
 			   intel_atomic_commit_ready);
 
-	ret = intel_atomic_prepare_commit(dev, state);
+	ret = intel_atomic_prepare_commit(dev, intel_state);
 	if (ret) {
 		DRM_DEBUG_ATOMIC("Preparing state failed with %i\n", ret);
 		i915_sw_fence_commit(&intel_state->commit_ready);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 83dd40905821..13044d95b166 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -808,6 +808,7 @@ struct intel_crtc {
 	int adjusted_y;
 
 	struct intel_crtc_state *config;
+	struct drm_crtc_commit *last_commit;
 
 	/* global reset count when the last flip was submitted */
 	unsigned int reset_count;
-- 
2.11.0



More information about the Intel-gfx-trybot mailing list