diff mbox series

[v2] drm/i915: Add Plane color encoding support for YCBCR_BT2020

Message ID 20200408084734.8834-1-kishore.kadiyala@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm/i915: Add Plane color encoding support for YCBCR_BT2020 | expand

Commit Message

Kishore Kadiyala April 8, 2020, 8:47 a.m. UTC
Currently the plane property doesn't have support for YCBCR_BT2020,
which enables the corresponding color conversion mode on plane CSC.
This propery setting is confined only to HDR Planes as there is
limitation in SDR Planes.

V2: Enabling support for YCBCT_BT2020 for HDR planes on
    platforms GLK & ICL

Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Uma Shankar <uma.shankar@intel.com>
---
 drivers/gpu/drm/i915/display/intel_sprite.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Shankar, Uma April 8, 2020, 8:51 a.m. UTC | #1
> -----Original Message-----
> From: Kadiyala, Kishore <kishore.kadiyala@intel.com>
> Sent: Wednesday, April 8, 2020 2:18 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Kadiyala, Kishore <kishore.kadiyala@intel.com>; Ville Syrjala
> <ville.syrjala@linux.intel.com>; Shankar, Uma <uma.shankar@intel.com>
> Subject: [PATCH v2] drm/i915: Add Plane color encoding support for YCBCR_BT2020
> 
> Currently the plane property doesn't have support for YCBCR_BT2020, which enables
> the corresponding color conversion mode on plane CSC.
> This propery setting is confined only to HDR Planes as there is limitation in SDR
> Planes.

Append that this restriction is for ICL+

> 
> V2: Enabling support for YCBCT_BT2020 for HDR planes on
>     platforms GLK & ICL
> 
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_sprite.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c
> b/drivers/gpu/drm/i915/display/intel_sprite.c
> index deda351719db..4c25d90d16ce 100644
> --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> @@ -3031,6 +3031,7 @@ skl_universal_plane_create(struct drm_i915_private
> *dev_priv,
>  	struct intel_plane *plane;
>  	enum drm_plane_type plane_type;
>  	unsigned int supported_rotations;
> +	unsigned int supported_csc;
>  	const u64 *modifiers;
>  	const u32 *formats;
>  	int num_formats;
> @@ -3105,9 +3106,14 @@ skl_universal_plane_create(struct drm_i915_private
> *dev_priv,
>  					   DRM_MODE_ROTATE_0,
>  					   supported_rotations);
> 
> +	supported_csc = BIT(DRM_COLOR_YCBCR_BT601) |
> +BIT(DRM_COLOR_YCBCR_BT709);
> +
> +	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) &&
> +					(icl_is_hdr_plane(dev_priv, plane_id)))

Refine this condition to enable for all GLK planes and restrict this only to bottom 3 HDR planes
for ICL. Will be good to mention a comment as well that ICL SDR planes have some issues with BT2020
conversion, hence not enabling it on those planes for ICL.

> +		supported_csc |= BIT(DRM_COLOR_YCBCR_BT2020);
> +
>  	drm_plane_create_color_properties(&plane->base,
> -					  BIT(DRM_COLOR_YCBCR_BT601) |
> -					  BIT(DRM_COLOR_YCBCR_BT709),
> +					  supported_csc,

Handle the BT2020 format in glk_plane_color_ctl as well for GLK.

> BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
>  					  BIT(DRM_COLOR_YCBCR_FULL_RANGE),
>  					  DRM_COLOR_YCBCR_BT709,
> --
> 2.17.1
Jani Nikula April 8, 2020, 9:53 a.m. UTC | #2
On Wed, 08 Apr 2020, Kishore Kadiyala <kishore.kadiyala@intel.com> wrote:
> Currently the plane property doesn't have support for YCBCR_BT2020,
> which enables the corresponding color conversion mode on plane CSC.
> This propery setting is confined only to HDR Planes as there is
> limitation in SDR Planes.
>
> V2: Enabling support for YCBCT_BT2020 for HDR planes on
>     platforms GLK & ICL
>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Uma Shankar <uma.shankar@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_sprite.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
> index deda351719db..4c25d90d16ce 100644
> --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> @@ -3031,6 +3031,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
>  	struct intel_plane *plane;
>  	enum drm_plane_type plane_type;
>  	unsigned int supported_rotations;
> +	unsigned int supported_csc;
>  	const u64 *modifiers;
>  	const u32 *formats;
>  	int num_formats;
> @@ -3105,9 +3106,14 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
>  					   DRM_MODE_ROTATE_0,
>  					   supported_rotations);
>  
> +	supported_csc = BIT(DRM_COLOR_YCBCR_BT601) | BIT(DRM_COLOR_YCBCR_BT709);
> +
> +	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) &&
> +					(icl_is_hdr_plane(dev_priv, plane_id)))

