diff mbox

drm/imx: always call wait_for_flip_done in commit_tail

Message ID 20171130133146.23683-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Stach Nov. 30, 2017, 1:31 p.m. UTC
drm_atomic_helper_wait_for_vblanks will go away in the future.

The new drm_atomic_helper_setup_commit in 4.15 expects that blocking commits
have completed flipping before the commit_tail returns. This must be ensured
by calling wait_for_vblanks or wait_for_flip_done, where flip_done might do
a less agressive wait, which is fine for imx-drm.

Fixes: 080de2e5be2d (drm/atomic: Check for busy planes/connectors before
                     setting the commit)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Lucas Stach Nov. 30, 2017, 2:05 p.m. UTC | #1
Seems, Daniel lost the CC in the reply. Adding again.

Am Donnerstag, den 30.11.2017, 14:51 +0100 schrieb Daniel Vetter:
> On Thu, Nov 30, 2017 at 02:31:46PM +0100, Lucas Stach wrote:
> > drm_atomic_helper_wait_for_vblanks will go away in the future.
> > 
> > The new drm_atomic_helper_setup_commit in 4.15 expects that blocking commits
> > have completed flipping before the commit_tail returns. This must be ensured
> > by calling wait_for_vblanks or wait_for_flip_done, where flip_done might do
> > a less agressive wait, which is fine for imx-drm.
> > 
> > Fixes: 080de2e5be2d (drm/atomic: Check for busy planes/connectors before
> >                      setting the commit)
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Anyone volunteering for all the other drivers? Or at least a todo entry?

Yeah, I'll look into converting the other drivers. But needs to wait
until next week.

Regards,
Lucas

> -Daniel
> 
> > ---
> >  drivers/gpu/drm/imx/imx-drm-core.c | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> > index 179f9aeefd98..db6afaa3f25f 100644
> > --- a/drivers/gpu/drm/imx/imx-drm-core.c
> > +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> > @@ -134,9 +134,16 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
> > > >  			plane_disabling = true;
> > > >  	}
> >  
> > > > -	if (plane_disabling) {
> > > > -		drm_atomic_helper_wait_for_vblanks(dev, state);
> > > > +	/*
> > > > +	 * The flip done wait is only strictly required by imx-drm if a deferred
> > > > +	 * plane disable is in-flight. As the core requires blocking commits
> > > > +	 * to wait for the flip it is done here unconditionally. This keeps the
> > > > +	 * workitem around a bit longer than required for the majority of
> > > > +	 * non-blocking commits, but we accept that for the sake of simplicity.
> > > > +	 */
> > > > +	drm_atomic_helper_wait_for_flip_done(dev, state);
> >  
> > > > +	if (plane_disabling) {
> > > >  		for_each_old_plane_in_state(state, plane, old_plane_state, i)
> > > >  			ipu_plane_disable_deferred(plane);
> >  
> > -- 
> > 2.11.0
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
>
Daniel Vetter Dec. 1, 2017, 7:22 a.m. UTC | #2
On Thu, Nov 30, 2017 at 03:05:40PM +0100, Lucas Stach wrote:
> Seems, Daniel lost the CC in the reply. Adding again.
> 
> Am Donnerstag, den 30.11.2017, 14:51 +0100 schrieb Daniel Vetter:
> > On Thu, Nov 30, 2017 at 02:31:46PM +0100, Lucas Stach wrote:
> > > drm_atomic_helper_wait_for_vblanks will go away in the future.
> > > 
> > > The new drm_atomic_helper_setup_commit in 4.15 expects that blocking commits
> > > have completed flipping before the commit_tail returns. This must be ensured
> > > by calling wait_for_vblanks or wait_for_flip_done, where flip_done might do
> > > a less agressive wait, which is fine for imx-drm.
> > > 
> > > Fixes: 080de2e5be2d (drm/atomic: Check for busy planes/connectors before
> > >                      setting the commit)
> > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > 
> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > Anyone volunteering for all the other drivers? Or at least a todo entry?
> 
> Yeah, I'll look into converting the other drivers. But needs to wait
> until next week.

Awesome, thanks a lot.
-Daniel

> 
> Regards,
> Lucas
> 
> > -Daniel
> > 
> > > ---
> > >  drivers/gpu/drm/imx/imx-drm-core.c | 11 +++++++++--
> > >  1 file changed, 9 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> > > index 179f9aeefd98..db6afaa3f25f 100644
> > > --- a/drivers/gpu/drm/imx/imx-drm-core.c
> > > +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> > > @@ -134,9 +134,16 @@ static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
> > > > >  			plane_disabling = true;
> > > > >  	}
> > >  
> > > > > -	if (plane_disabling) {
> > > > > -		drm_atomic_helper_wait_for_vblanks(dev, state);
> > > > > +	/*
> > > > > +	 * The flip done wait is only strictly required by imx-drm if a deferred
> > > > > +	 * plane disable is in-flight. As the core requires blocking commits
> > > > > +	 * to wait for the flip it is done here unconditionally. This keeps the
> > > > > +	 * workitem around a bit longer than required for the majority of
> > > > > +	 * non-blocking commits, but we accept that for the sake of simplicity.
> > > > > +	 */
> > > > > +	drm_atomic_helper_wait_for_flip_done(dev, state);
> > >  
> > > > > +	if (plane_disabling) {
> > > > >  		for_each_old_plane_in_state(state, plane, old_plane_state, i)
> > > > >  			ipu_plane_disable_deferred(plane);
> > >  
> > > -- 
> > > 2.11.0
> > > 
> > > _______________________________________________
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> > 
> >
diff mbox

Patch

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 179f9aeefd98..db6afaa3f25f 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -134,9 +134,16 @@  static void imx_drm_atomic_commit_tail(struct drm_atomic_state *state)
 			plane_disabling = true;
 	}
 
-	if (plane_disabling) {
-		drm_atomic_helper_wait_for_vblanks(dev, state);
+	/*
+	 * The flip done wait is only strictly required by imx-drm if a deferred
+	 * plane disable is in-flight. As the core requires blocking commits
+	 * to wait for the flip it is done here unconditionally. This keeps the
+	 * workitem around a bit longer than required for the majority of
+	 * non-blocking commits, but we accept that for the sake of simplicity.
+	 */
+	drm_atomic_helper_wait_for_flip_done(dev, state);
 
+	if (plane_disabling) {
 		for_each_old_plane_in_state(state, plane, old_plane_state, i)
 			ipu_plane_disable_deferred(plane);