diff mbox series

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

Message ID 20210930001409.254817-9-jose.souza@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/9] drm/i915/display/psr: Handle plane and pipe restrictions at every page flip | expand

Commit Message

Souza, Jose Sept. 30, 2021, 12:14 a.m. UTC
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@linux.intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

Ville Syrjälä Sept. 30, 2021, 7:58 a.m. UTC | #1
On Wed, Sep 29, 2021 at 05:14:09PM -0700, José Roberto de Souza wrote:
> 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@linux.intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@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;
> +			}

This combination should be impossible to get. Are you seeing this
happening in some case?

> +
> +			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
diff mbox series

Patch

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);