linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 01/10] drm/atomic: Add __drm_atomic_helper_plane_reset
Date: Thu, 26 Jul 2018 23:20:52 +0300	[thread overview]
Message-ID: <2271754.L0ZicdVV5V@avalon> (raw)
In-Reply-To: <20180726161756.1794-2-alexandru-cosmin.gheorghe@arm.com>

Hi Alexandru,

Thank you for the patch.

On Thursday, 26 July 2018 19:17:47 EEST Alexandru Gheorghe wrote:
> There are a lot of drivers that subclass drm_plane_state, all of them
> duplicate the code that links toghether the plane with plane_state.

s/toghether/together/

> On top of that, drivers that enable core properties also have to
> duplicate the code for initializing the properties to their default
> values, which in all cases are the same as the defaults from core.
> 
> Change since v1:
> - Make it consistent with the other helpers and require that both
>   plane and state not be NULL, suggested by Boris Brezillon and
>   Philipp Zabel.
> 
> Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 31 ++++++++++++++++++++---------
>  include/drm/drm_atomic_helper.h     |  2 ++
>  2 files changed, 24 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c index 866a2cc72ef6..7f5aafc5b1a0
> 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3552,6 +3552,26 @@ void drm_atomic_helper_crtc_destroy_state(struct
> drm_crtc *crtc, }
>  EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
> 
> +/**
> + * __drm_atomic_helper_plane_reset - resets planes state to default values
> + * @plane: plane object, must not be NULL
> + * @state: atomic plane state, must not be NULL
> + *
> + * Initializes plane state to default. This is useful for drivers that
> subclass
> + * the plane state.
> + */
> +void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> +				     struct drm_plane_state *state)
> +{
> +	state->plane = plane;
> +	state->rotation = DRM_MODE_ROTATE_0;

Nitpicking, I'd keep the blank line here to make the code a bit easier to read

> +	/* Reset the alpha value to fully opaque if it matters */
> +	if (plane->alpha_property)
> +		state->alpha = plane->alpha_property->values[1];

And here too.

Apart from that,

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

> +	plane->state = state;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_plane_reset);
> +
>  /**
>   * drm_atomic_helper_plane_reset - default &drm_plane_funcs.reset hook for
> planes * @plane: drm plane
> @@ -3566,15 +3586,8 @@ void drm_atomic_helper_plane_reset(struct drm_plane
> *plane)
> 
>  	kfree(plane->state);
>  	plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
> -
> -	if (plane->state) {
> -		plane->state->plane = plane;
> -		plane->state->rotation = DRM_MODE_ROTATE_0;
> -
> -		/* Reset the alpha value to fully opaque if it matters */
> -		if (plane->alpha_property)
> -			plane->state->alpha = plane->alpha_property->values[1];
> -	}
> +	if (plane->state)
> +		__drm_atomic_helper_plane_reset(plane, plane->state);
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> 
> diff --git a/include/drm/drm_atomic_helper.h
> b/include/drm/drm_atomic_helper.h index 99e2a5297c69..f4c7ed876c97 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -156,6 +156,8 @@ void __drm_atomic_helper_crtc_destroy_state(struct
> drm_crtc_state *state); void drm_atomic_helper_crtc_destroy_state(struct
> drm_crtc *crtc,
>  					  struct drm_crtc_state *state);
> 
> +void __drm_atomic_helper_plane_reset(struct drm_plane *plane,
> +				     struct drm_plane_state *state);
>  void drm_atomic_helper_plane_reset(struct drm_plane *plane);
>  void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,
>  					       struct drm_plane_state *state);

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2018-07-26 20:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-26 16:17 [PATCH v2 00/10] Add helper for plane reset Alexandru Gheorghe
2018-07-26 16:17 ` [PATCH v2 01/10] drm/atomic: Add __drm_atomic_helper_plane_reset Alexandru Gheorghe
2018-07-26 20:20   ` Laurent Pinchart [this message]
2018-07-26 16:17 ` [PATCH v2 02/10] drm/amd/display: Use __drm_atomic_helper_plane_reset instead of copying the logic Alexandru Gheorghe
2018-07-26 16:17 ` [PATCH v2 03/10] drm: mali-dp: " Alexandru Gheorghe
2018-07-26 16:17 ` [PATCH v2 04/10] drm: atmel-hlcdc: " Alexandru Gheorghe
2018-07-26 16:17 ` [PATCH v2 05/10] drm/exynos: " Alexandru Gheorghe
2018-07-26 16:17 ` [PATCH v2 06/10] drm/imx: " Alexandru Gheorghe
2018-07-26 16:17 ` [PATCH v2 07/10] drm: rcar-du: " Alexandru Gheorghe
2018-07-26 20:17   ` Laurent Pinchart
2018-07-26 16:17 ` [PATCH v2 08/10] drm/sun4i: " Alexandru Gheorghe
2018-07-27 12:54   ` Maxime Ripard
2018-07-26 16:17 ` [PATCH v2 09/10] drm/vc4: " Alexandru Gheorghe
2018-07-26 16:17 ` [PATCH v2 10/10] drm/vmwgfx: " Alexandru Gheorghe

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=2271754.L0ZicdVV5V@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.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).