[10/10] drm/i915: Only run commit when crtc is active.
diff mbox

Message ID 1441894085-25662-11-git-send-email-maarten.lankhorst@linux.intel.com
State New
Headers show

Commit Message

Maarten Lankhorst Sept. 10, 2015, 2:08 p.m. UTC
The crtc->active guards are no longer needed now that all state
updates are outside the commit.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 16 ++++++----------
 drivers/gpu/drm/i915/intel_sprite.c  |  3 ---
 2 files changed, 6 insertions(+), 13 deletions(-)

Comments

Daniel Vetter Sept. 10, 2015, 3:51 p.m. UTC | #1
On Thu, Sep 10, 2015 at 04:08:05PM +0200, Maarten Lankhorst wrote:
> The crtc->active guards are no longer needed now that all state
> updates are outside the commit.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

This looks actually complicated, so I'll punt. Merged most of the other
patches from your series, thanks.
-Daniel
> ---
>  drivers/gpu/drm/i915/intel_display.c | 16 ++++++----------
>  drivers/gpu/drm/i915/intel_sprite.c  |  3 ---
>  2 files changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index f41ca558ba3b..dc696ec5f228 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -13135,7 +13135,9 @@ static int intel_atomic_commit(struct drm_device *dev,
>  		if (!modeset)
>  			intel_pre_plane_update(intel_crtc);
>  
> -		drm_atomic_helper_commit_planes_on_crtc(crtc_state);
> +		if (crtc->state->active && (crtc->state->planes_changed ||
> +		    to_intel_crtc_state(crtc->state)->update_pipe))
> +			drm_atomic_helper_commit_planes_on_crtc(crtc_state);
>  
>  		if (put_domains)
>  			modeset_put_power_domains(dev_priv, put_domains);
> @@ -13445,9 +13447,6 @@ intel_commit_primary_plane(struct drm_plane *plane,
>  
>  	crtc = crtc ? crtc : plane->crtc;
>  
> -	if (!crtc->state->active)
> -		return;
> -
>  	dev_priv->display.update_primary_plane(crtc, fb,
>  					       state->src.x1 >> 16,
>  					       state->src.y1 >> 16);
> @@ -13476,8 +13475,7 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
>  		intel_update_watermarks(crtc);
>  
>  	/* Perform vblank evasion around commit operation */
> -	if (crtc->state->active)
> -		intel_pipe_update_start(intel_crtc);
> +	intel_pipe_update_start(intel_crtc);
>  
>  	if (modeset)
>  		return;
> @@ -13493,8 +13491,7 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc,
>  {
>  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
>  
> -	if (crtc->state->active)
> -		intel_pipe_update_end(intel_crtc);
> +	intel_pipe_update_end(intel_crtc);
>  }
>  
>  /**
> @@ -13677,8 +13674,7 @@ intel_commit_cursor_plane(struct drm_plane *plane,
>  	intel_crtc->cursor_bo = obj;
>  
>  update:
> -	if (crtc->state->active)
> -		intel_crtc_update_cursor(crtc, state->visible);
> +	intel_crtc_update_cursor(crtc, state->visible);
>  }
>  
>  static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 9553859ca151..9c13d8156135 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -927,9 +927,6 @@ intel_commit_sprite_plane(struct drm_plane *plane,
>  
>  	crtc = crtc ? crtc : plane->crtc;
>  
> -	if (!crtc->state->active)
> -		return;
> -
>  	if (state->visible) {
>  		intel_plane->update_plane(plane, crtc, fb,
>  					  state->dst.x1, state->dst.y1,
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst Sept. 14, 2015, 10:02 a.m. UTC | #2
Op 10-09-15 om 17:51 schreef Daniel Vetter:
> On Thu, Sep 10, 2015 at 04:08:05PM +0200, Maarten Lankhorst wrote:
>> The crtc->active guards are no longer needed now that all state
>> updates are outside the commit.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> This looks actually complicated, so I'll punt. Merged most of the other
> patches from your series, thanks.
It's very easy, but needs previous patches to be applied, the fixup patch for intel_update_primaries and the update primary plane state outside commit_primary_plane patch.

With all state updates in commit gone, only hw state is still updated.
Each commit_plane has a line with if (!crtc->state->active) return; eg its a noop when crtc is inactive. Same for begin/finish crtc_commit.

Hence it could be changed to
if (crtc->state->active)
drm_atomic_helper_commit_planes_on_crtc(crtc_state);

When planes_changed = false, there is no plane state for the current crtc. The other function of begin_crtc_commit is updating pipe config for a fastset.

If neither are required, there's no hw state to update, so commit_planes_on_crtc would do vblank evasion for no reason. It can be skipped.

Maybe it's easier to understand if I split this up in 2 patches. One to make the crtc->state->active changes, another to add the planes_changed || update_pipe changes.
> -Daniel
>> ---
>>  drivers/gpu/drm/i915/intel_display.c | 16 ++++++----------
>>  drivers/gpu/drm/i915/intel_sprite.c  |  3 ---
>>  2 files changed, 6 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
>> index f41ca558ba3b..dc696ec5f228 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -13135,7 +13135,9 @@ static int intel_atomic_commit(struct drm_device *dev,
>>  		if (!modeset)
>>  			intel_pre_plane_update(intel_crtc);
>>  
>> -		drm_atomic_helper_commit_planes_on_crtc(crtc_state);
>> +		if (crtc->state->active && (crtc->state->planes_changed ||
>> +		    to_intel_crtc_state(crtc->state)->update_pipe))
>> +			drm_atomic_helper_commit_planes_on_crtc(crtc_state);
>>  
>>  		if (put_domains)
>>  			modeset_put_power_domains(dev_priv, put_domains);
>> @@ -13445,9 +13447,6 @@ intel_commit_primary_plane(struct drm_plane *plane,
>>  
>>  	crtc = crtc ? crtc : plane->crtc;
>>  
>> -	if (!crtc->state->active)
>> -		return;
>> -
>>  	dev_priv->display.update_primary_plane(crtc, fb,
>>  					       state->src.x1 >> 16,
>>  					       state->src.y1 >> 16);
>> @@ -13476,8 +13475,7 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,
>>  		intel_update_watermarks(crtc);
>>  
>>  	/* Perform vblank evasion around commit operation */
>> -	if (crtc->state->active)
>> -		intel_pipe_update_start(intel_crtc);
>> +	intel_pipe_update_start(intel_crtc);
>>  
>>  	if (modeset)
>>  		return;
>> @@ -13493,8 +13491,7 @@ static void intel_finish_crtc_commit(struct drm_crtc *crtc,
>>  {
>>  	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
>>  
>> -	if (crtc->state->active)
>> -		intel_pipe_update_end(intel_crtc);
>> +	intel_pipe_update_end(intel_crtc);
>>  }
>>  
>>  /**
>> @@ -13677,8 +13674,7 @@ intel_commit_cursor_plane(struct drm_plane *plane,
>>  	intel_crtc->cursor_bo = obj;
>>  
>>  update:
>> -	if (crtc->state->active)
>> -		intel_crtc_update_cursor(crtc, state->visible);
>> +	intel_crtc_update_cursor(crtc, state->visible);
>>  }
>>  
>>  static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
>> index 9553859ca151..9c13d8156135 100644
>> --- a/drivers/gpu/drm/i915/intel_sprite.c
>> +++ b/drivers/gpu/drm/i915/intel_sprite.c
>> @@ -927,9 +927,6 @@ intel_commit_sprite_plane(struct drm_plane *plane,
>>  
>>  	crtc = crtc ? crtc : plane->crtc;
>>  
>> -	if (!crtc->state->active)
>> -		return;
>> -
>>  	if (state->visible) {
>>  		intel_plane->update_plane(plane, crtc, fb,
>>  					  state->dst.x1, state->dst.y1,
>> -- 
>> 2.1.0
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f41ca558ba3b..dc696ec5f228 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13135,7 +13135,9 @@  static int intel_atomic_commit(struct drm_device *dev,
 		if (!modeset)
 			intel_pre_plane_update(intel_crtc);
 
-		drm_atomic_helper_commit_planes_on_crtc(crtc_state);
+		if (crtc->state->active && (crtc->state->planes_changed ||
+		    to_intel_crtc_state(crtc->state)->update_pipe))
+			drm_atomic_helper_commit_planes_on_crtc(crtc_state);
 
 		if (put_domains)
 			modeset_put_power_domains(dev_priv, put_domains);
@@ -13445,9 +13447,6 @@  intel_commit_primary_plane(struct drm_plane *plane,
 
 	crtc = crtc ? crtc : plane->crtc;
 
-	if (!crtc->state->active)
-		return;
-
 	dev_priv->display.update_primary_plane(crtc, fb,
 					       state->src.x1 >> 16,
 					       state->src.y1 >> 16);
@@ -13476,8 +13475,7 @@  static void intel_begin_crtc_commit(struct drm_crtc *crtc,
 		intel_update_watermarks(crtc);
 
 	/* Perform vblank evasion around commit operation */
-	if (crtc->state->active)
-		intel_pipe_update_start(intel_crtc);
+	intel_pipe_update_start(intel_crtc);
 
 	if (modeset)
 		return;
@@ -13493,8 +13491,7 @@  static void intel_finish_crtc_commit(struct drm_crtc *crtc,
 {
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 
-	if (crtc->state->active)
-		intel_pipe_update_end(intel_crtc);
+	intel_pipe_update_end(intel_crtc);
 }
 
 /**
@@ -13677,8 +13674,7 @@  intel_commit_cursor_plane(struct drm_plane *plane,
 	intel_crtc->cursor_bo = obj;
 
 update:
-	if (crtc->state->active)
-		intel_crtc_update_cursor(crtc, state->visible);
+	intel_crtc_update_cursor(crtc, state->visible);
 }
 
 static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 9553859ca151..9c13d8156135 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -927,9 +927,6 @@  intel_commit_sprite_plane(struct drm_plane *plane,
 
 	crtc = crtc ? crtc : plane->crtc;
 
-	if (!crtc->state->active)
-		return;
-
 	if (state->visible) {
 		intel_plane->update_plane(plane, crtc, fb,
 					  state->dst.x1, state->dst.y1,