All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ayan Halder <ayan.halder@arm.com>
To: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Cc: alexandre.belloni@bootlin.com, airlied@linux.ie,
	liviu.dudau@arm.com, dri-devel@lists.freedesktop.org,
	laurent.pinchart@ideasonboard.com, thellstrom@vmware.com,
	krzk@kernel.org, maxime.ripard@bootlin.com, wens@csie.org,
	kgene@kernel.org, malidp@foss.arm.com,
	linux-graphics-maintainer@vmware.com, sunpeng.li@amd.com,
	boris.brezillon@bootlin.com, linux-samsung-soc@vger.kernel.org,
	nd@arm.com, Tony.Cheng@amd.com,
	linux-arm-kernel@lists.infradead.org, sw0312.kim@samsung.com,
	nicolas.ferre@microchip.com, shirish.s@amd.com,
	kyungmin.park@samsung.com, alexander.deucher@amd.com,
	christian.koenig@amd.com
Subject: Re: [PATCH 01/10] drm/atomic: Add  __drm_atomic_helper_plane_reset
Date: Mon, 23 Jul 2018 10:37:57 +0100	[thread overview]
Message-ID: <20180723093757.GB26447@arm.com> (raw)
In-Reply-To: <20180720211509.23605-2-alexandru-cosmin.gheorghe@arm.com>

On Fri, Jul 20, 2018 at 10:15:00PM +0100, 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.
> 
> 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.
> 
> Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 32 +++++++++++++++++++++--------
>  include/drm/drm_atomic_helper.h     |  2 ++
>  2 files changed, 25 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 8008a7de2e10..e1c6f101652e 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3507,6 +3507,28 @@ 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
> + * @new_state: atomic plane state
> + *
> + * 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)
> +{
> +	if (state) {
> +		state->plane = plane;
> +		state->rotation = DRM_MODE_ROTATE_0;
> +		/* Reset the alpha value to fully opaque if it matters */
> +		if (plane->alpha_property)
> +			state->alpha = plane->alpha_property->values[1];
> +	}
> +	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
> @@ -3521,15 +3543,7 @@ 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];
> -	}
> +	__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 26aaba58d6ce..2dd40c761dfd 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -155,6 +155,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);
> -- 
> 2.18.0
> 
With my limited knowledge on DRM, this looks OK to me:-
Reviewed-by :- Ayan Kumar halder <ayan.halder@arm.com>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: ayan.halder@arm.com (Ayan Halder)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/10] drm/atomic: Add  __drm_atomic_helper_plane_reset
Date: Mon, 23 Jul 2018 10:37:57 +0100	[thread overview]
Message-ID: <20180723093757.GB26447@arm.com> (raw)
In-Reply-To: <20180720211509.23605-2-alexandru-cosmin.gheorghe@arm.com>

