public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Ryan Walklin <ryan@testtoast.com>
Cc: Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Chris Morgan <macroalpha82@gmail.com>,
	John Watts <contact@jookia.org>,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH 01/23] drm: sun4i: de2/de3: Change CSC argument
Date: Tue, 25 Jun 2024 01:27:43 +0100	[thread overview]
Message-ID: <20240625012743.058e9ece@minigeek.lan> (raw)
In-Reply-To: <20240620113150.83466-2-ryan@testtoast.com>

On Thu, 20 Jun 2024 23:29:39 +1200
Ryan Walklin <ryan@testtoast.com> wrote:

Hi,

> From: Jernej Skrabec <jernej.skrabec@gmail.com>
> 
> Currently, CSC module takes care only for converting YUV to RGB.
> However, DE3 is more suited to work in YUV color space. Change CSC mode
> argument to format type to be more neutral. New argument only tells
> layer format type and doesn't imply output type.
> 
> This commit doesn't make any functional change.

I can confirm that this is indeed just renaming, preparing for the
intention change (from conversion mode to input type). 

> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> Signed-off-by: Ryan Walklin <ryan@testtoast.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

cheers,
Andre

> ---
>  drivers/gpu/drm/sun4i/sun8i_csc.c      | 22 +++++++++++-----------
>  drivers/gpu/drm/sun4i/sun8i_csc.h      | 10 +++++-----
>  drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 16 ++++++++--------
>  3 files changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.c b/drivers/gpu/drm/sun4i/sun8i_csc.c
> index 58480d8e4f704..6ebd1c3aa3ab5 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_csc.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_csc.c
> @@ -108,7 +108,7 @@ static const u32 yuv2rgb_de3[2][3][12] = {
>  };
>  
>  static void sun8i_csc_set_coefficients(struct regmap *map, u32 base,
> -				       enum sun8i_csc_mode mode,
> +				       enum format_type fmt_type,
>  				       enum drm_color_encoding encoding,
>  				       enum drm_color_range range)
>  {
> @@ -118,12 +118,12 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base,
>  
>  	table = yuv2rgb[range][encoding];
>  
> -	switch (mode) {
> -	case SUN8I_CSC_MODE_YUV2RGB:
> +	switch (fmt_type) {
> +	case FORMAT_TYPE_YUV:
>  		base_reg = SUN8I_CSC_COEFF(base, 0);
>  		regmap_bulk_write(map, base_reg, table, 12);
>  		break;
> -	case SUN8I_CSC_MODE_YVU2RGB:
> +	case FORMAT_TYPE_YVU:
>  		for (i = 0; i < 12; i++) {
>  			if ((i & 3) == 1)
>  				base_reg = SUN8I_CSC_COEFF(base, i + 1);
> @@ -141,7 +141,7 @@ static void sun8i_csc_set_coefficients(struct regmap *map, u32 base,
>  }
>  
>  static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer,
> -					    enum sun8i_csc_mode mode,
> +					    enum format_type fmt_type,
>  					    enum drm_color_encoding encoding,
>  					    enum drm_color_range range)
>  {
> @@ -151,12 +151,12 @@ static void sun8i_de3_ccsc_set_coefficients(struct regmap *map, int layer,
>  
>  	table = yuv2rgb_de3[range][encoding];
>  
> -	switch (mode) {
> -	case SUN8I_CSC_MODE_YUV2RGB:
> +	switch (fmt_type) {
> +	case FORMAT_TYPE_YUV:
>  		addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE, layer, 0);
>  		regmap_bulk_write(map, addr, table, 12);
>  		break;
> -	case SUN8I_CSC_MODE_YVU2RGB:
> +	case FORMAT_TYPE_YVU:
>  		for (i = 0; i < 12; i++) {
>  			if ((i & 3) == 1)
>  				addr = SUN50I_MIXER_BLEND_CSC_COEFF(DE3_BLD_BASE,
> @@ -206,7 +206,7 @@ static void sun8i_de3_ccsc_enable(struct regmap *map, int layer, bool enable)
>  }
>  
>  void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,
> -				     enum sun8i_csc_mode mode,
> +				     enum format_type fmt_type,
>  				     enum drm_color_encoding encoding,
>  				     enum drm_color_range range)
>  {
> @@ -214,14 +214,14 @@ void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,
>  
>  	if (mixer->cfg->is_de3) {
>  		sun8i_de3_ccsc_set_coefficients(mixer->engine.regs, layer,
> -						mode, encoding, range);
> +						fmt_type, encoding, range);
>  		return;
>  	}
>  
>  	base = ccsc_base[mixer->cfg->ccsc][layer];
>  
>  	sun8i_csc_set_coefficients(mixer->engine.regs, base,
> -				   mode, encoding, range);
> +				   fmt_type, encoding, range);
>  }
>  
>  void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable)
> diff --git a/drivers/gpu/drm/sun4i/sun8i_csc.h b/drivers/gpu/drm/sun4i/sun8i_csc.h
> index 828b86fd0cabb..7322770f39f03 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_csc.h
> +++ b/drivers/gpu/drm/sun4i/sun8i_csc.h
> @@ -22,14 +22,14 @@ struct sun8i_mixer;
>  
>  #define SUN8I_CSC_CTRL_EN		BIT(0)
>  
> -enum sun8i_csc_mode {
> -	SUN8I_CSC_MODE_OFF,
> -	SUN8I_CSC_MODE_YUV2RGB,
> -	SUN8I_CSC_MODE_YVU2RGB,
> +enum format_type {
> +	FORMAT_TYPE_RGB,
> +	FORMAT_TYPE_YUV,
> +	FORMAT_TYPE_YVU,
>  };
>  
>  void sun8i_csc_set_ccsc_coefficients(struct sun8i_mixer *mixer, int layer,
> -				     enum sun8i_csc_mode mode,
> +				     enum format_type fmt_type,
>  				     enum drm_color_encoding encoding,
>  				     enum drm_color_range range);
>  void sun8i_csc_enable_ccsc(struct sun8i_mixer *mixer, int layer, bool enable);
> diff --git a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> index f9c0a56d3a148..76e2d3ec0a78c 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_vi_layer.c
> @@ -242,19 +242,19 @@ static int sun8i_vi_layer_update_coord(struct sun8i_mixer *mixer, int channel,
>  	return 0;
>  }
>  
> -static u32 sun8i_vi_layer_get_csc_mode(const struct drm_format_info *format)
> +static u32 sun8i_vi_layer_get_format_type(const struct drm_format_info *format)
>  {
>  	if (!format->is_yuv)
> -		return SUN8I_CSC_MODE_OFF;
> +		return FORMAT_TYPE_RGB;
>  
>  	switch (format->format) {
>  	case DRM_FORMAT_YVU411:
>  	case DRM_FORMAT_YVU420:
>  	case DRM_FORMAT_YVU422:
>  	case DRM_FORMAT_YVU444:
> -		return SUN8I_CSC_MODE_YVU2RGB;
> +		return FORMAT_TYPE_YVU;
>  	default:
> -		return SUN8I_CSC_MODE_YUV2RGB;
> +		return FORMAT_TYPE_YUV;
>  	}
>  }
>  
> @@ -262,7 +262,7 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel,
>  					 int overlay, struct drm_plane *plane)
>  {
>  	struct drm_plane_state *state = plane->state;
> -	u32 val, ch_base, csc_mode, hw_fmt;
> +	u32 val, ch_base, fmt_type, hw_fmt;
>  	const struct drm_format_info *fmt;
>  	int ret;
>  
> @@ -280,9 +280,9 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel,
>  			   SUN8I_MIXER_CHAN_VI_LAYER_ATTR(ch_base, overlay),
>  			   SUN8I_MIXER_CHAN_VI_LAYER_ATTR_FBFMT_MASK, val);
>  
> -	csc_mode = sun8i_vi_layer_get_csc_mode(fmt);
> -	if (csc_mode != SUN8I_CSC_MODE_OFF) {
> -		sun8i_csc_set_ccsc_coefficients(mixer, channel, csc_mode,
> +	fmt_type = sun8i_vi_layer_get_format_type(fmt);
> +	if (fmt_type != FORMAT_TYPE_RGB) {
> +		sun8i_csc_set_ccsc_coefficients(mixer, channel, fmt_type,
>  						state->color_encoding,
>  						state->color_range);
>  		sun8i_csc_enable_ccsc(mixer, channel, true);


  reply	other threads:[~2024-06-25  0:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 11:29 [PATCH 00/23] drm: sun4i: add Display Engine 3.3 (DE33) support Ryan Walklin
2024-06-20 11:29 ` [PATCH 01/23] drm: sun4i: de2/de3: Change CSC argument Ryan Walklin
2024-06-25  0:27   ` Andre Przywara [this message]
2024-06-20 11:29 ` [PATCH 02/23] drm: sun4i: de2/de3: Merge CSC functions into one Ryan Walklin
2024-06-20 11:29 ` [PATCH 03/23] drm: sun4i: de2/de3: call csc setup also for UI layer Ryan Walklin
2024-06-20 11:29 ` [PATCH 04/23] drm: sun4i: de2: Initialize layer fields earlier Ryan Walklin
2024-06-20 11:29 ` [PATCH 05/23] drm: sun4i: de3: Add YUV formatter module Ryan Walklin
2024-06-20 11:29 ` [PATCH 06/23] drm: sun4i: de3: add format enumeration function to engine Ryan Walklin
2024-06-20 11:29 ` [PATCH 07/23] drm: sun4i: de3: add formatter flag to mixer config Ryan Walklin
2024-06-20 11:29 ` [PATCH 08/23] drm: sun4i: de3: add YUV support to the DE3 mixer Ryan Walklin
2024-06-20 11:29 ` [PATCH 09/23] drm: sun4i: de3: pass engine reference to ccsc setup function Ryan Walklin
2024-06-20 11:29 ` [PATCH 10/23] drm: sun4i: de3: add YUV support to the color space correction module Ryan Walklin
2024-06-20 11:29 ` [PATCH 11/23] drm: sun4i: de3: add YUV support to the TCON Ryan Walklin
2024-06-20 11:29 ` [PATCH 12/23] drm: sun4i: support YUV formats in VI scaler Ryan Walklin
2024-06-20 11:29 ` [PATCH 13/23] drm: sun4i: de2/de3: add mixer version enum Ryan Walklin
2024-06-25  0:27   ` Andre Przywara
2024-06-20 11:29 ` [PATCH 14/23] drm: sun4i: de2/de3: refactor mixer initialisation Ryan Walklin
2024-06-25  0:28   ` Andre Przywara
2024-06-25  1:23     ` Ryan Walklin
2024-06-20 11:29 ` [PATCH 15/23] drm: sun4i: vi_scaler refactor vi_scaler enablement Ryan Walklin
2024-06-20 11:29 ` [PATCH 16/23] drm: sun4i: de2/de3: make blender register references generic Ryan Walklin
2024-06-20 11:29 ` [PATCH 17/23] drm: sun4i: de3: Implement AFBC support Ryan Walklin
2024-06-20 11:29 ` [PATCH 18/23] dt-bindings: allwinner: add H616 DE33 bus, clock and display bindings Ryan Walklin
2024-06-20 12:25   ` Rob Herring (Arm)
2024-06-25  0:37   ` Andre Przywara
2024-06-25  1:24     ` Ryan Walklin
2024-06-20 11:29 ` [PATCH 19/23] clk: sunxi-ng: ccu: add Display Engine 3.3 (DE33) support Ryan Walklin
2024-06-20 11:29 ` [PATCH 20/23] drm: sun4i: de33: mixer: " Ryan Walklin
2024-06-20 11:29 ` [PATCH 21/23] drm: sun4i: de33: vi_scaler: " Ryan Walklin
2024-06-20 11:30 ` [PATCH 22/23] drm: sun4i: de33: fmt: " Ryan Walklin
2024-06-20 11:30 ` [PATCH 23/23] drm: sun4i: de33: csc: " Ryan Walklin

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=20240625012743.058e9ece@minigeek.lan \
    --to=andre.przywara@arm.com \
    --cc=airlied@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=contact@jookia.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=macroalpha82@gmail.com \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh@kernel.org \
    --cc=ryan@testtoast.com \
    --cc=samuel@sholland.org \
    --cc=sboyd@kernel.org \
    --cc=tzimmermann@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox