[PATCH 09/11] drm/i915/display: Always wait vblank counter to increment when commit needs a modeset

José Roberto de Souza jose.souza at intel.com
Fri Sep 24 23:41:10 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 b5cb71e36f8f8..c97972616b833 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -10405,15 +10405,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-trybot mailing list