diff mbox series

[09/14] drm/i915: Introduce crtc_state->update_planes bitmask

Message ID 20181101150605.18235-10-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Program SKL+ watermarks/ddb more carefully | expand

Commit Message

Ville Syrjala Nov. 1, 2018, 3:06 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Keep track which planes need updating during the commit. For now this
is just (was_visible || is_visible) but I'll have need to update
invisible planes later on for skl plane ddbs and for pre-skl pipe
gamma/csc control (which lives in the primary plane control register).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_atomic.c       | 1 +
 drivers/gpu/drm/i915/intel_atomic_plane.c | 8 ++++----
 drivers/gpu/drm/i915/intel_display.c      | 5 ++++-
 drivers/gpu/drm/i915/intel_drv.h          | 3 +++
 4 files changed, 12 insertions(+), 5 deletions(-)

Comments

Rodrigo Vivi Nov. 7, 2018, 9:49 p.m. UTC | #1
On Thu, Nov 01, 2018 at 05:06:00PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Keep track which planes need updating during the commit. For now this
> is just (was_visible || is_visible) but I'll have need to update
> invisible planes later on for skl plane ddbs and for pre-skl pipe
> gamma/csc control (which lives in the primary plane control register).
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_atomic.c       | 1 +
>  drivers/gpu/drm/i915/intel_atomic_plane.c | 8 ++++----
>  drivers/gpu/drm/i915/intel_display.c      | 5 ++++-
>  drivers/gpu/drm/i915/intel_drv.h          | 3 +++
>  4 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index a5a2c8fe58a7..8cb02f28d30c 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -184,6 +184,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
>  	crtc_state->fifo_changed = false;
>  	crtc_state->wm.need_postvbl_update = false;
>  	crtc_state->fb_bits = 0;
> +	crtc_state->update_planes = 0;
>  
>  	return &crtc_state->base;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 7d3685075201..010269a12390 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -137,6 +137,9 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
>  	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
>  		crtc_state->nv12_planes |= BIT(intel_plane->id);
>  
> +	if (state->visible || old_plane_state->base.visible)
> +		crtc_state->update_planes |= BIT(intel_plane->id);
> +
>  	return intel_plane_atomic_calc_changes(old_crtc_state,
>  					       &crtc_state->base,
>  					       old_plane_state,
> @@ -171,14 +174,11 @@ void intel_update_planes_on_crtc(struct intel_atomic_state *old_state,
>  				 struct intel_crtc_state *old_crtc_state,
>  				 struct intel_crtc_state *new_crtc_state)
>  {
> +	u32 update_mask = new_crtc_state->update_planes;
>  	struct intel_plane_state *new_plane_state;
>  	struct intel_plane *plane;
> -	u32 update_mask;
>  	int i;
>  
> -	update_mask = old_crtc_state->active_planes;
> -	update_mask |= new_crtc_state->active_planes;
> -

maybe this useless update_mask removal deserved a separated patch,
but not a big deal...

>  	for_each_new_intel_plane_in_state(old_state, plane, new_plane_state, i) {
>  		if (crtc->pipe != plane->pipe ||
>  		    !(update_mask & BIT(plane->id)))
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 852b5897e80b..33d73915b73e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10797,8 +10797,10 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
>  			continue;
>  
>  		plane_state->linked_plane = NULL;
> -		if (plane_state->slave && !plane_state->base.visible)
> +		if (plane_state->slave && !plane_state->base.visible) {
>  			crtc_state->active_planes &= ~BIT(plane->id);
> +			crtc_state->update_planes |= BIT(plane->id);
> +		}
>  
>  		plane_state->slave = false;
>  	}
> @@ -10839,6 +10841,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
>  		linked_state->slave = true;
>  		linked_state->linked_plane = plane;
>  		crtc_state->active_planes |= BIT(linked->id);
> +		crtc_state->update_planes |= BIT(linked->id);
>  		DRM_DEBUG_KMS("Using %s as Y plane for %s\n", linked->base.name, plane->base.name);
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 5331bbed5e8c..7a55f5921d34 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -925,6 +925,9 @@ struct intel_crtc_state {
>  	u8 active_planes;
>  	u8 nv12_planes;
>  
> +	/* bitmask of planes that will be updated during the commit */

I noticed how bad we are with documentation compared to the rest of drm
structs :/

but I'm glad you added the explanation in the comment here.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> +	u8 update_planes;
> +
>  	/* HDMI scrambling status */
>  	bool hdmi_scrambling;
>  
> -- 
> 2.18.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ville Syrjala Nov. 8, 2018, 11:32 a.m. UTC | #2
On Wed, Nov 07, 2018 at 01:49:39PM -0800, Rodrigo Vivi wrote:
> On Thu, Nov 01, 2018 at 05:06:00PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Keep track which planes need updating during the commit. For now this
> > is just (was_visible || is_visible) but I'll have need to update
> > invisible planes later on for skl plane ddbs and for pre-skl pipe
> > gamma/csc control (which lives in the primary plane control register).
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_atomic.c       | 1 +
> >  drivers/gpu/drm/i915/intel_atomic_plane.c | 8 ++++----
> >  drivers/gpu/drm/i915/intel_display.c      | 5 ++++-
> >  drivers/gpu/drm/i915/intel_drv.h          | 3 +++
> >  4 files changed, 12 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> > index a5a2c8fe58a7..8cb02f28d30c 100644
> > --- a/drivers/gpu/drm/i915/intel_atomic.c
> > +++ b/drivers/gpu/drm/i915/intel_atomic.c
> > @@ -184,6 +184,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
> >  	crtc_state->fifo_changed = false;
> >  	crtc_state->wm.need_postvbl_update = false;
> >  	crtc_state->fb_bits = 0;
> > +	crtc_state->update_planes = 0;
> >  
> >  	return &crtc_state->base;
> >  }
> > diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> > index 7d3685075201..010269a12390 100644
> > --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> > +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> > @@ -137,6 +137,9 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
> >  	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
> >  		crtc_state->nv12_planes |= BIT(intel_plane->id);
> >  
> > +	if (state->visible || old_plane_state->base.visible)
> > +		crtc_state->update_planes |= BIT(intel_plane->id);
> > +
> >  	return intel_plane_atomic_calc_changes(old_crtc_state,
> >  					       &crtc_state->base,
> >  					       old_plane_state,
> > @@ -171,14 +174,11 @@ void intel_update_planes_on_crtc(struct intel_atomic_state *old_state,
> >  				 struct intel_crtc_state *old_crtc_state,
> >  				 struct intel_crtc_state *new_crtc_state)
> >  {
> > +	u32 update_mask = new_crtc_state->update_planes;
> >  	struct intel_plane_state *new_plane_state;
> >  	struct intel_plane *plane;
> > -	u32 update_mask;
> >  	int i;
> >  
> > -	update_mask = old_crtc_state->active_planes;
> > -	update_mask |= new_crtc_state->active_planes;
> > -
> 
> maybe this useless update_mask removal deserved a separated patch,
> but not a big deal...

It's still there, just populated differently.

> 
> >  	for_each_new_intel_plane_in_state(old_state, plane, new_plane_state, i) {
> >  		if (crtc->pipe != plane->pipe ||
> >  		    !(update_mask & BIT(plane->id)))
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 852b5897e80b..33d73915b73e 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -10797,8 +10797,10 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
> >  			continue;
> >  
> >  		plane_state->linked_plane = NULL;
> > -		if (plane_state->slave && !plane_state->base.visible)
> > +		if (plane_state->slave && !plane_state->base.visible) {
> >  			crtc_state->active_planes &= ~BIT(plane->id);
> > +			crtc_state->update_planes |= BIT(plane->id);
> > +		}
> >  
> >  		plane_state->slave = false;
> >  	}
> > @@ -10839,6 +10841,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
> >  		linked_state->slave = true;
> >  		linked_state->linked_plane = plane;
> >  		crtc_state->active_planes |= BIT(linked->id);
> > +		crtc_state->update_planes |= BIT(linked->id);
> >  		DRM_DEBUG_KMS("Using %s as Y plane for %s\n", linked->base.name, plane->base.name);
> >  	}
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 5331bbed5e8c..7a55f5921d34 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -925,6 +925,9 @@ struct intel_crtc_state {
> >  	u8 active_planes;
> >  	u8 nv12_planes;
> >  
> > +	/* bitmask of planes that will be updated during the commit */
> 
> I noticed how bad we are with documentation compared to the rest of drm
> structs :/
> 
> but I'm glad you added the explanation in the comment here.
> 
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> > +	u8 update_planes;
> > +
> >  	/* HDMI scrambling status */
> >  	bool hdmi_scrambling;
> >  
> > -- 
> > 2.18.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Matt Roper Nov. 8, 2018, 11:22 p.m. UTC | #3
On Thu, Nov 01, 2018 at 05:06:00PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Keep track which planes need updating during the commit. For now this
> is just (was_visible || is_visible) but I'll have need to update

When gen11 nv12 is in use, it also contains was_slave || is_slave as
well, right?

> invisible planes later on for skl plane ddbs and for pre-skl pipe
> gamma/csc control (which lives in the primary plane control register).
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_atomic.c       | 1 +
>  drivers/gpu/drm/i915/intel_atomic_plane.c | 8 ++++----
>  drivers/gpu/drm/i915/intel_display.c      | 5 ++++-
>  drivers/gpu/drm/i915/intel_drv.h          | 3 +++
>  4 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> index a5a2c8fe58a7..8cb02f28d30c 100644
> --- a/drivers/gpu/drm/i915/intel_atomic.c
> +++ b/drivers/gpu/drm/i915/intel_atomic.c
> @@ -184,6 +184,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
>  	crtc_state->fifo_changed = false;
>  	crtc_state->wm.need_postvbl_update = false;
>  	crtc_state->fb_bits = 0;
> +	crtc_state->update_planes = 0;
>  
>  	return &crtc_state->base;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 7d3685075201..010269a12390 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -137,6 +137,9 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
>  	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
>  		crtc_state->nv12_planes |= BIT(intel_plane->id);
>  
> +	if (state->visible || old_plane_state->base.visible)
> +		crtc_state->update_planes |= BIT(intel_plane->id);
> +
>  	return intel_plane_atomic_calc_changes(old_crtc_state,
>  					       &crtc_state->base,
>  					       old_plane_state,
> @@ -171,14 +174,11 @@ void intel_update_planes_on_crtc(struct intel_atomic_state *old_state,
>  				 struct intel_crtc_state *old_crtc_state,
>  				 struct intel_crtc_state *new_crtc_state)
>  {
> +	u32 update_mask = new_crtc_state->update_planes;
>  	struct intel_plane_state *new_plane_state;
>  	struct intel_plane *plane;
> -	u32 update_mask;
>  	int i;
>  
> -	update_mask = old_crtc_state->active_planes;
> -	update_mask |= new_crtc_state->active_planes;
> -
>  	for_each_new_intel_plane_in_state(old_state, plane, new_plane_state, i) {
>  		if (crtc->pipe != plane->pipe ||
>  		    !(update_mask & BIT(plane->id)))
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 852b5897e80b..33d73915b73e 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10797,8 +10797,10 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
>  			continue;
>  
>  		plane_state->linked_plane = NULL;
> -		if (plane_state->slave && !plane_state->base.visible)
> +		if (plane_state->slave && !plane_state->base.visible) {
>  			crtc_state->active_planes &= ~BIT(plane->id);
> +			crtc_state->update_planes |= BIT(plane->id);

Just to clarify, this is to ensure that we clear out the register
programming of a plane that was an nv12 slave on the previous frame, but
isn't any longer on the current frame, and ...


> +		}
>  
>  		plane_state->slave = false;
>  	}
> @@ -10839,6 +10841,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
>  		linked_state->slave = true;
>  		linked_state->linked_plane = plane;
>  		crtc_state->active_planes |= BIT(linked->id);
> +		crtc_state->update_planes |= BIT(linked->id);

... this is to ensure we setup the programming for any new slave planes?


Matt

>  		DRM_DEBUG_KMS("Using %s as Y plane for %s\n", linked->base.name, plane->base.name);
>  	}
>  
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 5331bbed5e8c..7a55f5921d34 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -925,6 +925,9 @@ struct intel_crtc_state {
>  	u8 active_planes;
>  	u8 nv12_planes;
>  
> +	/* bitmask of planes that will be updated during the commit */
> +	u8 update_planes;
> +
>  	/* HDMI scrambling status */
>  	bool hdmi_scrambling;
>  
> -- 
> 2.18.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ville Syrjala Nov. 9, 2018, 1:57 p.m. UTC | #4
On Thu, Nov 08, 2018 at 03:22:27PM -0800, Matt Roper wrote:
> On Thu, Nov 01, 2018 at 05:06:00PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Keep track which planes need updating during the commit. For now this
> > is just (was_visible || is_visible) but I'll have need to update
> 
> When gen11 nv12 is in use, it also contains was_slave || is_slave as
> well, right?
> 
> > invisible planes later on for skl plane ddbs and for pre-skl pipe
> > gamma/csc control (which lives in the primary plane control register).
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_atomic.c       | 1 +
> >  drivers/gpu/drm/i915/intel_atomic_plane.c | 8 ++++----
> >  drivers/gpu/drm/i915/intel_display.c      | 5 ++++-
> >  drivers/gpu/drm/i915/intel_drv.h          | 3 +++
> >  4 files changed, 12 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
> > index a5a2c8fe58a7..8cb02f28d30c 100644
> > --- a/drivers/gpu/drm/i915/intel_atomic.c
> > +++ b/drivers/gpu/drm/i915/intel_atomic.c
> > @@ -184,6 +184,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
> >  	crtc_state->fifo_changed = false;
> >  	crtc_state->wm.need_postvbl_update = false;
> >  	crtc_state->fb_bits = 0;
> > +	crtc_state->update_planes = 0;
> >  
> >  	return &crtc_state->base;
> >  }
> > diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> > index 7d3685075201..010269a12390 100644
> > --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> > +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> > @@ -137,6 +137,9 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
> >  	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
> >  		crtc_state->nv12_planes |= BIT(intel_plane->id);
> >  
> > +	if (state->visible || old_plane_state->base.visible)
> > +		crtc_state->update_planes |= BIT(intel_plane->id);
> > +
> >  	return intel_plane_atomic_calc_changes(old_crtc_state,
> >  					       &crtc_state->base,
> >  					       old_plane_state,
> > @@ -171,14 +174,11 @@ void intel_update_planes_on_crtc(struct intel_atomic_state *old_state,
> >  				 struct intel_crtc_state *old_crtc_state,
> >  				 struct intel_crtc_state *new_crtc_state)
> >  {
> > +	u32 update_mask = new_crtc_state->update_planes;
> >  	struct intel_plane_state *new_plane_state;
> >  	struct intel_plane *plane;
> > -	u32 update_mask;
> >  	int i;
> >  
> > -	update_mask = old_crtc_state->active_planes;
> > -	update_mask |= new_crtc_state->active_planes;
> > -
> >  	for_each_new_intel_plane_in_state(old_state, plane, new_plane_state, i) {
> >  		if (crtc->pipe != plane->pipe ||
> >  		    !(update_mask & BIT(plane->id)))
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 852b5897e80b..33d73915b73e 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -10797,8 +10797,10 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
> >  			continue;
> >  
> >  		plane_state->linked_plane = NULL;
> > -		if (plane_state->slave && !plane_state->base.visible)
> > +		if (plane_state->slave && !plane_state->base.visible) {
> >  			crtc_state->active_planes &= ~BIT(plane->id);
> > +			crtc_state->update_planes |= BIT(plane->id);
> 
> Just to clarify, this is to ensure that we clear out the register
> programming of a plane that was an nv12 slave on the previous frame, but
> isn't any longer on the current frame, and ...
> 
> 
> > +		}
> >  
> >  		plane_state->slave = false;
> >  	}
> > @@ -10839,6 +10841,7 @@ static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
> >  		linked_state->slave = true;
> >  		linked_state->linked_plane = plane;
> >  		crtc_state->active_planes |= BIT(linked->id);
> > +		crtc_state->update_planes |= BIT(linked->id);
> 
> ... this is to ensure we setup the programming for any new slave planes?

Yes.

> 
> 
> Matt
> 
> >  		DRM_DEBUG_KMS("Using %s as Y plane for %s\n", linked->base.name, plane->base.name);
> >  	}
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 5331bbed5e8c..7a55f5921d34 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -925,6 +925,9 @@ struct intel_crtc_state {
> >  	u8 active_planes;
> >  	u8 nv12_planes;
> >  
> > +	/* bitmask of planes that will be updated during the commit */
> > +	u8 update_planes;
> > +
> >  	/* HDMI scrambling status */
> >  	bool hdmi_scrambling;
> >  
> > -- 
> > 2.18.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Matt Roper
> Graphics Software Engineer
> IoTG Platform Enabling & Development
> Intel Corporation
> (916) 356-2795
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c
index a5a2c8fe58a7..8cb02f28d30c 100644
--- a/drivers/gpu/drm/i915/intel_atomic.c
+++ b/drivers/gpu/drm/i915/intel_atomic.c
@@ -184,6 +184,7 @@  intel_crtc_duplicate_state(struct drm_crtc *crtc)
 	crtc_state->fifo_changed = false;
 	crtc_state->wm.need_postvbl_update = false;
 	crtc_state->fb_bits = 0;
+	crtc_state->update_planes = 0;
 
 	return &crtc_state->base;
 }
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 7d3685075201..010269a12390 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -137,6 +137,9 @@  int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
 	if (state->visible && state->fb->format->format == DRM_FORMAT_NV12)
 		crtc_state->nv12_planes |= BIT(intel_plane->id);
 
+	if (state->visible || old_plane_state->base.visible)
+		crtc_state->update_planes |= BIT(intel_plane->id);
+
 	return intel_plane_atomic_calc_changes(old_crtc_state,
 					       &crtc_state->base,
 					       old_plane_state,
@@ -171,14 +174,11 @@  void intel_update_planes_on_crtc(struct intel_atomic_state *old_state,
 				 struct intel_crtc_state *old_crtc_state,
 				 struct intel_crtc_state *new_crtc_state)
 {
+	u32 update_mask = new_crtc_state->update_planes;
 	struct intel_plane_state *new_plane_state;
 	struct intel_plane *plane;
-	u32 update_mask;
 	int i;
 
-	update_mask = old_crtc_state->active_planes;
-	update_mask |= new_crtc_state->active_planes;
-
 	for_each_new_intel_plane_in_state(old_state, plane, new_plane_state, i) {
 		if (crtc->pipe != plane->pipe ||
 		    !(update_mask & BIT(plane->id)))
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 852b5897e80b..33d73915b73e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10797,8 +10797,10 @@  static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
 			continue;
 
 		plane_state->linked_plane = NULL;
-		if (plane_state->slave && !plane_state->base.visible)
+		if (plane_state->slave && !plane_state->base.visible) {
 			crtc_state->active_planes &= ~BIT(plane->id);
+			crtc_state->update_planes |= BIT(plane->id);
+		}
 
 		plane_state->slave = false;
 	}
@@ -10839,6 +10841,7 @@  static int icl_check_nv12_planes(struct intel_crtc_state *crtc_state)
 		linked_state->slave = true;
 		linked_state->linked_plane = plane;
 		crtc_state->active_planes |= BIT(linked->id);
+		crtc_state->update_planes |= BIT(linked->id);
 		DRM_DEBUG_KMS("Using %s as Y plane for %s\n", linked->base.name, plane->base.name);
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5331bbed5e8c..7a55f5921d34 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -925,6 +925,9 @@  struct intel_crtc_state {
 	u8 active_planes;
 	u8 nv12_planes;
 
+	/* bitmask of planes that will be updated during the commit */
+	u8 update_planes;
+
 	/* HDMI scrambling status */
 	bool hdmi_scrambling;