All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Uma Shankar <uma.shankar@intel.com>
Cc: intel-gfx@lists.freedesktop.org, ville.syrjala@intel.com,
	maarten.lankhorst@intel.com
Subject: Re: [v3] drm/i915/icl: Handle YCbCr to RGB conversion for BT2020 case
Date: Thu, 9 May 2019 19:31:42 +0300	[thread overview]
Message-ID: <20190509163142.GJ24299@intel.com> (raw)
In-Reply-To: <1557419239-15289-1-git-send-email-uma.shankar@intel.com>

On Thu, May 09, 2019 at 09:57:19PM +0530, Uma Shankar wrote:
> Currently input csc for YCbCR to RGB conversion handles only
> BT601 and Bt709. Extending it to support BT2020 as well.
> 
> v2: Fixed the co-efficients for LR to FR conversion,
> as suggested by Ville.
> 
> v3: Fixed Y Pre-offset in case of Full Range YCbCr as suggested
> by Ville.
> 
> Signed-off-by: Uma Shankar <uma.shankar@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_sprite.c | 31 +++++++++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 2913e89..c9c970f 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -433,6 +433,18 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
>  			0x9EF8, 0x7800, 0xABF8,
>  			0x0, 0x7800,  0x7ED8,
>  		},
> +		/*
> +		 * BT.2020 full range YCbCr -> full range RGB
> +		 * The matrix required is :
> +		 * [1.000, 0.000, 1.474,
> +		 *  1.000, -0.1645, -0.5713,
> +		 *  1.000, 1.8814, 0.0000]
> +		 */
> +		[DRM_COLOR_YCBCR_BT2020] = {
> +			0x7BC8, 0x7800, 0x0,
> +			0x8928, 0x7800, 0xAA88,
> +			0x0, 0x7800, 0x7F10,
> +		},
>  	};
>  
>  	/* Matrix for Limited Range to Full Range Conversion */
> @@ -461,6 +473,18 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
>  			0x8888, 0x7918, 0xADA8,
>  			0x0, 0x7918,  0x6870,
>  		},
> +		/*
> +		 * BT.2020 Limited range YCbCr -> full range RGB
> +		 * The matrix required is :
> +		 * [1.164, 0.000, 1.678,
> +		 *  1.164, -0.1873, -0.6504,
> +		 *  1.164, 2.1417, 0.0000]
> +		 */
> +		[DRM_COLOR_YCBCR_BT2020] = {
> +			0x7D70, 0x7950, 0x0,
> +			0x8A68, 0x7950, 0xAC00,
> +			0x0, 0x7950, 0x6890,
> +		},
>  	};
>  	const u16 *csc;
>  
> @@ -481,8 +505,11 @@ int intel_plane_check_src_coordinates(struct intel_plane_state *plane_state)
>  
>  	I915_WRITE_FW(PLANE_INPUT_CSC_PREOFF(pipe, plane_id, 0),
>  		      PREOFF_YUV_TO_RGB_HI);
> -	I915_WRITE_FW(PLANE_INPUT_CSC_PREOFF(pipe, plane_id, 1),
> -		      PREOFF_YUV_TO_RGB_ME);
> +	if (plane_state->base.color_range == DRM_COLOR_YCBCR_FULL_RANGE)
> +		I915_WRITE_FW(PLANE_INPUT_CSC_PREOFF(pipe, plane_id, 1), 0);
> +	else
> +		I915_WRITE_FW(PLANE_INPUT_CSC_PREOFF(pipe, plane_id, 1),
> +			      PREOFF_YUV_TO_RGB_ME);

I think this could probably be a separate patch since it affects
BT.601/BT.709 as well. Oh, and the matrix coefficients for 601/709 seem
similarly off as what you had in this patch originally. So I think we
want yet another patch to fix those up. Just a bit surprised that even
the current igts pass with those coefficients.

Anyways,
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
(you can keep this on both patch if you split).

PS. pls. cc me @linux.intel.com rather than @intel.com. I generally 
ignore patches going to the @intel.com address. Not that I really
care one way or the other whether a patch was cc:d to me anyway.

>  	I915_WRITE_FW(PLANE_INPUT_CSC_PREOFF(pipe, plane_id, 2),
>  		      PREOFF_YUV_TO_RGB_LO);
>  	I915_WRITE_FW(PLANE_INPUT_CSC_POSTOFF(pipe, plane_id, 0), 0x0);
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-05-09 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 16:27 [v3] drm/i915/icl: Handle YCbCr to RGB conversion for BT2020 case Uma Shankar
2019-05-09 16:31 ` Ville Syrjälä [this message]
2019-05-09 17:49   ` Shankar, Uma
2019-05-09 16:35 ` ✓ Fi.CI.BAT: success for drm/i915/icl: Handle YCbCr to RGB conversion for BT2020 case (rev2) Patchwork
2019-05-10  1:16 ` ✓ Fi.CI.IGT: " Patchwork

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=20190509163142.GJ24299@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@intel.com \
    --cc=uma.shankar@intel.com \
    --cc=ville.syrjala@intel.com \
    /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.