linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Maxime Ripard <maxime@cerno.tech>, Emma Anholt <emma@anholt.net>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: Re: [PATCH 6/9] drm/vc4: hdmi: Swap CSC matrix channels for YUV444
Date: Wed, 11 Jan 2023 16:05:09 +0100	[thread overview]
Message-ID: <2b87062f-cc9e-ce8d-14aa-1ca863acc7f9@suse.de> (raw)
In-Reply-To: <20221207-rpi-hdmi-improvements-v1-6-6b15f774c13a@cerno.tech>


[-- Attachment #1.1: Type: text/plain, Size: 2389 bytes --]



Am 07.12.22 um 17:07 schrieb Maxime Ripard:
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> 
> YUV444 requires the matrix coefficients to be programmed in a different
> way than the other formats. Let's add a function to program it properly.
> 
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/vc4/vc4_hdmi.c | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 299a8fe7a2ae..cb92d07680f0 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -1259,6 +1259,20 @@ static void vc5_hdmi_set_csc_coeffs(struct vc4_hdmi *vc4_hdmi,
>   	HDMI_WRITE(HDMI_CSC_34_33, (coeffs[2][3] << 16) | coeffs[2][2]);
>   }
>   
> +static void vc5_hdmi_set_csc_coeffs_swap(struct vc4_hdmi *vc4_hdmi,
> +					 const u16 coeffs[3][4])
> +{
> +	lockdep_assert_held(&vc4_hdmi->hw_lock);
> +
> +	/* YUV444 needs the CSC matrices using the channels in a different order */
> +	HDMI_WRITE(HDMI_CSC_12_11, (coeffs[2][1] << 16) | coeffs[2][0]);
> +	HDMI_WRITE(HDMI_CSC_14_13, (coeffs[2][3] << 16) | coeffs[2][2]);
> +	HDMI_WRITE(HDMI_CSC_22_21, (coeffs[0][1] << 16) | coeffs[0][0]);
> +	HDMI_WRITE(HDMI_CSC_24_23, (coeffs[0][3] << 16) | coeffs[0][2]);
> +	HDMI_WRITE(HDMI_CSC_32_31, (coeffs[1][1] << 16) | coeffs[1][0]);
> +	HDMI_WRITE(HDMI_CSC_34_33, (coeffs[1][3] << 16) | coeffs[1][2]);
> +}
> +
>   static void vc5_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi,
>   			       struct drm_connector_state *state,
>   			       const struct drm_display_mode *mode)
> @@ -1282,7 +1296,8 @@ static void vc5_hdmi_csc_setup(struct vc4_hdmi *vc4_hdmi,
>   
>   	switch (vc4_state->output_format) {
>   	case VC4_HDMI_OUTPUT_YUV444:
> -		vc5_hdmi_set_csc_coeffs(vc4_hdmi, vc5_hdmi_csc_full_rgb_to_yuv_bt709[lim_range]);
> +		vc5_hdmi_set_csc_coeffs_swap(vc4_hdmi,
> +					     vc5_hdmi_csc_full_rgb_to_yuv_bt709[lim_range]);
>   		break;
>   
>   	case VC4_HDMI_OUTPUT_YUV422:
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

  reply	other threads:[~2023-01-11 15:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 16:07 [PATCH 0/9] drm/vc4: hdmi: Broadcast RGB, BT601, BT2020 Maxime Ripard
2022-12-07 16:07 ` [PATCH 1/9] drm/vc4: hdmi: Update all the planes if the TV margins are changed Maxime Ripard
2023-01-11 13:56   ` Thomas Zimmermann
2022-12-07 16:07 ` [PATCH 2/9] drm/vc4: hdmi: Constify container_of wrappers Maxime Ripard
2023-01-11 14:02   ` Thomas Zimmermann
2023-01-11 14:17     ` Jani Nikula
2022-12-07 16:07 ` [PATCH 3/9] drm/vc4: hdmi: Add Broadcast RGB property to allow override of RGB range Maxime Ripard
2023-01-11 14:11   ` Thomas Zimmermann
2023-01-26  9:38     ` Maxime Ripard
2022-12-07 16:07 ` [PATCH 4/9] drm/vc4: hdmi: Rename full range helper Maxime Ripard
2023-01-11 14:13   ` Thomas Zimmermann
2022-12-07 16:07 ` [PATCH 5/9] drm/vc4: hdmi: Rework the CSC matrices organization Maxime Ripard
2023-01-11 15:03   ` Thomas Zimmermann
2023-01-11 17:00     ` Dave Stevenson
2023-01-26 13:40       ` Maxime Ripard
2022-12-07 16:07 ` [PATCH 6/9] drm/vc4: hdmi: Swap CSC matrix channels for YUV444 Maxime Ripard
2023-01-11 15:05   ` Thomas Zimmermann [this message]
2022-12-07 16:07 ` [PATCH 7/9] drm/vc4: hdmi: Add a function to retrieve the CSC matrix Maxime Ripard
2023-01-11 15:14   ` Thomas Zimmermann
2022-12-07 16:07 ` [PATCH 8/9] drm/vc4: hdmi: Add BT.601 Support Maxime Ripard
2023-01-11 15:16   ` Thomas Zimmermann
2022-12-07 16:07 ` [PATCH 9/9] drm/vc4: hdmi: Add BT.2020 Support Maxime Ripard
2023-01-11 15:18   ` Thomas Zimmermann

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=2b87062f-cc9e-ce8d-14aa-1ca863acc7f9@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=mripard@kernel.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).