On Fri, Jul 20, 2018 at 10:15:00PM +0100, 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.
> 
> 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.
> 
> Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 32 +++++++++++++++++++++--------
>  include/drm/drm_atomic_helper.h     |  2 ++
>  2 files changed, 25 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 8008a7de2e10..e1c6f101652e 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3507,6 +3507,28 @@ 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
> + * @new_state: atomic plane state
> + *
> + * 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)
> +{
> +	if (state) {
> +		state->plane = plane;
> +		state->rotation = DRM_MODE_ROTATE_0;
> +		/* Reset the alpha value to fully opaque if it matters */
> +		if (plane->alpha_property)
> +			state->alpha = plane->alpha_property->values[1];
> +	}
> +	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
> @@ -3521,15 +3543,7 @@ 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];
> -	}
> +	__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 26aaba58d6ce..2dd40c761dfd 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -155,6 +155,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);
> -- 
> 2.18.0
> 
With my limited knowledge on DRM, this looks OK to me:-
Reviewed-by :- Ayan Kumar halder <ayan.halder@arm.com>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-07-23  9:37 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 15:10 [PATCH v2 1/3] drm: writeback: Fix doc that says connector should be disconnected Alexandru Gheorghe
2018-07-13 15:10 ` [PATCH v2 2/3] drm: mali-dp: Report writeback connector as connected Alexandru Gheorghe
2018-07-13 15:37   ` Sean Paul
2018-07-16 11:19   ` Liviu Dudau
2018-07-13 15:11 ` [PATCH v2 3/3] drm: mali-dp: Set encoder possible_clones Alexandru Gheorghe
2018-07-13 15:40   ` Sean Paul
2018-07-13 15:47     ` Sean Paul
2018-07-13 15:55       ` Alexandru-Cosmin Gheorghe
2018-07-13 16:14         ` Sean Paul
2018-07-16  9:56           ` [PATCH v3] " Alexandru Gheorghe
2018-07-16 11:15             ` Liviu Dudau
2018-07-20 21:14           ` [PATCH 00/10] Add helper for plane reset Alexandru Gheorghe
2018-07-20 21:14             ` Alexandru Gheorghe
2018-07-20 21:15             ` [PATCH 01/10] drm/atomic: Add __drm_atomic_helper_plane_reset Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-23  9:37               ` Ayan Halder [this message]
2018-07-23  9:37                 ` Ayan Halder
2018-07-24  7:48               ` Philipp Zabel
2018-07-24  7:48                 ` Philipp Zabel
2018-07-24  8:14                 ` Alexandru-Cosmin Gheorghe
2018-07-24  8:14                   ` Alexandru-Cosmin Gheorghe
2018-07-24  8:16                   ` Boris Brezillon
2018-07-24  8:16                     ` Boris Brezillon
2018-07-24  9:28                     ` Alexandru-Cosmin Gheorghe
2018-07-24  9:28                       ` Alexandru-Cosmin Gheorghe
2018-07-20 21:15             ` [PATCH 02/10] drm/amd/display: Use __drm_atomic_helper_plane_reset instead of copying the logic Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-20 21:15             ` [PATCH 03/10] drm: mali-dp: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-23  9:35               ` Ayan Halder
2018-07-23  9:35                 ` Ayan Halder
2018-07-24  8:26               ` Liviu Dudau
2018-07-24  8:26                 ` Liviu Dudau
2018-07-20 21:15             ` [PATCH 04/10] drm: atmel-hlcdc: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-21  6:12               ` Boris Brezillon
2018-07-21  6:12                 ` Boris Brezillon
2018-07-20 21:15             ` [PATCH 05/10] drm/exynos: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-20 21:15             ` [PATCH 06/10] drm/imx: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-24  7:49               ` Philipp Zabel
2018-07-24  7:49                 ` Philipp Zabel
2018-07-24  7:51                 ` Philipp Zabel
2018-07-24  7:51                   ` Philipp Zabel
2018-07-20 21:15             ` [PATCH 07/10] drm: rcar-du: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-20 21:15             ` [PATCH 08/10] drm/sun4i: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-20 21:15             ` [PATCH 09/10] drm/vc4: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-24  6:57               ` Maxime Ripard
2018-07-24  6:57                 ` Maxime Ripard
2018-07-24  8:11                 ` Alexandru-Cosmin Gheorghe
2018-07-24  8:11                   ` Alexandru-Cosmin Gheorghe
2018-07-24 12:54                   ` Maxime Ripard
2018-07-24 12:54                     ` Maxime Ripard
2018-07-20 21:15             ` [PATCH 10/10] drm/vmwgfx: " Alexandru Gheorghe
2018-07-20 21:15               ` Alexandru Gheorghe
2018-07-23 17:16               ` Deepak Singh Rawat
2018-07-23 17:16                 ` Deepak Singh Rawat
2018-07-23 18:02               ` Sinclair Yeh
2018-07-23 18:02                 ` Sinclair Yeh
2018-07-24 15:31             ` [PATCH 00/10] Add helper for plane reset Harry Wentland
2018-07-24 15:31               ` Harry Wentland
2018-07-13 15:37 ` [PATCH v2 1/3] drm: writeback: Fix doc that says connector should be disconnected Sean Paul
2018-07-16 11:18 ` Liviu Dudau

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=20180723093757.GB26447@arm.com \
    --to=ayan.halder@arm.com \
    --cc=Tony.Cheng@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandru-cosmin.gheorghe@arm.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=malidp@foss.arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=nd@arm.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=shirish.s@amd.com \
    --cc=sunpeng.li@amd.com \
    --cc=sw0312.kim@samsung.com \
    --cc=thellstrom@vmware.com \
    --cc=wens@csie.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.