This is incorrect and/or misleading in so many levels.

First, the precedence means this is

	(gen >= 10 || (is_glk && icl_is_hdr_plane))

Second, it's odd to have an icl_ prefixed function used only on glk.

Third, icl_is_hdr_plane() internally has gen >= 11. So the right hand
part of the || is always false.

Fourth, there's no point in wrapping the icl_is_hdr_plane() in parens.

Fifth, does this really apply to gen 10 cnl?

BR,
Jani.


> +		supported_csc |= BIT(DRM_COLOR_YCBCR_BT2020);
> +
>  	drm_plane_create_color_properties(&plane->base,
> -					  BIT(DRM_COLOR_YCBCR_BT601) |
> -					  BIT(DRM_COLOR_YCBCR_BT709),
> +					  supported_csc,
>  					  BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
>  					  BIT(DRM_COLOR_YCBCR_FULL_RANGE),
>  					  DRM_COLOR_YCBCR_BT709,
Kishore Kadiyala April 8, 2020, 10:20 a.m. UTC | #3
> -----Original Message-----
> From: Shankar, Uma <uma.shankar@intel.com>
> Sent: Wednesday, April 8, 2020 2:21 PM
> To: Kadiyala, Kishore <kishore.kadiyala@intel.com>; intel-
> gfx@lists.freedesktop.org
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Subject: RE: [PATCH v2] drm/i915: Add Plane color encoding support for
> YCBCR_BT2020
> 
> 
> 
> > -----Original Message-----
> > From: Kadiyala, Kishore <kishore.kadiyala@intel.com>
> > Sent: Wednesday, April 8, 2020 2:18 PM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: Kadiyala, Kishore <kishore.kadiyala@intel.com>; Ville Syrjala
> > <ville.syrjala@linux.intel.com>; Shankar, Uma <uma.shankar@intel.com>
> > Subject: [PATCH v2] drm/i915: Add Plane color encoding support for
> > YCBCR_BT2020
> >
> > Currently the plane property doesn't have support for YCBCR_BT2020,
> > which enables the corresponding color conversion mode on plane CSC.
> > This propery setting is confined only to HDR Planes as there is
> > limitation in SDR Planes.
> 
> Append that this restriction is for ICL+
> 
> >
> > V2: Enabling support for YCBCT_BT2020 for HDR planes on
> >     platforms GLK & ICL
> >
> > Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> > Cc: Uma Shankar <uma.shankar@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_sprite.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c
> > b/drivers/gpu/drm/i915/display/intel_sprite.c
> > index deda351719db..4c25d90d16ce 100644
> > --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> > @@ -3031,6 +3031,7 @@ skl_universal_plane_create(struct
> > drm_i915_private *dev_priv,
> >  	struct intel_plane *plane;
> >  	enum drm_plane_type plane_type;
> >  	unsigned int supported_rotations;
> > +	unsigned int supported_csc;
> >  	const u64 *modifiers;
> >  	const u32 *formats;
> >  	int num_formats;
> > @@ -3105,9 +3106,14 @@ skl_universal_plane_create(struct
> > drm_i915_private *dev_priv,
> >  					   DRM_MODE_ROTATE_0,
> >  					   supported_rotations);
> >
> > +	supported_csc = BIT(DRM_COLOR_YCBCR_BT601) |
> > +BIT(DRM_COLOR_YCBCR_BT709);
> > +
> > +	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) &&
> > +					(icl_is_hdr_plane(dev_priv, plane_id)))
> 
> Refine this condition to enable for all GLK planes and restrict this only to bottom
> 3 HDR planes for ICL. Will be good to mention a comment as well that ICL SDR
> planes have some issues with BT2020 conversion, hence not enabling it on those
> planes for ICL.
> 

Sure Uma , will do the changes

> > +		supported_csc |= BIT(DRM_COLOR_YCBCR_BT2020);
> > +
> >  	drm_plane_create_color_properties(&plane->base,
> > -					  BIT(DRM_COLOR_YCBCR_BT601) |
> > -					  BIT(DRM_COLOR_YCBCR_BT709),
> > +					  supported_csc,
> 
> Handle the BT2020 format in glk_plane_color_ctl as well for GLK.
> 
Ok Uma, will fix 

> > BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
> >
> BIT(DRM_COLOR_YCBCR_FULL_RANGE),
> >  					  DRM_COLOR_YCBCR_BT709,
> > --
> > 2.17.1
Kishore Kadiyala April 8, 2020, 10:24 a.m. UTC | #4
> -----Original Message-----
> From: Jani Nikula <jani.nikula@linux.intel.com>
> Sent: Wednesday, April 8, 2020 3:24 PM
> To: Kadiyala, Kishore <kishore.kadiyala@intel.com>; intel-
> gfx@lists.freedesktop.org
> Cc: Kadiyala, Kishore <kishore.kadiyala@intel.com>
> Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Add Plane color encoding support
> for YCBCR_BT2020
> 
> On Wed, 08 Apr 2020, Kishore Kadiyala <kishore.kadiyala@intel.com> wrote:
> > Currently the plane property doesn't have support for YCBCR_BT2020,
> > which enables the corresponding color conversion mode on plane CSC.
> > This propery setting is confined only to HDR Planes as there is
> > limitation in SDR Planes.
> >
> > V2: Enabling support for YCBCT_BT2020 for HDR planes on
> >     platforms GLK & ICL
> >
> > Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> > Cc: Uma Shankar <uma.shankar@intel.com>
> > ---
> >  drivers/gpu/drm/i915/display/intel_sprite.c | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c
> > b/drivers/gpu/drm/i915/display/intel_sprite.c
> > index deda351719db..4c25d90d16ce 100644
> > --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> > @@ -3031,6 +3031,7 @@ skl_universal_plane_create(struct drm_i915_private
> *dev_priv,
> >  	struct intel_plane *plane;
> >  	enum drm_plane_type plane_type;
> >  	unsigned int supported_rotations;
> > +	unsigned int supported_csc;
> >  	const u64 *modifiers;
> >  	const u32 *formats;
> >  	int num_formats;
> > @@ -3105,9 +3106,14 @@ skl_universal_plane_create(struct
> drm_i915_private *dev_priv,
> >  					   DRM_MODE_ROTATE_0,
> >  					   supported_rotations);
> >
> > +	supported_csc = BIT(DRM_COLOR_YCBCR_BT601) |
> > +BIT(DRM_COLOR_YCBCR_BT709);
> > +
> > +	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) &&
> > +					(icl_is_hdr_plane(dev_priv, plane_id)))
> 
> This is incorrect and/or misleading in so many levels.
> 
> First, the precedence means this is
> 
> 	(gen >= 10 || (is_glk && icl_is_hdr_plane))
> 
> Second, it's odd to have an icl_ prefixed function used only on glk.
> 
> Third, icl_is_hdr_plane() internally has gen >= 11. So the right hand part of the ||
> is always false.
> 
> Fourth, there's no point in wrapping the icl_is_hdr_plane() in parens.
> 
> Fifth, does this really apply to gen 10 cnl?

Agree Jani,  could have been avoided
Will send updated patch

Thanks,
Kishore
> 
> BR,
> Jani.
> 
> 
> > +		supported_csc |= BIT(DRM_COLOR_YCBCR_BT2020);
> > +
> >  	drm_plane_create_color_properties(&plane->base,
> > -					  BIT(DRM_COLOR_YCBCR_BT601) |
> > -					  BIT(DRM_COLOR_YCBCR_BT709),
> > +					  supported_csc,
> >
> BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
> >
> BIT(DRM_COLOR_YCBCR_FULL_RANGE),
> >  					  DRM_COLOR_YCBCR_BT709,
> 
> --
> Jani Nikula, Intel Open Source Graphics Center
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
index deda351719db..4c25d90d16ce 100644
--- a/drivers/gpu/drm/i915/display/intel_sprite.c
+++ b/drivers/gpu/drm/i915/display/intel_sprite.c
@@ -3031,6 +3031,7 @@  skl_universal_plane_create(struct drm_i915_private *dev_priv,
 	struct intel_plane *plane;
 	enum drm_plane_type plane_type;
 	unsigned int supported_rotations;
+	unsigned int supported_csc;
 	const u64 *modifiers;
 	const u32 *formats;
 	int num_formats;
@@ -3105,9 +3106,14 @@  skl_universal_plane_create(struct drm_i915_private *dev_priv,
 					   DRM_MODE_ROTATE_0,
 					   supported_rotations);
 
+	supported_csc = BIT(DRM_COLOR_YCBCR_BT601) | BIT(DRM_COLOR_YCBCR_BT709);
+
+	if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv) &&
+					(icl_is_hdr_plane(dev_priv, plane_id)))
+		supported_csc |= BIT(DRM_COLOR_YCBCR_BT2020);
+
 	drm_plane_create_color_properties(&plane->base,
-					  BIT(DRM_COLOR_YCBCR_BT601) |
-					  BIT(DRM_COLOR_YCBCR_BT709),
+					  supported_csc,
 					  BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
 					  BIT(DRM_COLOR_YCBCR_FULL_RANGE),
 					  DRM_COLOR_YCBCR_BT709,