diff mbox

[8/8] drm/i915/gen9+: Preserve old allocation from crtc_state.

Message ID 1476278901-15750-9-git-send-email-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Maarten Lankhorst Oct. 12, 2016, 1:28 p.m. UTC
This is the last bit required for making nonblocking modesets work
correctly. The state in intel_crtc->hw_ddb is not updated until
somewhere in atomic commit, while the previous crtc state should be
accurate if the ddb hasn't changed.

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

Comments

Matt Roper Oct. 20, 2016, 10:09 p.m. UTC | #1
On Wed, Oct 12, 2016 at 03:28:21PM +0200, Maarten Lankhorst wrote:
> This is the last bit required for making nonblocking modesets work
> correctly. The state in intel_crtc->hw_ddb is not updated until
> somewhere in atomic commit, while the previous crtc state should be
> accurate if the ddb hasn't changed.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Can we get rid of hw_ddb completely and always pull from old state?  It
looks like the only other place it's still used is
skl_update_crtcs() -> skl_ddb_allocation_overlaps().


Matt

> ---
>  drivers/gpu/drm/i915/intel_display.c | 2 +-
>  drivers/gpu/drm/i915/intel_pm.c      | 6 +++++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index d3d7d9dc14a8..93e16da0aa51 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14332,7 +14332,7 @@ static void skl_update_crtcs(struct drm_atomic_state *state,
>  			 * new ddb allocation to take effect.
>  			 */
>  			if (!skl_ddb_entry_equal(&cstate->wm.skl.ddb,
> -						 &intel_crtc->hw_ddb) &&
> +						 &to_intel_crtc_state(old_crtc_state)->wm.skl.ddb) &&
>  			    !crtc->state->active_changed &&
>  			    intel_state->wm_results.dirty_pipes != updated)
>  				vbl_wait = true;
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 18c62d1eea19..182e6b30b60a 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3091,7 +3091,11 @@ skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
>  	 * we currently hold.
>  	 */
>  	if (!intel_state->active_pipe_changes) {
> -		*alloc = to_intel_crtc(for_crtc)->hw_ddb;
> +		/*
> +		 * alloc may be cleared by clear_intel_crtc_state,
> +		 * copy from old state to be sure
> +		 */
> +		*alloc = to_intel_crtc_state(for_crtc->state)->wm.skl.ddb;
>  		return;
>  	}
>  
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst Oct. 24, 2016, 8:49 a.m. UTC | #2
Op 21-10-16 om 00:09 schreef Matt Roper:
> On Wed, Oct 12, 2016 at 03:28:21PM +0200, Maarten Lankhorst wrote:
>> This is the last bit required for making nonblocking modesets work
>> correctly. The state in intel_crtc->hw_ddb is not updated until
>> somewhere in atomic commit, while the previous crtc state should be
>> accurate if the ddb hasn't changed.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Can we get rid of hw_ddb completely and always pull from old state?  It
> looks like the only other place it's still used is
> skl_update_crtcs() -> skl_ddb_allocation_overlaps().
Probably as a followup patch. I kept it only for that reason indeed.

I suppose it could be changed to if (updated) state = new_state->ddb else state = old_state->ddb.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d3d7d9dc14a8..93e16da0aa51 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14332,7 +14332,7 @@  static void skl_update_crtcs(struct drm_atomic_state *state,
 			 * new ddb allocation to take effect.
 			 */
 			if (!skl_ddb_entry_equal(&cstate->wm.skl.ddb,
-						 &intel_crtc->hw_ddb) &&
+						 &to_intel_crtc_state(old_crtc_state)->wm.skl.ddb) &&
 			    !crtc->state->active_changed &&
 			    intel_state->wm_results.dirty_pipes != updated)
 				vbl_wait = true;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 18c62d1eea19..182e6b30b60a 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3091,7 +3091,11 @@  skl_ddb_get_pipe_allocation_limits(struct drm_device *dev,
 	 * we currently hold.
 	 */
 	if (!intel_state->active_pipe_changes) {
-		*alloc = to_intel_crtc(for_crtc)->hw_ddb;
+		/*
+		 * alloc may be cleared by clear_intel_crtc_state,
+		 * copy from old state to be sure
+		 */
+		*alloc = to_intel_crtc_state(for_crtc->state)->wm.skl.ddb;
 		return;
 	}