All of lore.kernel.org
 help / color / mirror / Atom feed
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/19] drm/rcar-du: Convert to the new generic alpha property
Date: Tue, 09 Jan 2018 14:37:03 +0200	[thread overview]
Message-ID: <3654152.TXp4725KCx@avalon> (raw)
In-Reply-To: <f29de1e6964c393afaa21564d73425139a546672.1515494838.git-series.maxime.ripard@free-electrons.com>

Hi Maxime,

Thank you for the patch.

On Tuesday, 9 January 2018 12:56:27 EET Maxime Ripard wrote:
> Now that we have support for per-plane alpha in the core, let's use it.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

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

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  1 +-
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c   |  5 +---
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 15 +++------
>  drivers/gpu/drm/rcar-du/rcar_du_plane.h |  2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 42 ++------------------------
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.h   |  2 +-
>  6 files changed, 9 insertions(+), 58 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index f8cd79488ece..aff04adaae53
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -89,7 +89,6 @@ struct rcar_du_device {
>  	struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS];
> 
>  	struct {
> -		struct drm_property *alpha;
>  		struct drm_property *colorkey;
>  	} props;
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 566d1a948c8f..e1b5a7b460cc
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -417,11 +417,6 @@ static int rcar_du_encoders_init(struct rcar_du_device
> *rcdu)
> 
>  static int rcar_du_properties_init(struct rcar_du_device *rcdu)
>  {
> -	rcdu->props.alpha =
> -		drm_property_create_range(rcdu->ddev, 0, "alpha", 0, 255);
> -	if (rcdu->props.alpha == NULL)
> -		return -ENOMEM;
> -
>  	/*
>  	 * The color key is expressed as an RGB888 triplet stored in a 32-bit
>  	 * integer in XRGB8888 format. Bit 24 is used as a flag to disable (0)
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 61833cc1c699..5b34e8092c8b
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> @@ -423,7 +423,7 @@ static void rcar_du_plane_setup_mode(struct
> rcar_du_group *rgrp, rcar_du_plane_write(rgrp, index, PnALPHAR,
> PnALPHAR_ABIT_0);
>  	else
>  		rcar_du_plane_write(rgrp, index, PnALPHAR,
> -				    PnALPHAR_ABIT_X | state->alpha);
> +				    PnALPHAR_ABIT_X | state->state.alpha);
> 
>  	pnmr = PnMR_BM_MD | state->format->pnmr;
> 
> @@ -667,11 +667,11 @@ static void rcar_du_plane_reset(struct drm_plane
> *plane)
> 
>  	state->hwindex = -1;
>  	state->source = RCAR_DU_PLANE_MEMORY;
> -	state->alpha = 255;
>  	state->colorkey = RCAR_DU_COLORKEY_NONE;
>  	state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 
>  	plane->state = &state->state;
> +	plane->state->alpha = 255;
>  	plane->state->plane = plane;
>  }
> 
> @@ -683,9 +683,7 @@ static int rcar_du_plane_atomic_set_property(struct
> drm_plane *plane, struct rcar_du_plane_state *rstate =
> to_rcar_plane_state(state); struct rcar_du_device *rcdu =
> to_rcar_plane(plane)->group->dev;
> 
> -	if (property == rcdu->props.alpha)
> -		rstate->alpha = val;
> -	else if (property == rcdu->props.colorkey)
> +	if (property == rcdu->props.colorkey)
>  		rstate->colorkey = val;
>  	else
>  		return -EINVAL;
> @@ -701,9 +699,7 @@ static int rcar_du_plane_atomic_get_property(struct
> drm_plane *plane, container_of(state, const struct rcar_du_plane_state,
> state);
>  	struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
> 
> -	if (property == rcdu->props.alpha)
> -		*val = rstate->alpha;
> -	else if (property == rcdu->props.colorkey)
> +	if (property == rcdu->props.colorkey)
>  		*val = rstate->colorkey;
>  	else
>  		return -EINVAL;
> @@ -772,10 +768,9 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
>  			continue;
> 
>  		drm_object_attach_property(&plane->plane.base,
> -					   rcdu->props.alpha, 255);
> -		drm_object_attach_property(&plane->plane.base,
>  					   rcdu->props.colorkey,
>  					   RCAR_DU_COLORKEY_NONE);
> +		drm_plane_create_alpha_property(&plane->plane, 255);
>  		drm_plane_create_zpos_property(&plane->plane, 1, 1, 7);
>  	}
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index f62e09f195de..2dc793ebd1a2
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> @@ -50,7 +50,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct
> drm_plane *plane) * @state: base DRM plane state
>   * @format: information about the pixel format used by the plane
>   * @hwindex: 0-based hardware plane index, -1 means unused
> - * @alpha: value of the plane alpha property
>   * @colorkey: value of the plane colorkey property
>   */
>  struct rcar_du_plane_state {
> @@ -60,7 +59,6 @@ struct rcar_du_plane_state {
>  	int hwindex;
>  	enum rcar_du_plane_source source;
> 
> -	unsigned int alpha;
>  	unsigned int colorkey;
>  };
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 2c96147bc444..ee85f6fdffad
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -54,6 +54,7 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
>  	};
>  	struct rcar_du_plane_state state = {
>  		.state = {
> +			.alpha = 255,
>  			.crtc = &crtc->crtc,
>  			.crtc_x = 0,
>  			.crtc_y = 0,
> @@ -67,7 +68,6 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
>  		},
>  		.format = rcar_du_format_info(DRM_FORMAT_ARGB8888),
>  		.source = RCAR_DU_PLANE_VSPD1,
> -		.alpha = 255,
>  		.colorkey = 0,
>  	};
> 
> @@ -173,7 +173,7 @@ static void rcar_du_vsp_plane_setup(struct
> rcar_du_vsp_plane *plane) struct vsp1_du_atomic_config cfg = {
>  		.pixelformat = 0,
>  		.pitch = fb->pitches[0],
> -		.alpha = state->alpha,
> +		.alpha = state->state.alpha,
>  		.zpos = state->state.zpos,
>  	};
>  	unsigned int i;
> @@ -351,44 +351,13 @@ static void rcar_du_vsp_plane_reset(struct drm_plane
> *plane) if (state == NULL)
>  		return;
> 
> -	state->alpha = 255;
> +	state->state.alpha = 255;
>  	state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 
>  	plane->state = &state->state;
>  	plane->state->plane = plane;
>  }
> 
> -static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane,
> -	struct drm_plane_state *state, struct drm_property *property,
> -	uint64_t val)
> -{
> -	struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
> -	struct rcar_du_device *rcdu = to_rcar_vsp_plane(plane)->vsp->dev;
> -
> -	if (property == rcdu->props.alpha)
> -		rstate->alpha = val;
> -	else
> -		return -EINVAL;
> -
> -	return 0;
> -}
> -
> -static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane,
> -	const struct drm_plane_state *state, struct drm_property *property,
> -	uint64_t *val)
> -{
> -	const struct rcar_du_vsp_plane_state *rstate =
> -		container_of(state, const struct rcar_du_vsp_plane_state, state);
> -	struct rcar_du_device *rcdu = to_rcar_vsp_plane(plane)->vsp->dev;
> -
> -	if (property == rcdu->props.alpha)
> -		*val = rstate->alpha;
> -	else
> -		return -EINVAL;
> -
> -	return 0;
> -}
> -
>  static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = {
>  	.update_plane = drm_atomic_helper_update_plane,
>  	.disable_plane = drm_atomic_helper_disable_plane,
> @@ -396,8 +365,6 @@ static const struct drm_plane_funcs
> rcar_du_vsp_plane_funcs = { .destroy = drm_plane_cleanup,
>  	.atomic_duplicate_state = rcar_du_vsp_plane_atomic_duplicate_state,
>  	.atomic_destroy_state = rcar_du_vsp_plane_atomic_destroy_state,
> -	.atomic_set_property = rcar_du_vsp_plane_atomic_set_property,
> -	.atomic_get_property = rcar_du_vsp_plane_atomic_get_property,
>  };
> 
>  int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
> @@ -454,8 +421,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct
> device_node *np, if (type == DRM_PLANE_TYPE_PRIMARY)
>  			continue;
> 
> -		drm_object_attach_property(&plane->plane.base,
> -					   rcdu->props.alpha, 255);
> +		drm_plane_create_alpha_property(&plane->plane, 255);
>  		drm_plane_create_zpos_property(&plane->plane, 1, 1,
>  					       vsp->num_planes - 1);
>  	}
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h index f876c512163c..8b19914761e4
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> @@ -44,7 +44,6 @@ static inline struct rcar_du_vsp_plane
> *to_rcar_vsp_plane(struct drm_plane *p) * @state: base DRM plane state
>   * @format: information about the pixel format used by the plane
>   * @sg_tables: scatter-gather tables for the frame buffer memory
> - * @alpha: value of the plane alpha property
>   * @zpos: value of the plane zpos property
>   */
>  struct rcar_du_vsp_plane_state {
> @@ -53,7 +52,6 @@ struct rcar_du_vsp_plane_state {
>  	const struct rcar_du_format_info *format;
>  	struct sg_table sg_tables[3];
> 
> -	unsigned int alpha;
>  	unsigned int zpos;
>  };

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	linux-kernel@vger.kernel.org, Chen-Yu Tsai <wens@csie.org>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl
Subject: Re: [PATCH 08/19] drm/rcar-du: Convert to the new generic alpha property
Date: Tue, 09 Jan 2018 14:37:03 +0200	[thread overview]
Message-ID: <3654152.TXp4725KCx@avalon> (raw)
In-Reply-To: <f29de1e6964c393afaa21564d73425139a546672.1515494838.git-series.maxime.ripard@free-electrons.com>

Hi Maxime,

Thank you for the patch.

On Tuesday, 9 January 2018 12:56:27 EET Maxime Ripard wrote:
> Now that we have support for per-plane alpha in the core, let's use it.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

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

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  1 +-
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c   |  5 +---
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 15 +++------
>  drivers/gpu/drm/rcar-du/rcar_du_plane.h |  2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 42 ++------------------------
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.h   |  2 +-
>  6 files changed, 9 insertions(+), 58 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index f8cd79488ece..aff04adaae53
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -89,7 +89,6 @@ struct rcar_du_device {
>  	struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS];
> 
>  	struct {
> -		struct drm_property *alpha;
>  		struct drm_property *colorkey;
>  	} props;
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 566d1a948c8f..e1b5a7b460cc
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -417,11 +417,6 @@ static int rcar_du_encoders_init(struct rcar_du_device
> *rcdu)
> 
>  static int rcar_du_properties_init(struct rcar_du_device *rcdu)
>  {
> -	rcdu->props.alpha =
> -		drm_property_create_range(rcdu->ddev, 0, "alpha", 0, 255);
> -	if (rcdu->props.alpha == NULL)
> -		return -ENOMEM;
> -
>  	/*
>  	 * The color key is expressed as an RGB888 triplet stored in a 32-bit
>  	 * integer in XRGB8888 format. Bit 24 is used as a flag to disable (0)
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 61833cc1c699..5b34e8092c8b
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> @@ -423,7 +423,7 @@ static void rcar_du_plane_setup_mode(struct
> rcar_du_group *rgrp, rcar_du_plane_write(rgrp, index, PnALPHAR,
> PnALPHAR_ABIT_0);
>  	else
>  		rcar_du_plane_write(rgrp, index, PnALPHAR,
> -				    PnALPHAR_ABIT_X | state->alpha);
> +				    PnALPHAR_ABIT_X | state->state.alpha);
> 
>  	pnmr = PnMR_BM_MD | state->format->pnmr;
> 
> @@ -667,11 +667,11 @@ static void rcar_du_plane_reset(struct drm_plane
> *plane)
> 
>  	state->hwindex = -1;
>  	state->source = RCAR_DU_PLANE_MEMORY;
> -	state->alpha = 255;
>  	state->colorkey = RCAR_DU_COLORKEY_NONE;
>  	state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 
>  	plane->state = &state->state;
> +	plane->state->alpha = 255;
>  	plane->state->plane = plane;
>  }
> 
> @@ -683,9 +683,7 @@ static int rcar_du_plane_atomic_set_property(struct
> drm_plane *plane, struct rcar_du_plane_state *rstate =
> to_rcar_plane_state(state); struct rcar_du_device *rcdu =
> to_rcar_plane(plane)->group->dev;
> 
> -	if (property == rcdu->props.alpha)
> -		rstate->alpha = val;
> -	else if (property == rcdu->props.colorkey)
> +	if (property == rcdu->props.colorkey)
>  		rstate->colorkey = val;
>  	else
>  		return -EINVAL;
> @@ -701,9 +699,7 @@ static int rcar_du_plane_atomic_get_property(struct
> drm_plane *plane, container_of(state, const struct rcar_du_plane_state,
> state);
>  	struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
> 
> -	if (property == rcdu->props.alpha)
> -		*val = rstate->alpha;
> -	else if (property == rcdu->props.colorkey)
> +	if (property == rcdu->props.colorkey)
>  		*val = rstate->colorkey;
>  	else
>  		return -EINVAL;
> @@ -772,10 +768,9 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
>  			continue;
> 
>  		drm_object_attach_property(&plane->plane.base,
> -					   rcdu->props.alpha, 255);
> -		drm_object_attach_property(&plane->plane.base,
>  					   rcdu->props.colorkey,
>  					   RCAR_DU_COLORKEY_NONE);
> +		drm_plane_create_alpha_property(&plane->plane, 255);
>  		drm_plane_create_zpos_property(&plane->plane, 1, 1, 7);
>  	}
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index f62e09f195de..2dc793ebd1a2
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> @@ -50,7 +50,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct
> drm_plane *plane) * @state: base DRM plane state
>   * @format: information about the pixel format used by the plane
>   * @hwindex: 0-based hardware plane index, -1 means unused
> - * @alpha: value of the plane alpha property
>   * @colorkey: value of the plane colorkey property
>   */
>  struct rcar_du_plane_state {
> @@ -60,7 +59,6 @@ struct rcar_du_plane_state {
>  	int hwindex;
>  	enum rcar_du_plane_source source;
> 
> -	unsigned int alpha;
>  	unsigned int colorkey;
>  };
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 2c96147bc444..ee85f6fdffad
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -54,6 +54,7 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
>  	};
>  	struct rcar_du_plane_state state = {
>  		.state = {
> +			.alpha = 255,
>  			.crtc = &crtc->crtc,
>  			.crtc_x = 0,
>  			.crtc_y = 0,
> @@ -67,7 +68,6 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
>  		},
>  		.format = rcar_du_format_info(DRM_FORMAT_ARGB8888),
>  		.source = RCAR_DU_PLANE_VSPD1,
> -		.alpha = 255,
>  		.colorkey = 0,
>  	};
> 
> @@ -173,7 +173,7 @@ static void rcar_du_vsp_plane_setup(struct
> rcar_du_vsp_plane *plane) struct vsp1_du_atomic_config cfg = {
>  		.pixelformat = 0,
>  		.pitch = fb->pitches[0],
> -		.alpha = state->alpha,
> +		.alpha = state->state.alpha,
>  		.zpos = state->state.zpos,
>  	};
>  	unsigned int i;
> @@ -351,44 +351,13 @@ static void rcar_du_vsp_plane_reset(struct drm_plane
> *plane) if (state == NULL)
>  		return;
> 
> -	state->alpha = 255;
> +	state->state.alpha = 255;
>  	state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 
>  	plane->state = &state->state;
>  	plane->state->plane = plane;
>  }
> 
> -static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane,
> -	struct drm_plane_state *state, struct drm_property *property,
> -	uint64_t val)
> -{
> -	struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
> -	struct rcar_du_device *rcdu = to_rcar_vsp_plane(plane)->vsp->dev;
> -
> -	if (property == rcdu->props.alpha)
> -		rstate->alpha = val;
> -	else
> -		return -EINVAL;
> -
> -	return 0;
> -}
> -
> -static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane,
> -	const struct drm_plane_state *state, struct drm_property *property,
> -	uint64_t *val)
> -{
> -	const struct rcar_du_vsp_plane_state *rstate =
> -		container_of(state, const struct rcar_du_vsp_plane_state, state);
> -	struct rcar_du_device *rcdu = to_rcar_vsp_plane(plane)->vsp->dev;
> -
> -	if (property == rcdu->props.alpha)
> -		*val = rstate->alpha;
> -	else
> -		return -EINVAL;
> -
> -	return 0;
> -}
> -
>  static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = {
>  	.update_plane = drm_atomic_helper_update_plane,
>  	.disable_plane = drm_atomic_helper_disable_plane,
> @@ -396,8 +365,6 @@ static const struct drm_plane_funcs
> rcar_du_vsp_plane_funcs = { .destroy = drm_plane_cleanup,
>  	.atomic_duplicate_state = rcar_du_vsp_plane_atomic_duplicate_state,
>  	.atomic_destroy_state = rcar_du_vsp_plane_atomic_destroy_state,
> -	.atomic_set_property = rcar_du_vsp_plane_atomic_set_property,
> -	.atomic_get_property = rcar_du_vsp_plane_atomic_get_property,
>  };
> 
>  int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
> @@ -454,8 +421,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct
> device_node *np, if (type == DRM_PLANE_TYPE_PRIMARY)
>  			continue;
> 
> -		drm_object_attach_property(&plane->plane.base,
> -					   rcdu->props.alpha, 255);
> +		drm_plane_create_alpha_property(&plane->plane, 255);
>  		drm_plane_create_zpos_property(&plane->plane, 1, 1,
>  					       vsp->num_planes - 1);
>  	}
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h index f876c512163c..8b19914761e4
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> @@ -44,7 +44,6 @@ static inline struct rcar_du_vsp_plane
> *to_rcar_vsp_plane(struct drm_plane *p) * @state: base DRM plane state
>   * @format: information about the pixel format used by the plane
>   * @sg_tables: scatter-gather tables for the frame buffer memory
> - * @alpha: value of the plane alpha property
>   * @zpos: value of the plane zpos property
>   */
>  struct rcar_du_vsp_plane_state {
> @@ -53,7 +52,6 @@ struct rcar_du_vsp_plane_state {
>  	const struct rcar_du_format_info *format;
>  	struct sg_table sg_tables[3];
> 
> -	unsigned int alpha;
>  	unsigned int zpos;
>  };

-- 
Regards,

Laurent Pinchart

_______________________________________________
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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: dri-devel@lists.freedesktop.org
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, thomas@vitsch.nl
Subject: Re: [PATCH 08/19] drm/rcar-du: Convert to the new generic alpha property
Date: Tue, 09 Jan 2018 14:37:03 +0200	[thread overview]
Message-ID: <3654152.TXp4725KCx@avalon> (raw)
In-Reply-To: <f29de1e6964c393afaa21564d73425139a546672.1515494838.git-series.maxime.ripard@free-electrons.com>

Hi Maxime,

Thank you for the patch.

On Tuesday, 9 January 2018 12:56:27 EET Maxime Ripard wrote:
> Now that we have support for per-plane alpha in the core, let's use it.
> 
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

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

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  1 +-
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c   |  5 +---
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 15 +++------
>  drivers/gpu/drm/rcar-du/rcar_du_plane.h |  2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 42 ++------------------------
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.h   |  2 +-
>  6 files changed, 9 insertions(+), 58 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h index f8cd79488ece..aff04adaae53
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -89,7 +89,6 @@ struct rcar_du_device {
>  	struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS];
> 
>  	struct {
> -		struct drm_property *alpha;
>  		struct drm_property *colorkey;
>  	} props;
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c index 566d1a948c8f..e1b5a7b460cc
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -417,11 +417,6 @@ static int rcar_du_encoders_init(struct rcar_du_device
> *rcdu)
> 
>  static int rcar_du_properties_init(struct rcar_du_device *rcdu)
>  {
> -	rcdu->props.alpha =
> -		drm_property_create_range(rcdu->ddev, 0, "alpha", 0, 255);
> -	if (rcdu->props.alpha == NULL)
> -		return -ENOMEM;
> -
>  	/*
>  	 * The color key is expressed as an RGB888 triplet stored in a 32-bit
>  	 * integer in XRGB8888 format. Bit 24 is used as a flag to disable (0)
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> b/drivers/gpu/drm/rcar-du/rcar_du_plane.c index 61833cc1c699..5b34e8092c8b
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
> @@ -423,7 +423,7 @@ static void rcar_du_plane_setup_mode(struct
> rcar_du_group *rgrp, rcar_du_plane_write(rgrp, index, PnALPHAR,
> PnALPHAR_ABIT_0);
>  	else
>  		rcar_du_plane_write(rgrp, index, PnALPHAR,
> -				    PnALPHAR_ABIT_X | state->alpha);
> +				    PnALPHAR_ABIT_X | state->state.alpha);
> 
>  	pnmr = PnMR_BM_MD | state->format->pnmr;
> 
> @@ -667,11 +667,11 @@ static void rcar_du_plane_reset(struct drm_plane
> *plane)
> 
>  	state->hwindex = -1;
>  	state->source = RCAR_DU_PLANE_MEMORY;
> -	state->alpha = 255;
>  	state->colorkey = RCAR_DU_COLORKEY_NONE;
>  	state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 
>  	plane->state = &state->state;
> +	plane->state->alpha = 255;
>  	plane->state->plane = plane;
>  }
> 
> @@ -683,9 +683,7 @@ static int rcar_du_plane_atomic_set_property(struct
> drm_plane *plane, struct rcar_du_plane_state *rstate =
> to_rcar_plane_state(state); struct rcar_du_device *rcdu =
> to_rcar_plane(plane)->group->dev;
> 
> -	if (property == rcdu->props.alpha)
> -		rstate->alpha = val;
> -	else if (property == rcdu->props.colorkey)
> +	if (property == rcdu->props.colorkey)
>  		rstate->colorkey = val;
>  	else
>  		return -EINVAL;
> @@ -701,9 +699,7 @@ static int rcar_du_plane_atomic_get_property(struct
> drm_plane *plane, container_of(state, const struct rcar_du_plane_state,
> state);
>  	struct rcar_du_device *rcdu = to_rcar_plane(plane)->group->dev;
> 
> -	if (property == rcdu->props.alpha)
> -		*val = rstate->alpha;
> -	else if (property == rcdu->props.colorkey)
> +	if (property == rcdu->props.colorkey)
>  		*val = rstate->colorkey;
>  	else
>  		return -EINVAL;
> @@ -772,10 +768,9 @@ int rcar_du_planes_init(struct rcar_du_group *rgrp)
>  			continue;
> 
>  		drm_object_attach_property(&plane->plane.base,
> -					   rcdu->props.alpha, 255);
> -		drm_object_attach_property(&plane->plane.base,
>  					   rcdu->props.colorkey,
>  					   RCAR_DU_COLORKEY_NONE);
> +		drm_plane_create_alpha_property(&plane->plane, 255);
>  		drm_plane_create_zpos_property(&plane->plane, 1, 1, 7);
>  	}
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> b/drivers/gpu/drm/rcar-du/rcar_du_plane.h index f62e09f195de..2dc793ebd1a2
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.h
> @@ -50,7 +50,6 @@ static inline struct rcar_du_plane *to_rcar_plane(struct
> drm_plane *plane) * @state: base DRM plane state
>   * @format: information about the pixel format used by the plane
>   * @hwindex: 0-based hardware plane index, -1 means unused
> - * @alpha: value of the plane alpha property
>   * @colorkey: value of the plane colorkey property
>   */
>  struct rcar_du_plane_state {
> @@ -60,7 +59,6 @@ struct rcar_du_plane_state {
>  	int hwindex;
>  	enum rcar_du_plane_source source;
> 
> -	unsigned int alpha;
>  	unsigned int colorkey;
>  };
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c index 2c96147bc444..ee85f6fdffad
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -54,6 +54,7 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
>  	};
>  	struct rcar_du_plane_state state = {
>  		.state = {
> +			.alpha = 255,
>  			.crtc = &crtc->crtc,
>  			.crtc_x = 0,
>  			.crtc_y = 0,
> @@ -67,7 +68,6 @@ void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
>  		},
>  		.format = rcar_du_format_info(DRM_FORMAT_ARGB8888),
>  		.source = RCAR_DU_PLANE_VSPD1,
> -		.alpha = 255,
>  		.colorkey = 0,
>  	};
> 
> @@ -173,7 +173,7 @@ static void rcar_du_vsp_plane_setup(struct
> rcar_du_vsp_plane *plane) struct vsp1_du_atomic_config cfg = {
>  		.pixelformat = 0,
>  		.pitch = fb->pitches[0],
> -		.alpha = state->alpha,
> +		.alpha = state->state.alpha,
>  		.zpos = state->state.zpos,
>  	};
>  	unsigned int i;
> @@ -351,44 +351,13 @@ static void rcar_du_vsp_plane_reset(struct drm_plane
> *plane) if (state == NULL)
>  		return;
> 
> -	state->alpha = 255;
> +	state->state.alpha = 255;
>  	state->state.zpos = plane->type == DRM_PLANE_TYPE_PRIMARY ? 0 : 1;
> 
>  	plane->state = &state->state;
>  	plane->state->plane = plane;
>  }
> 
> -static int rcar_du_vsp_plane_atomic_set_property(struct drm_plane *plane,
> -	struct drm_plane_state *state, struct drm_property *property,
> -	uint64_t val)
> -{
> -	struct rcar_du_vsp_plane_state *rstate = to_rcar_vsp_plane_state(state);
> -	struct rcar_du_device *rcdu = to_rcar_vsp_plane(plane)->vsp->dev;
> -
> -	if (property == rcdu->props.alpha)
> -		rstate->alpha = val;
> -	else
> -		return -EINVAL;
> -
> -	return 0;
> -}
> -
> -static int rcar_du_vsp_plane_atomic_get_property(struct drm_plane *plane,
> -	const struct drm_plane_state *state, struct drm_property *property,
> -	uint64_t *val)
> -{
> -	const struct rcar_du_vsp_plane_state *rstate =
> -		container_of(state, const struct rcar_du_vsp_plane_state, state);
> -	struct rcar_du_device *rcdu = to_rcar_vsp_plane(plane)->vsp->dev;
> -
> -	if (property == rcdu->props.alpha)
> -		*val = rstate->alpha;
> -	else
> -		return -EINVAL;
> -
> -	return 0;
> -}
> -
>  static const struct drm_plane_funcs rcar_du_vsp_plane_funcs = {
>  	.update_plane = drm_atomic_helper_update_plane,
>  	.disable_plane = drm_atomic_helper_disable_plane,
> @@ -396,8 +365,6 @@ static const struct drm_plane_funcs
> rcar_du_vsp_plane_funcs = { .destroy = drm_plane_cleanup,
>  	.atomic_duplicate_state = rcar_du_vsp_plane_atomic_duplicate_state,
>  	.atomic_destroy_state = rcar_du_vsp_plane_atomic_destroy_state,
> -	.atomic_set_property = rcar_du_vsp_plane_atomic_set_property,
> -	.atomic_get_property = rcar_du_vsp_plane_atomic_get_property,
>  };
> 
>  int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
> @@ -454,8 +421,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct
> device_node *np, if (type == DRM_PLANE_TYPE_PRIMARY)
>  			continue;
> 
> -		drm_object_attach_property(&plane->plane.base,
> -					   rcdu->props.alpha, 255);
> +		drm_plane_create_alpha_property(&plane->plane, 255);
>  		drm_plane_create_zpos_property(&plane->plane, 1, 1,
>  					       vsp->num_planes - 1);
>  	}
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h index f876c512163c..8b19914761e4
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.h
> @@ -44,7 +44,6 @@ static inline struct rcar_du_vsp_plane
> *to_rcar_vsp_plane(struct drm_plane *p) * @state: base DRM plane state
>   * @format: information about the pixel format used by the plane
>   * @sg_tables: scatter-gather tables for the frame buffer memory
> - * @alpha: value of the plane alpha property
>   * @zpos: value of the plane zpos property
>   */
>  struct rcar_du_vsp_plane_state {
> @@ -53,7 +52,6 @@ struct rcar_du_vsp_plane_state {
>  	const struct rcar_du_format_info *format;
>  	struct sg_table sg_tables[3];
> 
> -	unsigned int alpha;
>  	unsigned int zpos;
>  };

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2018-01-09 12:37 UTC|newest]

Thread overview: 125+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 10:56 [PATCH 00/19] drm/sun4i: Support more planes, zpos and plane-wide alpha Maxime Ripard
2018-01-09 10:56 ` Maxime Ripard
2018-01-09 10:56 ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 01/19] drm/fourcc: Add a function to tell if the format embeds alpha Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 12:26   ` Boris Brezillon
2018-01-09 12:26     ` Boris Brezillon
2018-01-09 12:29   ` Laurent Pinchart
2018-01-09 12:29     ` Laurent Pinchart
2018-01-09 12:29     ` Laurent Pinchart
2018-01-09 13:28     ` Maxime Ripard
2018-01-09 13:28       ` Maxime Ripard
2018-01-09 13:28       ` Maxime Ripard
2018-01-15 15:47       ` Ayan Halder
2018-01-15 15:47         ` Ayan Halder
2018-01-15 15:47         ` Ayan Halder
2018-01-16 20:17         ` Maxime Ripard
2018-01-17 17:55           ` Ayan Halder
2018-01-16 10:37       ` Ayan Halder
2018-01-16 10:37         ` Ayan Halder
2018-01-09 10:56 ` [PATCH 02/19] drm/atmel-hlcdc: Use the alpha format helper Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 12:27   ` Boris Brezillon
2018-01-09 12:27     ` Boris Brezillon
2018-01-09 12:27     ` Boris Brezillon
2018-01-09 10:56 ` [PATCH 03/19] drm/exynos: " Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-12  1:20   ` Inki Dae
2018-01-12  1:20     ` Inki Dae
2018-01-09 10:56 ` [PATCH 04/19] drm/rockchip: " Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-16  0:42   ` Sandy Huang
2018-01-16  0:42     ` Sandy Huang
2018-01-16  0:42     ` Sandy Huang
2018-01-09 10:56 ` [PATCH 05/19] drm/vc4: " Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 12:34   ` Daniel Vetter
2018-01-09 12:34     ` Daniel Vetter
2018-01-09 12:34     ` Daniel Vetter
2018-01-09 17:34   ` Eric Anholt
2018-01-09 17:34     ` Eric Anholt
2018-01-09 17:34     ` Eric Anholt
2018-01-09 10:56 ` [PATCH 06/19] drm/blend: Add a generic alpha property Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 12:31   ` Boris Brezillon
2018-01-09 12:31     ` Boris Brezillon
2018-01-09 12:31     ` Boris Brezillon
2018-01-09 12:32   ` Daniel Vetter
2018-01-09 12:32     ` Daniel Vetter
2018-01-09 12:32     ` Daniel Vetter
2018-01-09 13:53     ` Maxime Ripard
2018-01-09 13:53       ` Maxime Ripard
2018-01-09 13:53       ` Maxime Ripard
2018-01-09 14:28       ` Daniel Vetter
2018-01-09 14:28         ` Daniel Vetter
2018-01-09 14:28         ` Daniel Vetter
2018-01-11 15:58         ` Maxime Ripard
2018-01-11 15:58           ` Maxime Ripard
2018-01-11 15:58           ` Maxime Ripard
2018-01-11 16:36           ` Daniel Vetter
2018-01-11 16:36             ` Daniel Vetter
2018-01-11 16:36             ` Daniel Vetter
2018-01-11 18:34             ` Laurent Pinchart
2018-01-11 18:34               ` Laurent Pinchart
2018-01-11 18:34               ` Laurent Pinchart
2018-01-17  9:20               ` Maxime Ripard
2018-01-17  9:20                 ` Maxime Ripard
2018-01-17  9:20                 ` Maxime Ripard
2018-01-17  9:30                 ` Daniel Vetter
2018-01-17  9:30                   ` Daniel Vetter
2018-01-17  9:30                   ` Daniel Vetter
2018-01-09 12:34   ` Laurent Pinchart
2018-01-09 12:34     ` Laurent Pinchart
2018-01-09 13:59     ` Maxime Ripard
2018-01-09 13:59       ` Maxime Ripard
2018-01-09 13:59       ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 07/19] drm/atmel-hclcdc: Convert to the new " Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 12:31   ` Boris Brezillon
2018-01-09 12:31     ` Boris Brezillon
2018-01-09 12:31     ` Boris Brezillon
2018-01-09 10:56 ` [PATCH 08/19] drm/rcar-du: " Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 12:37   ` Laurent Pinchart [this message]
2018-01-09 12:37     ` Laurent Pinchart
2018-01-09 12:37     ` Laurent Pinchart
2018-01-09 10:56 ` [PATCH 09/19] drm/sun4i: backend: Fix structure indentation Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 10/19] drm/sun4i: backend: Fix define typo Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 11/19] drm/sun4i: framebuffer: Add a custom atomic_check Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 12/19] drm/sun4i: backend: Move the coord function in the shared part Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 13/19] drm/sun4i: backend: Set a default zpos in our reset hook Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 14/19] drm/sun4i: backend: Add support for zpos Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 15/19] drm/sun4i: backend: Check for the number of alpha planes Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 16/19] drm/sun4i: backend: Assign the pipes automatically Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 17/19] drm/sun4i: backend: Make zpos configurable Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 18/19] drm/sun4i: Add support for plane alpha Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56 ` [PATCH 19/19] drm/sun4i: backend: Remove ARGB spoofing Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard
2018-01-09 10:56   ` Maxime Ripard

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=3654152.TXp4725KCx@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 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.