dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/atomic: Use explicit old/new state in drm_atomic_crtc_check()
Date: Mon, 5 Nov 2018 10:29:11 +0100	[thread overview]
Message-ID: <20181105092911.GG21967@phenom.ffwll.local> (raw)
In-Reply-To: <20181101184646.14753-2-ville.syrjala@linux.intel.com>

On Thu, Nov 01, 2018 at 08:46:45PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Convert drm_atomic_crtc_check() over to using explicit old vs. new
> crtc states. Avoids the confusion of "what does crtc->state mean
> again?".

Yeah much better.

> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/drm_atomic.c | 26 +++++++++++++++-----------
>  1 file changed, 15 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 064c48075917..dde696181efe 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -315,9 +315,11 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
>  }
>  EXPORT_SYMBOL(drm_atomic_get_crtc_state);
>  
> -static int drm_atomic_crtc_check(struct drm_crtc *crtc,
> -		struct drm_crtc_state *state)
> +static int drm_atomic_crtc_check(const struct drm_crtc_state *old_crtc_state,
> +				 const struct drm_crtc_state *new_crtc_state)
>  {
> +	struct drm_crtc *crtc = new_crtc_state->crtc;
> +
>  	/* NOTE: we explicitly don't enforce constraints such as primary
>  	 * layer covering entire screen, since that is something we want
>  	 * to allow (on hw that supports it).  For hw that does not, it
> @@ -326,7 +328,7 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
>  	 * TODO: Add generic modeset state checks once we support those.
>  	 */
>  
> -	if (state->active && !state->enable) {
> +	if (new_crtc_state->active && !new_crtc_state->enable) {
>  		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active without enabled\n",
>  				 crtc->base.id, crtc->name);
>  		return -EINVAL;
> @@ -336,14 +338,14 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
>  	 * as this is a kernel-internal detail that userspace should never
>  	 * be able to trigger. */
>  	if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
> -	    WARN_ON(state->enable && !state->mode_blob)) {
> +	    WARN_ON(new_crtc_state->enable && !new_crtc_state->mode_blob)) {
>  		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled without mode blob\n",
>  				 crtc->base.id, crtc->name);
>  		return -EINVAL;
>  	}
>  
>  	if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
> -	    WARN_ON(!state->enable && state->mode_blob)) {
> +	    WARN_ON(!new_crtc_state->enable && new_crtc_state->mode_blob)) {
>  		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled with mode blob\n",
>  				 crtc->base.id, crtc->name);
>  		return -EINVAL;
> @@ -359,7 +361,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
>  	 * and legacy page_flip IOCTL which also reject service on a disabled
>  	 * pipe.
>  	 */
> -	if (state->event && !state->active && !crtc->state->active) {
> +	if (new_crtc_state->event &&
> +	    !new_crtc_state->active && !old_crtc_state->active) {
>  		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requesting event but off\n",
>  				 crtc->base.id, crtc->name);
>  		return -EINVAL;
> @@ -965,7 +968,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
>  	struct drm_plane *plane;
>  	struct drm_plane_state *plane_state;
>  	struct drm_crtc *crtc;
> -	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc_state *old_crtc_state;
> +	struct drm_crtc_state *new_crtc_state;
>  	struct drm_connector *conn;
>  	struct drm_connector_state *conn_state;
>  	int i, ret = 0;
> @@ -981,8 +985,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
>  		}
>  	}
>  
> -	for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
> -		ret = drm_atomic_crtc_check(crtc, crtc_state);
> +	for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
> +		ret = drm_atomic_crtc_check(old_crtc_state, new_crtc_state);
>  		if (ret) {
>  			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n",
>  					 crtc->base.id, crtc->name);
> @@ -1010,8 +1014,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
>  	}
>  
>  	if (!state->allow_modeset) {
> -		for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
> -			if (drm_atomic_crtc_needs_modeset(crtc_state)) {
> +		for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
> +			if (drm_atomic_crtc_needs_modeset(new_crtc_state)) {
>  				DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requires full modeset\n",
>  						 crtc->base.id, crtc->name);
>  				return -EINVAL;
> -- 
> 2.18.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-11-05  9:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 18:46 [PATCH 1/3] drm/atomic: Use explicit old crtc state in drm_atomic_add_affected_planes() Ville Syrjala
2018-11-01 18:46 ` [PATCH 2/3] drm/atomic: Use explicit old/new state in drm_atomic_crtc_check() Ville Syrjala
2018-11-05  9:29   ` Daniel Vetter [this message]
2018-11-01 18:46 ` [PATCH 3/3] drm/atomic: Use explicit old/new state in drm_atomic_plane_check() Ville Syrjala
2018-11-05  9:33   ` Daniel Vetter
2018-11-05 14:37     ` [Intel-gfx] " Ville Syrjälä
2018-11-06 19:16   ` [PATCH v2 " Ville Syrjala
2018-11-05  9:26 ` [PATCH 1/3] drm/atomic: Use explicit old crtc state in drm_atomic_add_affected_planes() Daniel Vetter
2018-11-05 14:04   ` Ville Syrjälä
2018-11-05 14:30     ` Wentland, Harry
2018-11-05 14:39       ` Ville Syrjälä

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=20181105092911.GG21967@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.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