[v2,11/12] drm/i915: Only update mode related state if a modeset happened.
diff mbox

Message ID 1438000541-3219-12-git-send-email-maarten.lankhorst@linux.intel.com
State New
Headers show

Commit Message

Maarten Lankhorst July 27, 2015, 12:35 p.m. UTC
The rest will be a noop anyway, since without modeset there will be
no updated dplls and no modeset state to update.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

Comments

Ander Conselvan de Oliveira July 30, 2015, 12:19 p.m. UTC | #1
Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com>

On Mon, 2015-07-27 at 14:35 +0200, Maarten Lankhorst wrote:
> The rest will be a noop anyway, since without modeset there will be
> no updated dplls and no modeset state to update.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 30 +++++++-----------------------
>  1 file changed, 7 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 23175ce6583d..280629911d41 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12181,33 +12181,15 @@ fail:
>  	return ret;
>  }
>  
> -static bool intel_crtc_in_use(struct drm_crtc *crtc)
> -{
> -	struct drm_encoder *encoder;
> -	struct drm_device *dev = crtc->dev;
> -
> -	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
> -		if (encoder->crtc == crtc)
> -			return true;
> -
> -	return false;
> -}
> -
>  static void
> -intel_modeset_update_state(struct drm_atomic_state *state)
> +intel_modeset_update_crtc_state(struct drm_atomic_state *state)
>  {
>  	struct drm_crtc *crtc;
>  	struct drm_crtc_state *crtc_state;
>  	int i;
>  
> -	intel_shared_dpll_commit(state);
> -
> -	drm_atomic_helper_update_legacy_modeset_state(state->dev, state);
> -
>  	/* Double check state. */
>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> -		WARN_ON(crtc->state->enable != intel_crtc_in_use(crtc));
> -
>  		to_intel_crtc(crtc)->config = to_intel_crtc_state(crtc->state);
>  
>  		/* Update hwmode for vblank functions */
> @@ -13109,12 +13091,14 @@ static int intel_atomic_commit(struct drm_device *dev,
>  
>  	/* Only after disabling all output pipelines that will be changed can we
>  	 * update the the output configuration. */
> -	intel_modeset_update_state(state);
> +	intel_modeset_update_crtc_state(state);
>  
> -	/* The state has been swaped above, so state actually contains the
> -	 * old state now. */
> -	if (any_ms)
> +	if (any_ms) {
> +		intel_shared_dpll_commit(state);
> +
> +		drm_atomic_helper_update_legacy_modeset_state(state->dev, state);
>  		modeset_update_crtc_power_domains(state);
> +	}
>  
>  	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 23175ce6583d..280629911d41 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12181,33 +12181,15 @@  fail:
 	return ret;
 }
 
-static bool intel_crtc_in_use(struct drm_crtc *crtc)
-{
-	struct drm_encoder *encoder;
-	struct drm_device *dev = crtc->dev;
-
-	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
-		if (encoder->crtc == crtc)
-			return true;
-
-	return false;
-}
-
 static void
-intel_modeset_update_state(struct drm_atomic_state *state)
+intel_modeset_update_crtc_state(struct drm_atomic_state *state)
 {
 	struct drm_crtc *crtc;
 	struct drm_crtc_state *crtc_state;
 	int i;
 
-	intel_shared_dpll_commit(state);
-
-	drm_atomic_helper_update_legacy_modeset_state(state->dev, state);
-
 	/* Double check state. */
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
-		WARN_ON(crtc->state->enable != intel_crtc_in_use(crtc));
-
 		to_intel_crtc(crtc)->config = to_intel_crtc_state(crtc->state);
 
 		/* Update hwmode for vblank functions */
@@ -13109,12 +13091,14 @@  static int intel_atomic_commit(struct drm_device *dev,
 
 	/* Only after disabling all output pipelines that will be changed can we
 	 * update the the output configuration. */
-	intel_modeset_update_state(state);
+	intel_modeset_update_crtc_state(state);
 
-	/* The state has been swaped above, so state actually contains the
-	 * old state now. */
-	if (any_ms)
+	if (any_ms) {
+		intel_shared_dpll_commit(state);
+
+		drm_atomic_helper_update_legacy_modeset_state(state->dev, state);
 		modeset_update_crtc_power_domains(state);
+	}
 
 	/* Now enable the clocks, plane, pipe, and connectors that we set up. */
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {