diff mbox

[2/8] drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property

Message ID 20180214192327.3250-3-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Feb. 14, 2018, 7:23 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

BT.2020 specifies two YCbCr<->RGB conversion formulas. The more
traditional non-constant luminance and a more complicate one constant
luminance one. Add an enum value for the constant luminance variant
as well in case someone has hardware supporting it.

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Daniel Stone <daniel@fooishbar.org>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
CC: Uma Shankar <uma.shankar@intel.com>
Cc: Shashank Sharma <shashank.sharma@intel.com>
Cc: Jyri Sarha <jsarha@ti.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_color_mgmt.c | 1 +
 include/drm/drm_color_mgmt.h     | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä March 2, 2018, 12:40 p.m. UTC | #1
On Wed, Feb 14, 2018 at 09:23:21PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> BT.2020 specifies two YCbCr<->RGB conversion formulas. The more
> traditional non-constant luminance and a more complicate one constant
> luminance one. Add an enum value for the constant luminance variant
> as well in case someone has hardware supporting it.
> 
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Daniel Stone <daniel@fooishbar.org>
> Cc: Russell King - ARM Linux <linux@armlinux.org.uk>
> Cc: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> CC: Uma Shankar <uma.shankar@intel.com>
> Cc: Shashank Sharma <shashank.sharma@intel.com>
> Cc: Jyri Sarha <jsarha@ti.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_color_mgmt.c | 1 +
>  include/drm/drm_color_mgmt.h     | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
> index a84fc861e406..061d342f9d96 100644
> --- a/drivers/gpu/drm/drm_color_mgmt.c
> +++ b/drivers/gpu/drm/drm_color_mgmt.c
> @@ -357,6 +357,7 @@ static const char * const color_encoding_name[] = {
>  	[DRM_COLOR_YCBCR_BT601] = "ITU-R BT.601 YCbCr",
>  	[DRM_COLOR_YCBCR_BT709] = "ITU-R BT.709 YCbCr",
>  	[DRM_COLOR_YCBCR_BT2020] = "ITU-R BT.2020 YCbCr",
> +	[DRM_COLOR_YCBCR_BT2020_CONST] = "ITU-R BT.2020 YCbCr constant luminance",

I just realized that this exceeds the max prop enum name length
of 31 characters. I guess we'll just have to truncate it to something
like "ITU-R BT.2020 YCbCr const". Any better suggestions?

/me goes add some WARN_ON()s for invalid prop/enum names...

>  };
>  
>  static const char * const color_range_name[] = {
> diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
> index b3b6d302ca8c..175943c87d5b 100644
> --- a/include/drm/drm_color_mgmt.h
> +++ b/include/drm/drm_color_mgmt.h
> @@ -41,7 +41,8 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
>  enum drm_color_encoding {
>  	DRM_COLOR_YCBCR_BT601,
>  	DRM_COLOR_YCBCR_BT709,
> -	DRM_COLOR_YCBCR_BT2020,
> +	DRM_COLOR_YCBCR_BT2020, /* non-constant luminance */
> +	DRM_COLOR_YCBCR_BT2020_CONST, /* constant luminance */
>  	DRM_COLOR_ENCODING_MAX,
>  };
>  
> -- 
> 2.13.6
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
index a84fc861e406..061d342f9d96 100644
--- a/drivers/gpu/drm/drm_color_mgmt.c
+++ b/drivers/gpu/drm/drm_color_mgmt.c
@@ -357,6 +357,7 @@  static const char * const color_encoding_name[] = {
 	[DRM_COLOR_YCBCR_BT601] = "ITU-R BT.601 YCbCr",
 	[DRM_COLOR_YCBCR_BT709] = "ITU-R BT.709 YCbCr",
 	[DRM_COLOR_YCBCR_BT2020] = "ITU-R BT.2020 YCbCr",
+	[DRM_COLOR_YCBCR_BT2020_CONST] = "ITU-R BT.2020 YCbCr constant luminance",
 };
 
 static const char * const color_range_name[] = {
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
index b3b6d302ca8c..175943c87d5b 100644
--- a/include/drm/drm_color_mgmt.h
+++ b/include/drm/drm_color_mgmt.h
@@ -41,7 +41,8 @@  int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
 enum drm_color_encoding {
 	DRM_COLOR_YCBCR_BT601,
 	DRM_COLOR_YCBCR_BT709,
-	DRM_COLOR_YCBCR_BT2020,
+	DRM_COLOR_YCBCR_BT2020, /* non-constant luminance */
+	DRM_COLOR_YCBCR_BT2020_CONST, /* constant luminance */
 	DRM_COLOR_ENCODING_MAX,
 };