dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v4 2/5] drm/atomic: Make drm_atomic_plane_disabling easier to understand.
Date: Wed, 01 Mar 2017 02:53:49 +0200	[thread overview]
Message-ID: <3325156.LUftCxXOWX@avalon> (raw)
In-Reply-To: <1487256430-7625-3-git-send-email-maarten.lankhorst@linux.intel.com>

Hi Maarten,

Thank you for the patch.

On Thursday 16 Feb 2017 15:47:07 Maarten Lankhorst wrote:
> This function becomes a lot simpler when having passed both the old and
> new state to it. Looking at all callers, it seems that old_plane_state
> is never NULL so the check can be dropped.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/drm_atomic_helper.c |  7 ++++---
>  drivers/gpu/drm/drm_plane_helper.c  |  2 +-
>  include/drm/drm_atomic_helper.h     | 26 ++++++++------------------
>  3 files changed, 13 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c index 7d432d9a18cf..ea544bddc29b
> 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1757,7 +1757,8 @@ void drm_atomic_helper_commit_planes(struct drm_device
> *dev, if (!funcs)
>  			continue;
> 
> -		disabling = drm_atomic_plane_disabling(plane, 
old_plane_state);
> +		disabling = drm_atomic_plane_disabling(old_plane_state,
> +						       new_plane_state);
> 
>  		if (active_only) {
>  			/*
> @@ -1852,11 +1853,11 @@ drm_atomic_helper_commit_planes_on_crtc(struct
> drm_crtc_state *old_crtc_state)
> 
>  		WARN_ON(plane->state->crtc && plane->state->crtc != crtc);
> 
> -		if (drm_atomic_plane_disabling(plane, old_plane_state) &&
> +		if (drm_atomic_plane_disabling(old_plane_state, plane->state) 
&&
>  		    plane_funcs->atomic_disable)
>  			plane_funcs->atomic_disable(plane, old_plane_state);
>  		else if (plane->state->crtc ||
> -			 drm_atomic_plane_disabling(plane, old_plane_state))
> +			 drm_atomic_plane_disabling(old_plane_state, plane-
>state))
>  			plane_funcs->atomic_update(plane, old_plane_state);
>  	}
> 
> diff --git a/drivers/gpu/drm/drm_plane_helper.c
> b/drivers/gpu/drm/drm_plane_helper.c index 148688fb920a..f4d70dd5e3e4
> 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -470,7 +470,7 @@ int drm_plane_helper_commit(struct drm_plane *plane,
>  	 * Drivers may optionally implement the ->atomic_disable callback, so
>  	 * special-case that here.
>  	 */
> -	if (drm_atomic_plane_disabling(plane, plane_state) &&
> +	if (drm_atomic_plane_disabling(plane_state, plane->state) &&
>  	    plane_funcs->atomic_disable)
>  		plane_funcs->atomic_disable(plane, plane_state);
>  	else
> diff --git a/include/drm/drm_atomic_helper.h
> b/include/drm/drm_atomic_helper.h index 9ceda379ce58..dc16274987c7 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -220,10 +220,10 @@ int drm_atomic_helper_legacy_gamma_set(struct drm_crtc
> *crtc, __drm_atomic_get_current_plane_state((crtc_state)->state, \ plane)))
> 
> -/*
> +/**
>   * drm_atomic_plane_disabling - check whether a plane is being disabled
> - * @plane: plane object
> - * @old_state: previous atomic state
> + * @old_plane_state: old atomic plane state
> + * @new_plane_state: new atomic plane state
>   *
>   * Checks the atomic state of a plane to determine whether it's being
> disabled * or not. This also WARNs if it detects an invalid state (both
> CRTC and FB @@ -233,28 +233,18 @@ int
> drm_atomic_helper_legacy_gamma_set(struct drm_crtc *crtc, * True if the
> plane is being disabled, false otherwise.
>   */
>  static inline bool
> -drm_atomic_plane_disabling(struct drm_plane *plane,
> -			   struct drm_plane_state *old_state)
> +drm_atomic_plane_disabling(struct drm_plane_state *old_plane_state,
> +			   struct drm_plane_state *new_plane_state)
>  {
>  	/*
>  	 * When disabling a plane, CRTC and FB should always be NULL together.
>  	 * Anything else should be considered a bug in the atomic core, so we
>  	 * gently warn about it.
>  	 */
> -	WARN_ON((plane->state->crtc == NULL && plane->state->fb != NULL) ||
> -		(plane->state->crtc != NULL && plane->state->fb == NULL));
> +	WARN_ON((new_plane_state->crtc == NULL && new_plane_state->fb != NULL) 
||
> +		(new_plane_state->crtc != NULL && new_plane_state->fb == 
NULL));
> 
> -	/*
> -	 * When using the transitional helpers, old_state may be NULL. If so,
> -	 * we know nothing about the current state and have to assume that it
> -	 * might be enabled.
> -	 *
> -	 * When using the atomic helpers, old_state won't be NULL. Therefore
> -	 * this check assumes that either the driver will have reconstructed
> -	 * the correct state in ->reset() or that the driver will have taken
> -	 * appropriate measures to disable all planes.
> -	 */
> -	return (!old_state || old_state->crtc) && !plane->state->crtc;
> +	return old_plane_state->crtc && !new_plane_state->crtc;
>  }
> 
>  #endif /* DRM_ATOMIC_HELPER_H_ */

-- 
Regards,

Laurent Pinchart

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-03-01  0:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-16 14:47 [PATCH v4 0/5] drm/atomic: Add accessor macros for all atomic state Maarten Lankhorst
2017-02-16 14:47 ` [PATCH v4 1/5] drm/atomic: Fix atomic helpers to use the new iterator macros, v2 Maarten Lankhorst
2017-03-01  0:49   ` Laurent Pinchart
2017-03-01  9:09     ` Maarten Lankhorst
2017-03-01  9:21     ` [PATCH v4.1 1/5] drm/atomic: Fix atomic helpers to use the new iterator macros, v3 Maarten Lankhorst
2017-03-01 10:06       ` Laurent Pinchart
2017-02-16 14:47 ` [PATCH v4 2/5] drm/atomic: Make drm_atomic_plane_disabling easier to understand Maarten Lankhorst
2017-03-01  0:53   ` Laurent Pinchart [this message]
2017-02-16 14:47 ` [PATCH v4 3/5] drm/atomic: Add macros to access existing old/new state, v2 Maarten Lankhorst
2017-03-01  0:56   ` Laurent Pinchart
2017-02-16 14:47 ` [PATCH v4 4/5] drm/atomic: Convert get_existing_state callers to get_old/new_state, v3 Maarten Lankhorst
2017-03-01  1:04   ` Laurent Pinchart
2017-03-01  9:22     ` [PATCH v4.1 4/5] drm/atomic: Convert get_existing_state callers to get_old/new_state, v4 Maarten Lankhorst
2017-02-16 14:47 ` [PATCH v4 5/5] drm/blend: Use new atomic iterator macros Maarten Lankhorst
2017-03-01  0:58   ` Laurent Pinchart

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=3325156.LUftCxXOWX@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).