[Intel-gfx] [PATCH v2 9/9] drm/i915/display: Always wait vblank counter to increment when commit needs a modeset

José Roberto de Souza jose.souza at intel.com
Thu Sep 30 00:14:09 UTC 2021


Not waiting for vblank counter to increment could potentialy cause
issues as commits after the one that needs a modeset could change
state of entities that are not committed into hardware yet.

Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 9e9db1b0a907b..9c49b6031cb5e 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -10494,15 +10494,24 @@ static int intel_atomic_commit(struct drm_device *dev,
 	 * FIXME doing watermarks and fb cleanup from a vblank worker
 	 * (assuming we had any) would solve these problems.
 	 */
-	if (DISPLAY_VER(dev_priv) < 9 && state->base.legacy_cursor_update) {
+	if (state->base.legacy_cursor_update) {
 		struct intel_crtc_state *new_crtc_state;
 		struct intel_crtc *crtc;
 		int i;
 
-		for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i)
-			if (new_crtc_state->wm.need_postvbl_update ||
-			    new_crtc_state->update_wm_post)
+		for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
+			if (intel_crtc_needs_modeset(new_crtc_state)) {
+				state->base.legacy_cursor_update = false;
+				break;
+			}
+
+			if (DISPLAY_VER(dev_priv) < 9 &&
+			    (new_crtc_state->wm.need_postvbl_update ||
+			     new_crtc_state->update_wm_post)) {
 				state->base.legacy_cursor_update = false;
+				break;
+			}
+		}
 	}
 
 	ret = intel_atomic_prepare_commit(state);
-- 
2.33.0



More information about the Intel-gfx mailing list