dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Rob Clark <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/atomic: clear plane's CRTC and FB when shutting down
Date: Thu, 27 Nov 2014 10:43:47 +0100	[thread overview]
Message-ID: <20141127094347.GV32117@phenom.ffwll.local> (raw)
In-Reply-To: <1417046284-11740-1-git-send-email-robdclark@gmail.com>

On Wed, Nov 26, 2014 at 06:58:04PM -0500, Rob Clark wrote:
> Otherwise we'd still end up w/ the plane attached to the CRTC, and
> seemingly active, but without an FB.  Which ends up going *boom*
> in the drivers.
> 
> Slightly modified version of Daniel's irc suggestion.
> 
> CC: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Rob Clark <robdclark@gmail.com>

I think the problem here really is just that legacy state (plane->fb/crtc)
and atomic state get out of sync. Leaving planes around while the crtc
goes down is already possible with ->disable_plane and overlays, drivers
should be able to cope with that.

Merged into my atomic fixes pile, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index a348688..7d5e6c1 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1409,11 +1409,24 @@ retry:
>  		goto fail;
>  	}
>  
> +	primary_state = drm_atomic_get_plane_state(state, crtc->primary);
> +	if (IS_ERR(primary_state)) {
> +		ret = PTR_ERR(primary_state);
> +		goto fail;
> +	}
> +
>  	if (!set->mode) {
>  		WARN_ON(set->fb);
>  		WARN_ON(set->num_connectors);
>  
>  		crtc_state->enable = false;
> +
> +		ret = drm_atomic_set_crtc_for_plane(state, crtc->primary, NULL);
> +		if (ret != 0)
> +			goto fail;
> +
> +		drm_atomic_set_fb_for_plane(primary_state, NULL);
> +
>  		goto commit;
>  	}
>  
> @@ -1423,12 +1436,6 @@ retry:
>  	crtc_state->enable = true;
>  	drm_mode_copy(&crtc_state->mode, set->mode);
>  
> -	primary_state = drm_atomic_get_plane_state(state, crtc->primary);
> -	if (IS_ERR(primary_state)) {
> -		ret = PTR_ERR(primary_state);
> -		goto fail;
> -	}
> -
>  	ret = drm_atomic_set_crtc_for_plane(state, crtc->primary, crtc);
>  	if (ret != 0)
>  		goto fail;
> -- 
> 1.9.3
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2014-11-27  9:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26 23:58 [PATCH] drm/atomic: clear plane's CRTC and FB when shutting down Rob Clark
2014-11-27  9:43 ` Daniel Vetter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141127094347.GV32117@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robdclark@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox