drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
Subsystems (4)
cover drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
From: Ville Syrjälä <[email protected]>
Here's a refresh of Jyri's COLOR_ENCODING and COLOR_RANGE properties, and the i915 implementation I did on top. I tossed in a few core updates as well: plane state dump, and the BT.2020 constant luminance variant.
Apparently nouveau is already exposing a "iturbt_709" bool property which allows one to choose between BT.601 and BT.709 encodings, but given that we want at least BT.2020 in addition I don't think that property is good enough. Trying to implement it, and somehow extend it beyond BT.601 vs. BT.709 seems like wasted effort. Hence I think we should just ignore it and move on.
My userspace implementation in the form of intel ddx XV_COLORSPACE attribute:
https://patchwork.freedesktop.org/patch/204696/
Jyri Sarha (1):
drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to
drm_plane
Ville Syrjälä (7):
drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING
property
drm/atomic: Include color encoding/range in plane state dump drm/i915: Correctly handle limited range YCbCr data on VLV/CHV drm/i915: Fix plane YCbCr->RGB conversion for GLK drm/i915: Add support for the YCbCr COLOR_ENCODING property drm/i915: Change the COLOR_ENCODING prop default value to BT.709 drm/i915: Add support for the YCbCr COLOR_RANGE property
drivers/gpu/drm/drm_atomic.c | 12 ++++ drivers/gpu/drm/drm_color_mgmt.c | 108 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 24 ++++++- drivers/gpu/drm/i915/intel_display.c | 25 +++++++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_sprite.c | 134 ++++++++++++++++++++++++++++------- include/drm/drm_color_mgmt.h | 20 ++++++ include/drm/drm_plane.h | 8 +++ 9 files changed, 309 insertions(+), 26 deletions(-)
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/8 drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes. COLOR_ENCODING select the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr. COLOR_RANGE selects the value ranges within the selected color encoding. The properties are stored to drm_plane object to allow different set of supported encoding for different planes on the device.
--- drivers/gpu/drm/drm_atomic.c | 8 ++++ drivers/gpu/drm/drm_color_mgmt.c | 91 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 +++++++++ include/drm/drm_plane.h | 8 ++++ 4 files changed, 126 insertions(+)
drivers/gpu/drm/drm_atomic.c +8 -0
@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);
@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {
drivers/gpu/drm/drm_color_mgmt.c +91 -0
100 lines not on this page · raw message
include/drm/drm_color_mgmt.h +19 -0
@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);
@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif
include/drm/drm_plane.h +8 -0
@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;
@@ -112,6 +113,10 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/* Color encoding for non RGB formats */ +enum drm_color_encoding color_encoding; +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;
@@ -558,6 +563,9 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +struct drm_property *color_encoding_property; +struct drm_property *color_range_property; };#define obj_to_plane (x) container_of(x, struct drm_plane, base)
Signature · 6 lines
2.13.6 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 58 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 ++++ drivers/gpu/drm/drm_color_mgmt.c | 91 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 +++++++++ include/drm/drm_plane.h | 8 ++++ 4 files changed, 126 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +0
-0@@ -88,6 +88,19 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use
drivers/gpu/drm/drm_color_mgmt.c line 98
Quoted 10 lines
drivers/gpu/drm/drm_color_mgmt.c +8
-0* drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties: +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane.
Please also mention the function to setup/register them, like we try to do with the other optional properties.
Quoted 30 lines
drivers/gpu/drm/drm_color_mgmt.c +23
-0+* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +352,81 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range
drivers/gpu/drm/drm_color_mgmt.c int drm_mode_gamma_get_ioctl(struct drm_device *dev, · line 382
Quoted 10 lines
drivers/gpu/drm/drm_color_mgmt.c +10
-0+* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to to the drm_plane object. The supported encodings and +* ranges should be provided in supported_encodings and +* supported_ranges bitmasks. Each bit set in the bitmask indicates +* the its number as enum value being supported. +*/ +int drm_plane_create_color_properties(struct drm_plane *plane, + u32 supported_encodings, + u32 supported_ranges,
Is 0 in the above two supported_ masks a valid value? If yes, should we still register the prop in that case? If no, please add a WARN_ON early exit case to catch this.
Similar, if there's only 1 possible value I guess we should make the prop immutable?
Quoted 98 lines
drivers/gpu/drm/drm_color_mgmt.c +50
-0+enum drm_color_encoding default_encoding, + enum drm_color_range default_range) +{ + struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +1
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;
include/drm/drm_plane.h struct drm_plane_state { · line 118
Quoted 6 lines
include/drm/drm_plane.h +3
-0@@ -112,6 +113,10 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/* Color encoding for non RGB formats */ +enum drm_color_encoding color_encoding; +enum drm_color_range color_range;
Needs kerneldoc.
include/drm/drm_plane.h struct drm_plane { · line 568
Quoted 11 lines
include/drm/drm_plane.h +4
-0+/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +563,9 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +struct drm_property *color_encoding_property; +struct drm_property *color_range_property;
Dito.
Quoted 6 lines
include/drm/drm_plane.h +0
-0};#define obj_to_plane (x) container_of(x, struct drm_plane, base)Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 64 lines · Daniel Vetter
Quoted 63 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 ++++ drivers/gpu/drm/drm_color_mgmt.c | 91 ++++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 +++++++++ include/drm/drm_plane.h | 8 ++++ 4 files changed, 126 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +3
-0@@ -88,6 +88,19 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties:
Quoted 8 lines
drivers/gpu/drm/drm_color_mgmt.c line 98
Quoted 5 lines
drivers/gpu/drm/drm_color_mgmt.c +5
-0+* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. Please also mention the function to setup/register them, like we try to do with the other optional properties.
ack
Quoted 36 lines
Quoted 36 lines
drivers/gpu/drm/drm_color_mgmt.c +29
-0+* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +352,81 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to to the drm_plane object. The supported encodings and +* ranges should be provided in supported_encodings and +* supported_ranges bitmasks. Each bit set in the bitmask indicates +* the its number as enum value being supported.
Quoted 8 lines
drivers/gpu/drm/drm_color_mgmt.c int drm_mode_gamma_get_ioctl(struct drm_device *dev, · line 382
Quoted 4 lines
drivers/gpu/drm/drm_color_mgmt.c +4
-0+*/ +int drm_plane_create_color_properties(struct drm_plane *plane, + u32 supported_encodings, + u32 supported_ranges,Is 0 in the above two
supported_masks a valid value? If yes, should we still register the prop in that case? If no, please add aWARN_ONearly exit case to catch this.
I guess if we go for that we should also check that the supported bitmasks don't contain undefined enum values, and that the default enum values are included in the bitmasks.
Jyri said he's not looked at this in a while, so I'll just go ahead and respin this myself.
Quoted 3 lines
Similar, if there's only 1 possible value I guess we should make the prop immutable?
I wonder if we should put that logic intodrm_property_create_enum() & co. actually?
Quoted 102 lines
Quoted 102 lines
drivers/gpu/drm/drm_color_mgmt.c +50
-0+enum drm_color_encoding default_encoding, + enum drm_color_range default_range) +{ + struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +1
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,10 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos;
Quoted 4 lines
include/drm/drm_plane.h struct drm_plane_state { · line 118
Quoted 3 lines
include/drm/drm_plane.h +3
-0+/* Color encoding for non RGB formats */ +enum drm_color_encoding color_encoding; +enum drm_color_range color_range;Needs kerneldoc.
ack
Quoted 7 lines
Quoted 7 lines
include/drm/drm_plane.h +1
-0+/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +563,9 @@ struct drm_plane {
Quoted 7 lines
include/drm/drm_plane.h struct drm_plane { · line 568
Quoted 5 lines
include/drm/drm_plane.h +3
-0struct drm_property *zpos_property;struct drm_property *rotation_property; + +struct drm_property *color_encoding_property; +struct drm_property *color_range_property;Dito.
ack
Quoted 12 lines
Quoted 7 lines
include/drm/drm_plane.h +0
-0};#define obj_to_plane (x) container_of(x, struct drm_plane, base)Signature · 1 line
2.13.6Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 10 lines · Ville Syrjälä
Quoted 6 lines
drivers/gpu/drm/drm_color_mgmt.c int drm_mode_gamma_get_ioctl(struct drm_device *dev, · line 382
Quoted 3 lines
drivers/gpu/drm/drm_color_mgmt.c +3
-0+int drm_plane_create_color_properties(struct drm_plane *plane, + u32 supported_encodings, + u32 supported_ranges,Is 0 in the above two
supported_masks a valid value? If yes, should we still register the prop in that case? If no, please add aWARN_ONearly exit case to catch this.I guess if we go for that we should also check that the supported bitmasks don't contain undefined enum values, and that the default enum values are included in the bitmasks.
Agreed. I wonder if there should still be check in drm_property_create_enum() for empty enum list. I can not imagine any good reason for having an enum property without valid options. It is almost a contradiction in terms.
Quoted 3 lines
Jyri said he's not looked at this in a while, so I'll just go ahead and respin this myself.
Thanks, please do.
Quoted 5 lines
Quoted 2 lines
Similar, if there's only 1 possible value I guess we should make the prop immutable?
I wonder if we should put that logic into
drm_property_create_enum()& co. actually?
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 12 lines · Jyri Sarha
Quoted 10 lines · Ville Syrjälä
Quoted 6 lines
drivers/gpu/drm/drm_color_mgmt.c int drm_mode_gamma_get_ioctl(struct drm_device *dev, · line 382
Quoted 3 lines
drivers/gpu/drm/drm_color_mgmt.c +3
-0+int drm_plane_create_color_properties(struct drm_plane *plane, + u32 supported_encodings, + u32 supported_ranges,Is 0 in the above two
supported_masks a valid value? If yes, should we still register the prop in that case? If no, please add aWARN_ONearly exit case to catch this.I guess if we go for that we should also check that the supported bitmasks don't contain undefined enum values, and that the default enum values are included in the bitmasks.
Quoted 4 lines
Agreed. I wonder if there should still be check in
drm_property_create_enum()for empty enum list. I can not imagine any good reason for having an enum property without valid options. It is almost a contradiction in terms.
Yeah checking for that in the the core function sounds best.
Quoted 10 lines
Quoted 3 lines
Jyri said he's not looked at this in a while, so I'll just go ahead and respin this myself.
Thanks, please do.
Quoted 4 lines
Quoted 2 lines
Similar, if there's only 1 possible value I guess we should make the prop immutable?
I wonder if we should put that logic into
drm_property_create_enum()& co. actually?
I could imagine that we end up with a property that generic userspace wants to set, but a driver somehow only wants to expose a single value (because there's one platform where random constraints result in that). Not quite a sure we should check for that too in the core, but I guess we can try and see what happens.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/8 drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
In reply to Ville SyrjalaFrom: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes. COLOR_ENCODING select the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr. COLOR_RANGE selects the value ranges within the selected color encoding. The properties are stored to drm_plane object to allow different set of supported encoding for different planes on the device.
v2: Add/fix kerneldocs, verify bitmasks (danvet)
--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)
drivers/gpu/drm/drm_atomic.c +8 -0
@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);
@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {
drivers/gpu/drm/drm_color_mgmt.c +103 -0
112 lines not on this page · raw message
include/drm/drm_color_mgmt.h +19 -0
@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);
@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif
include/drm/drm_plane.h +32 -0
@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;
@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;
@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/** +* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };#define obj_to_plane (x) container_of(x, struct drm_plane, base)
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 11 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.v2: Add/fix kerneldocs, verify bitmasks (danvet)
Quoted 12 lines
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>[vsyrjala v2: Add/fix kerneldocs, verify bitmasks]Signed-off-by Ville Syrjälä <[email protected]>
Quoted 246 lines
--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +103
-0@@ -88,6 +88,20 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They +* are set up by calling drm_plane_create_color_properties(). +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. +* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +353,92 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @plane: plane object +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to @plane. The supported encodings and ranges should +* be provided in supported_encodings and supported_ranges bitmasks. +* Each bit set in the bitmask indicates that its number as enum +* value is supported. +*/ +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range) +{ +struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + +if (WARN_ON (supported_encodings ==0 || + (supported_encodings & -BIT (DRM_COLOR_ENCODING_MAX )) !=0 || + (supported_encodings &BIT (default_encoding)) ==0 )) +return -EINVAL ; + +if (WARN_ON (supported_ranges ==0 || + (supported_ranges & -BIT (DRM_COLOR_RANGE_MAX )) !=0 || + (supported_ranges &BIT (default_range)) ==0 )) +return -EINVAL ; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +32
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/** +* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };#define obj_to_plane (x) container_of(x, struct drm_plane, base)Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
In reply to Ville SyrjalaHi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
Regards,
Chris
Quoted 257 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.v2: Add/fix kerneldocs, verify bitmasks (danvet)
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>[vsyrjala v2: Add/fix kerneldocs, verify bitmasks]Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +103
-0@@ -88,6 +88,20 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They +* are set up by calling drm_plane_create_color_properties(). +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. +* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +353,92 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @plane: plane object +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to @plane. The supported encodings and ranges should +* be provided in supported_encodings and supported_ranges bitmasks. +* Each bit set in the bitmask indicates that its number as enum +* value is supported. +*/ +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range) +{ +struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + +if (WARN_ON (supported_encodings ==0 || + (supported_encodings & -BIT (DRM_COLOR_ENCODING_MAX )) !=0 || + (supported_encodings &BIT (default_encoding)) ==0 )) +return -EINVAL ; + +if (WARN_ON (supported_ranges ==0 || + (supported_ranges & -BIT (DRM_COLOR_RANGE_MAX )) !=0 || + (supported_ranges &BIT (default_range)) ==0 )) +return -EINVAL ; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +25
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/**
include/drm/drm_plane.h struct drm_plane { · line 595
Quoted 10 lines
include/drm/drm_plane.h +7
-0+* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };#define obj_to_plane (x) container_of(x, struct drm_plane, base)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 273 lines
Regards,
ChrisQuoted 267 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.v2: Add/fix kerneldocs, verify bitmasks (danvet)
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>[vsyrjala v2: Add/fix kerneldocs, verify bitmasks]Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +103
-0@@ -88,6 +88,20 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They +* are set up by calling drm_plane_create_color_properties(). +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. +* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +353,92 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @plane: plane object +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to @plane. The supported encodings and ranges should +* be provided in supported_encodings and supported_ranges bitmasks. +* Each bit set in the bitmask indicates that its number as enum +* value is supported. +*/ +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range) +{ +struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + +if (WARN_ON (supported_encodings ==0 || + (supported_encodings & -BIT (DRM_COLOR_ENCODING_MAX )) !=0 || + (supported_encodings &BIT (default_encoding)) ==0 )) +return -EINVAL ; + +if (WARN_ON (supported_ranges ==0 || + (supported_ranges & -BIT (DRM_COLOR_RANGE_MAX )) !=0 || + (supported_ranges &BIT (default_range)) ==0 )) +return -EINVAL ; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +32
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/** +* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };#define obj_to_plane (x) container_of(x, struct drm_plane, base)
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
A. Add another enums: DRM_COLOR_RGB_BT601 and friends.
B. Reuse current enums, but remove format information from them:DRM_COLOR_YCBCR_BT601 => DRM_COLOR_BT601.
Regards
Andrzej
Quoted 272 lines
Quoted 272 lines
Regards,
ChrisQuoted 266 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.v2: Add/fix kerneldocs, verify bitmasks (danvet)
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>[vsyrjala v2: Add/fix kerneldocs, verify bitmasks]Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +103
-0@@ -88,6 +88,20 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They +* are set up by calling drm_plane_create_color_properties(). +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. +* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +353,92 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @plane: plane object +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to @plane. The supported encodings and ranges should +* be provided in supported_encodings and supported_ranges bitmasks. +* Each bit set in the bitmask indicates that its number as enum +* value is supported. +*/ +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range) +{ +struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + +if (WARN_ON (supported_encodings ==0 || + (supported_encodings & -BIT (DRM_COLOR_ENCODING_MAX )) !=0 || + (supported_encodings &BIT (default_encoding)) ==0 )) +return -EINVAL ; + +if (WARN_ON (supported_ranges ==0 || + (supported_ranges & -BIT (DRM_COLOR_RANGE_MAX )) !=0 || + (supported_ranges &BIT (default_range)) ==0 )) +return -EINVAL ; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +32
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/** +* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };
Quoted 1 line
Quoted 1 line
include/drm/drm_plane.h struct drm_plane { · line 595
Quoted 1 line
include/drm/drm_plane.h +0
-0#define obj_to_plane (x) container_of(x, struct drm_plane, base)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 17 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
RGB is just RGB. There is no encoding. It's assumed to be full range because no one really uses anything else.
Quoted 10 lines
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
A. Add another enums:
DRM_COLOR_RGB_BT601and friends.
BT.601 specifies how to encoder RGB data as YCbCr. So without YCbCr BT.601 does not mean anything. Well, the standard does contain other things as well I suppose, but for the purposes of the color encoding prop only that one part is relevant.
Quoted 283 lines
B. Reuse current enums, but remove format information from them:
DRM_COLOR_YCBCR_BT601=>DRM_COLOR_BT601.Regards
Andrzej
Quoted 273 lines
Quoted 273 lines
Regards,
ChrisQuoted 267 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.v2: Add/fix kerneldocs, verify bitmasks (danvet)
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>[vsyrjala v2: Add/fix kerneldocs, verify bitmasks]Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +103
-0@@ -88,6 +88,20 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They +* are set up by calling drm_plane_create_color_properties(). +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. +* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +353,92 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @plane: plane object +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to @plane. The supported encodings and ranges should +* be provided in supported_encodings and supported_ranges bitmasks. +* Each bit set in the bitmask indicates that its number as enum +* value is supported. +*/ +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range) +{ +struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + +if (WARN_ON (supported_encodings ==0 || + (supported_encodings & -BIT (DRM_COLOR_ENCODING_MAX )) !=0 || + (supported_encodings &BIT (default_encoding)) ==0 )) +return -EINVAL ; + +if (WARN_ON (supported_ranges ==0 || + (supported_ranges & -BIT (DRM_COLOR_RANGE_MAX )) !=0 || + (supported_ranges &BIT (default_range)) ==0 )) +return -EINVAL ; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +32
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/** +* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };#define obj_to_plane (x) container_of(x, struct drm_plane, base)
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 8 lines
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
RGB is just RGB. There is no encoding. It's assumed to be full range because no one really uses anything else.
For simple desktop usage that's true. When dealing with video inputs, this becomes much more complicated.
Quoted 10 lines
Quoted 10 lines
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
Quoted 6 lines
Quoted 1 line
A. Add another enums:
DRM_COLOR_RGB_BT601and friends.BT.601 specifies how to encoder RGB data as YCbCr. So without YCbCr BT.601 does not mean anything. Well, the standard does contain other things as well I suppose, but for the purposes of the color encoding prop only that one part is relevant.
Ah, I misunderstood the meaning of DRM_COLOR_RGB_BT601. This is the equivalent of V4L2_YCBCR_ENC_601, and that's indeed only defined for Y'CbCr. But it is often (ab)used as an alias for the SMPTE170M colorspace (used by SDTV).
V4L2 has the following defines for colorspaces, transfer functions, Y'CbCr (and HSV) encodings and quantization ranges:
https://hverkuil.home.xs4all.nl/spec/uapi/v4l/colorspaces-defs.html
Missing in this list is the color encoding (RGB vs YCbCr vs HSV) which is set through the pixelformat fourcc.
And indeed, we don't have an RGB encoding define since RGB is just RGB :-)
Regards,
Hans
Quoted 282 lines
Quoted 282 lines
B. Reuse current enums, but remove format information from them:
DRM_COLOR_YCBCR_BT601=>DRM_COLOR_BT601.Regards
Andrzej
Quoted 272 lines
Quoted 272 lines
Regards,
ChrisQuoted 266 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.v2: Add/fix kerneldocs, verify bitmasks (danvet)
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>[vsyrjala v2: Add/fix kerneldocs, verify bitmasks]Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +103
-0@@ -88,6 +88,20 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They +* are set up by calling drm_plane_create_color_properties(). +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. +* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +353,92 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @plane: plane object +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to @plane. The supported encodings and ranges should +* be provided in supported_encodings and supported_ranges bitmasks. +* Each bit set in the bitmask indicates that its number as enum +* value is supported. +*/ +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range) +{ +struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + +if (WARN_ON (supported_encodings ==0 || + (supported_encodings & -BIT (DRM_COLOR_ENCODING_MAX )) !=0 || + (supported_encodings &BIT (default_encoding)) ==0 )) +return -EINVAL ; + +if (WARN_ON (supported_ranges ==0 || + (supported_ranges & -BIT (DRM_COLOR_RANGE_MAX )) !=0 || + (supported_ranges &BIT (default_range)) ==0 )) +return -EINVAL ; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +32
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/** +* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
include/drm/drm_plane.h struct drm_plane { · line 595
Quoted 1 line
include/drm/drm_plane.h +0
-0#define obj_to_plane (x) container_of(x, struct drm_plane, base)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 53 lines · Hans Verkuil
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 8 lines
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
RGB is just RGB. There is no encoding. It's assumed to be full range because no one really uses anything else.
For simple desktop usage that's true. When dealing with video inputs, this becomes much more complicated.
Quoted 10 lines
Quoted 10 lines
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
Quoted 6 lines
Quoted 1 line
A. Add another enums:
DRM_COLOR_RGB_BT601and friends.BT.601 specifies how to encoder RGB data as YCbCr. So without YCbCr BT.601 does not mean anything. Well, the standard does contain other things as well I suppose, but for the purposes of the color encoding prop only that one part is relevant.
Ah, I misunderstood the meaning of
DRM_COLOR_RGB_BT601. This is the equivalent ofV4L2_YCBCR_ENC_601, and that's indeed only defined for Y'CbCr. But it is often (ab)used as an alias for the SMPTE170M colorspace (used by SDTV).
Quoted 4 lines
V4L2 has the following defines for colorspaces, transfer functions, Y'CbCr (and HSV) encodings and quantization ranges:
https://hverkuil.home.xs4all.nl/spec/uapi/v4l/colorspaces-defs.html
Yeah, we're going to be introducing other properties to control colorspace and transfer function in kms as well. Actually some patches towards that have been floated a few times already.
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 54 lines · Ville Syrjälä
Quoted 53 lines · Hans Verkuil
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 8 lines
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
RGB is just RGB. There is no encoding. It's assumed to be full range because no one really uses anything else.
For simple desktop usage that's true. When dealing with video inputs, this becomes much more complicated.
Quoted 10 lines
Quoted 10 lines
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
Quoted 6 lines
Quoted 1 line
A. Add another enums:
DRM_COLOR_RGB_BT601and friends.BT.601 specifies how to encoder RGB data as YCbCr. So without YCbCr BT.601 does not mean anything. Well, the standard does contain other things as well I suppose, but for the purposes of the color encoding prop only that one part is relevant.
Ah, I misunderstood the meaning of
DRM_COLOR_RGB_BT601. This is the equivalent ofV4L2_YCBCR_ENC_601, and that's indeed only defined for Y'CbCr. But it is often (ab)used as an alias for the SMPTE170M colorspace (used by SDTV).
Quoted 9 lines
Quoted 4 lines
V4L2 has the following defines for colorspaces, transfer functions, Y'CbCr (and HSV) encodings and quantization ranges:
https://hverkuil.home.xs4all.nl/spec/uapi/v4l/colorspaces-defs.html
Yeah, we're going to be introducing other properties to control colorspace and transfer function in kms as well. Actually some patches towards that have been floated a few times already.
Great. Let's try to keep drm and V4L2 in sync for this. It should be possible to convert from one to the other without having to do weird things.
I'll try to pay attention to these patches, but just ping me if you want me to take a look at something.
I put a lot of effort into the V4L2 colorspace documentation, trying to put all the information in one place, esp. all the formulas.
Regards,
Hans
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Hi,
Quoted 21 lines · Hans Verkuil
Quoted 20 lines · Ville Syrjälä
Quoted 19 lines · Hans Verkuil
Quoted 18 lines · Ville Syrjälä
Quoted 17 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
This is where I personally think we've got an unfortunate disconnect in the KMS UAPI.
For YCbCr buffers, these properties specify the encoding and range of the data in the buffer. But everything else in the pipe is described in terms of the processing to apply - i.e. the KMS driver doesn't know what transfer function the data uses, it only knows the degamma LUT it's told to apply to it.
It would have been more uniform if the COLOR_ENCODING/COLOR_RANGE properties were a single "ENCODING_CONVERSION" property stating what conversion should be applied.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
RGB is just RGB. There is no encoding. It's assumed to be full range because no one really uses anything else.
For simple desktop usage that's true. When dealing with video inputs, this becomes much more complicated.
When the plane degamma/ctm/gamma properties land, those could be used to convert limited range to whatever the pipe-internal format is, I think.
That pipe-internal format would be whatever userspace decides it is, via converting input buffers using the various color conversion properties.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
My understanding is that DRM would never be informed of this - only what to do with the data (which does of-course imply an encoding, but it's not told to DRM explicitly).
Quoted 31 lines
Quoted 17 lines
Quoted 17 lines
Quoted 11 lines
Quoted 6 lines
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
A. Add another enums:
DRM_COLOR_RGB_BT601and friends.BT.601 specifies how to encoder RGB data as YCbCr. So without YCbCr BT.601 does not mean anything. Well, the standard does contain other things as well I suppose, but for the purposes of the color encoding prop only that one part is relevant.
Ah, I misunderstood the meaning of
DRM_COLOR_RGB_BT601. This is the equivalent ofV4L2_YCBCR_ENC_601, and that's indeed only defined for Y'CbCr. But it is often (ab)used as an alias for the SMPTE170M colorspace (used by SDTV).Quoted 9 lines
Quoted 4 lines
V4L2 has the following defines for colorspaces, transfer functions, Y'CbCr (and HSV) encodings and quantization ranges:
https://hverkuil.home.xs4all.nl/spec/uapi/v4l/colorspaces-defs.html
Yeah, we're going to be introducing other properties to control colorspace and transfer function in kms as well. Actually some patches towards that have been floated a few times already.
Great. Let's try to keep drm and V4L2 in sync for this. It should be possible to convert from one to the other without having to do weird things.
Quoted 5 lines
I'll try to pay attention to these patches, but just ping me if you want me to take a look at something.
I put a lot of effort into the V4L2 colorspace documentation, trying to put all the information in one place, esp. all the formulas.
There's always going to be a bit of a disconnect here - in KMS, it's userspace which needs to handle all this stuff. It would be up to userspace to set e.g. DEGAMMA_LUT to a LUT which corresponds to SMPTE 2084, rather than the kernel driver being told directly that the buffer is encoded using the SMPTE 2084 transfer function.
Actually I want to put an RFC together to allow DEGAMMA_LUT/GAMMA_LUT to be set to some pre-defined values (e.g. sRGB, PQ, HLG) to suit hardware which has built-in hard-coded transfer functions (and potentially also save userspace some effort of coming up with LUTs).
Cheers,
-Brian
Quoted 8 lines
Regards,
Hans
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
In reply to Hans VerkuilQuoted 18 lines · Hans Verkuil
Quoted 17 lines · Ville Syrjälä
Quoted 16 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
RGB is just RGB. There is no encoding.
OK, Now I see I have confused encoding with colorspace, Hans thanks for the documentation.
As I understand drm by default should expect sRGB colorspace, also for Y'CbCr buffers, and currently there are no standard ways to specify buffer colorspace.
Looking at current users of drm_plane_create_color_properties for Y'CbCr buffers it seems default range should be LIMITED.
But default encoding is different: mali, armada, nouveau use DRM_COLOR_YCBCR_BT601, i915 uses DRM_COLOR_YCBCR_BT709 - shouldn't this be somehow standardized?
What I still do not understand is colorspace conversion(not encoding!) - between pipeline input (framebuffers) and output (HDMI connector for example):
1. Since sRGB, SMPTE170M/BT.601, BT.709 colorspaces are 'almost identical in coverage' (according to wikipedia[1]) no colorspace conversion is performed at all.
2. It is performed somewhere by HW, just my IP documentation is not clear about it.
Another thing which still bothers me is RGB range in case of HDMI - CEA-861 expects than on CEA modes limited RGB range should be sent, but the pipeline on the particular hardware I have do not perform any conversion of input buffers. So only limited range RGB buffers are displayed correctly. In such case property describing plane with limited RGB would be useful.
[1]: https://en.wikipedia.org/wiki/Rec._709#Primary_chromaticities
Quoted 4 lines
It's assumed to be full range
Quoted 1 line
because no one really uses anything else.
For simple desktop usage that's true. When dealing with video inputs, this becomes much more complicated.
As I said earlier there are cases where output stream should be limited RGB, and no conversion in pipeline - thus framebuffers also should be 'limited RGB'.
Regards
Andrzej
Quoted 24 lines
Quoted 9 lines
Quoted 9 lines
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
Quoted 5 lines
Quoted 1 line
A. Add another enums:
DRM_COLOR_RGB_BT601and friends.BT.601 specifies how to encoder RGB data as YCbCr. So without YCbCr BT.601 does not mean anything. Well, the standard does contain other things as well I suppose, but for the purposes of the color encoding prop only that one part is relevant.
Ah, I misunderstood the meaning of
DRM_COLOR_RGB_BT601. This is the equivalent ofV4L2_YCBCR_ENC_601, and that's indeed only defined for Y'CbCr. But it is often (ab)used as an alias for the SMPTE170M colorspace (used by SDTV).V4L2 has the following defines for colorspaces, transfer functions, Y'CbCr (and HSV) encodings and quantization ranges:
https://hverkuil.home.xs4all.nl/spec/uapi/v4l/colorspaces-defs.html
Quoted 17 lines
Missing in this list is the color encoding (RGB vs YCbCr vs HSV) which is set through the pixelformat fourcc.
And indeed, we don't have an RGB encoding define since RGB is just RGB :-)
Regards,
Hans
Quoted 8 lines
Quoted 8 lines
B. Reuse current enums, but remove format information from them:
DRM_COLOR_YCBCR_BT601=>DRM_COLOR_BT601.Regards
Andrzej
...
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 30 lines · Andrzej Hajda
Quoted 18 lines · Hans Verkuil
Quoted 17 lines · Ville Syrjälä
Quoted 16 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
RGB is just RGB. There is no encoding.
OK, Now I see I have confused encoding with colorspace, Hans thanks for the documentation.
Quoted 6 lines
As I understand drm by default should expect sRGB colorspace, also for Y'CbCr buffers, and currently there are no standard ways to specify buffer colorspace.
Looking at current users of
drm_plane_create_color_propertiesfor Y'CbCr buffers it seems default range should be LIMITED.
Right. There is support for YCbCr quantization range signaling in HDMI, but that is for all intents and purposes broken in the standard. Don't use it, just output limited range YCbCr.
On the other hand, RGB Quantization range signaling should *always* be used if the EDID signals support for it. I believe that's what drm does today already (this certainly works for i915).
Quoted 4 lines
But default encoding is different: mali, armada, nouveau use
DRM_COLOR_YCBCR_BT601, i915 usesDRM_COLOR_YCBCR_BT709- shouldn't this be somehow standardized?
According to CEA-861 bt.601 should be used for SDTV (PAL/NTSC), 709 for everything else. So this is resolution dependent.
Although strictly speaking it is only userspace that knows the right encoding, since it depends on the source material. You can have SDTV video encoded with 709, or HDTV encoded with 601. But in the absence of any information, the default rule above is what should be used.
Quoted 9 lines
What I still do not understand is colorspace conversion(not encoding!) - between pipeline input (framebuffers) and output (HDMI connector for example):
1. Since sRGB, SMPTE170M/BT.601, BT.709 colorspaces are 'almost identical in coverage' (according to wikipedia[1]) no colorspace conversion is performed at all.
That's correct. There is a slight difference between SMPTE170M and sRGB/Rec709, but basically invisible to the naked eye unless you see it side-by-side, and even then it's is hard to detect.
However, sRGB uses a different transfer function compared to SMPTE170M and Rec709, and that difference *is* quite visible. Not all hardware (certainly not video capture hardware) is capable of converting between different transfer functions, though. I gather that this is more common for HDMI output hardware.
Quoted 11 lines
2. It is performed somewhere by HW, just my IP documentation is not clear about it.
Another thing which still bothers me is RGB range in case of HDMI - CEA-861 expects than on CEA modes limited RGB range should be sent, but the pipeline on the particular hardware I have do not perform any conversion of input buffers. So only limited range RGB buffers are displayed correctly. In such case property describing plane with limited RGB would be useful.
Are you sure? Usually the same block that does YCbCr encoding conversion (601 to 709 or vice versa), also deals with limited/full range conversion.
It is typically a 3x3 matrix + a vector adding the needed offsets. It is dead cheap to implement in hardware, so it would be very unusual if there is no support for this.
Quoted 6 lines
[1]: https://en.wikipedia.org/wiki/Rec._709#Primary_chromaticities
Quoted 1 line
It's assumed to be full range
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
because no one really uses anything else.
For simple desktop usage that's true. When dealing with video inputs, this becomes much more complicated.
As I said earlier there are cases where output stream should be limited RGB, and no conversion in pipeline - thus framebuffers also should be 'limited RGB'.
Whether RGB output should be full or limited range depends entirely on the resolution and the EDID. I have tested i915 w.r.t. RGB quantization range, and that does it right.
The reality with RGB Quantization Range handling is that 50% of all devices do this wrong. So if the EDID signals selectable quantization range support, then use it and signal full range RGB.
If it is not available, then the i915 implementation is one I can point to that does it 100% correct. (This might be based on core drm code, I'm not sure if it is i915 specific or not)
Kudos to the i915 driver developers: the linux implementation is the only one that handles this correctly. The Windows implementation doesn't honor RGB Selectable Quantization and the macos driver seems to always output full range.
The only way to support all three variants in an HDMI receiver is to enable YCbCr support in the EDID: the macos driver will now output YCbCr, while all the others output RGB (Windows using default RGB Quantization rules and Linux explicitly signaling the RGB range).
It's insane.
Regards,
Hans
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Quoted 46 lines · Hans Verkuil
Quoted 28 lines · Andrzej Hajda
Quoted 15 lines · Hans Verkuil
Quoted 14 lines · Ville Syrjälä
Quoted 13 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 7 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
What you trying to do? Input limited range RGB data and expand to full range?
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
RGB is just RGB. There is no encoding.
OK, Now I see I have confused encoding with colorspace, Hans thanks for the documentation.
Quoted 6 lines
As I understand drm by default should expect sRGB colorspace, also for Y'CbCr buffers, and currently there are no standard ways to specify buffer colorspace.
Looking at current users of
drm_plane_create_color_propertiesfor Y'CbCr buffers it seems default range should be LIMITED.Right. There is support for YCbCr quantization range signaling in HDMI, but that is for all intents and purposes broken in the standard. Don't use it, just output limited range YCbCr.
On the other hand, RGB Quantization range signaling should *always* be used if the EDID signals support for it. I believe that's what drm does today already (this certainly works for i915).
Quoted 3 lines
But default encoding is different: mali, armada, nouveau use
DRM_COLOR_YCBCR_BT601, i915 usesDRM_COLOR_YCBCR_BT709- shouldn't this be somehow standardized?
Quoted 7 lines
According to CEA-861 bt.601 should be used for SDTV (PAL/NTSC), 709 for everything else. So this is resolution dependent.
Although strictly speaking it is only userspace that knows the right encoding, since it depends on the source material. You can have SDTV video encoded with 709, or HDTV encoded with 601. But in the absence of any information, the default rule above is what should be used.
Since drm plane is not tied to specific crtc default encoding will not be always known prior to setting mode on crtc and attaching plane to crtc, probably DRM_COLOR_YCBCR_DEFAULT or similar would solve the issue.
Quoted 29 lines
Quoted 9 lines
What I still do not understand is colorspace conversion(not encoding!) - between pipeline input (framebuffers) and output (HDMI connector for example):
1. Since sRGB, SMPTE170M/BT.601, BT.709 colorspaces are 'almost identical in coverage' (according to wikipedia[1]) no colorspace conversion is performed at all.
That's correct. There is a slight difference between SMPTE170M and sRGB/Rec709, but basically invisible to the naked eye unless you see it side-by-side, and even then it's is hard to detect.
However, sRGB uses a different transfer function compared to SMPTE170M and Rec709, and that difference *is* quite visible. Not all hardware (certainly not video capture hardware) is capable of converting between different transfer functions, though. I gather that this is more common for HDMI output hardware.
Quoted 10 lines
2. It is performed somewhere by HW, just my IP documentation is not clear about it.
Another thing which still bothers me is RGB range in case of HDMI - CEA-861 expects than on CEA modes limited RGB range should be sent, but the pipeline on the particular hardware I have do not perform any conversion of input buffers. So only limited range RGB buffers are displayed correctly. In such case property describing plane with limited RGB would be useful.
Quoted 6 lines
Are you sure? Usually the same block that does YCbCr encoding conversion (601 to 709 or vice versa), also deals with limited/full range conversion.
It is typically a 3x3 matrix + a vector adding the needed offsets. It is dead cheap to implement in hardware, so it would be very unusual if there is no support for this.
Yay, I have unusual hardware :)
There is register in HDMI output block for RGB->YCbCr conversion and I can specify there input RGB range and encoding, but it is only for cases where output is YCbCr4:4:4, In case RGB -> RGB no conversion is performed.
Regards
Andrzej
Quoted 34 lines
Quoted 4 lines
[1]: https://en.wikipedia.org/wiki/Rec._709#Primary_chromaticities
Quoted 8 lines
Quoted 4 lines
It's assumed to be full range
Quoted 1 line
because no one really uses anything else.
For simple desktop usage that's true. When dealing with video inputs, this becomes much more complicated.
As I said earlier there are cases where output stream should be limited RGB, and no conversion in pipeline - thus framebuffers also should be 'limited RGB'.
Whether RGB output should be full or limited range depends entirely on the resolution and the EDID. I have tested i915 w.r.t. RGB quantization range, and that does it right.
The reality with RGB Quantization Range handling is that 50% of all devices do this wrong. So if the EDID signals selectable quantization range support, then use it and signal full range RGB.
If it is not available, then the i915 implementation is one I can point to that does it 100% correct. (This might be based on core drm code, I'm not sure if it is i915 specific or not)
Kudos to the i915 driver developers: the linux implementation is the only one that handles this correctly. The Windows implementation doesn't honor RGB Selectable Quantization and the macos driver seems to always output full range.
The only way to support all three variants in an HDMI receiver is to enable YCbCr support in the EDID: the macos driver will now output YCbCr, while all the others output RGB (Windows using default RGB Quantization rules and Linux explicitly signaling the RGB range).
Quoted 7 lines
It's insane.
Regards,
Hans
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
In reply to Andrzej HajdaQuoted 17 lines · Andrzej Hajda
Hi Ville,
As Christoph cannot respond till middle next week I can try to respond in his absence, as I am familiar with the subject.
Quoted 9 lines · Ville Syrjälä
Quoted 6 lines · Christoph Manszewski
Hi,
I am looking for a way to export the color encoding and range selection to user space. I came across those properties and am wondering, why they are meant only for non RGB color encodings. Would it be okay, to modify them and use with RGB formats as well?
What you trying to do? Input limited range RGB data and expand to full range?
Quoted 5 lines
For example. But there are two more general questions, which surprisingly we have not found answer for.
1. What color encoding and range drm should expect on its input RGB buffers by default?
While I am not a drm expert, I am pretty certain it always expects full range RGB.
There is a real use-case for being able to give drm limited range RGB:
if the image was filled from an HDMI receiver and that receiver got limited range RGB. That said, most (but not all) receivers can expand it to full range before writing to memory.
Quoted 4 lines
2. How userspace should inform drm that given buffer has specified non-default color encoding and range?
Quoted 8 lines
Hopefully this patch introduces such properties but only for YCbCr formats, the question is what should be the best way to expand it to RGB formats:
A. Add another enums:
DRM_COLOR_RGB_BT601and friends.B. Reuse current enums, but remove format information from them:
DRM_COLOR_YCBCR_BT601=>DRM_COLOR_BT601.
The colorspace (BT601, REC709, BT2020) is independent of the quantization range (full/limited) and of the color encoding (YCbCr, RGB). There is also the transfer function, another independent setting.
More background info is here:
https://hverkuil.home.xs4all.nl/spec/uapi/v4l/colorspaces.html
If all you use is a desktop, then it is all simple: full range sRGB. But if you start mixing video captured from an HDMI receiver, then it can become much more complex.
Regards,
Hans
Quoted 278 lines
Regards
Andrzej
Quoted 272 lines
Quoted 272 lines
Regards,
ChrisQuoted 266 lines · Ville Syrjala
From: Jyri Sarha <[email protected]>
Add a standard optional properties to support different non RGB color encodings in DRM planes.
COLOR_ENCODINGselect the supported non RGB color encoding, for instance ITU-R BT.709 YCbCr.COLOR_RANGEselects the value ranges within the selected color encoding. The properties are stored todrm_planeobject to allow different set of supported encoding for different planes on the device.v2: Add/fix kerneldocs, verify bitmasks (danvet)
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Reviewed-by Ville Syrjälä <[email protected]>Signed-off-by Jyri Sarha <[email protected]>[vsyrjala v2: Add/fix kerneldocs, verify bitmasks]Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 8 +++ drivers/gpu/drm/drm_color_mgmt.c | 103 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 19 ++++++++ include/drm/drm_plane.h | 32 ++++++++++++ 4 files changed, 162 insertions(+)drivers/gpu/drm/drm_atomic.c +8
-0@@ -759,6 +759,10 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->rotation = val; }else if (property == plane->zpos_property) { state->zpos = val; + }else if (property == plane->color_encoding_property) { + state->color_encoding = val; + }else if (property == plane->color_range_property) { + state->color_range = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);@@ -818,6 +822,10 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->rotation; }else if (property == plane->zpos_property) { *val = state->zpos; + }else if (property == plane->color_encoding_property) { + *val = state->color_encoding; + }else if (property == plane->color_range_property) { + *val = state->color_range; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {drivers/gpu/drm/drm_color_mgmt.c +103
-0@@ -88,6 +88,20 @@* drm_mode_crtc_set_gamma_size(). Drivers which support both should use * drm_atomic_helper_legacy_gamma_set() to alias the legacy gamma ramp with the * "GAMMA_LUT" property above. +* +* Support for different non RGB color encodings is controlled through +* &drm_plane specific COLOR_ENCODING and COLOR_RANGE properties. They +* are set up by calling drm_plane_create_color_properties(). +* +* "COLOR_ENCODING" +* Optional plane enum property to support different non RGB +* color encodings. The driver can provide a subset of standard +* enum values supported by the DRM plane. +* +* "COLOR_RANGE" +* Optional plane enum property to support different non RGB +* color parameter ranges. The driver can provide a subset of +* standard enum values supported by the DRM plane. */ /** @@ -339,3 +353,92 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,drm_modeset_unlock (&crtc->mutex);return ret; } + +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" , +}; + +static const char *const color_range_name[] = { + [DRM_COLOR_YCBCR_FULL_RANGE ] ="YCbCr full range" , + [DRM_COLOR_YCBCR_LIMITED_RANGE ] ="YCbCr limited range" , +}; + +/** +* drm_plane_create_color_properties - color encoding related plane properties +* @plane: plane object +* @supported_encodings: bitfield indicating supported color encodings +* @supported_ranges: bitfileld indicating supported color ranges +* @default_encoding: default color encoding +* @default_range: default color range +* +* Create and attach plane specific COLOR_ENCODING and COLOR_RANGE +* properties to @plane. The supported encodings and ranges should +* be provided in supported_encodings and supported_ranges bitmasks. +* Each bit set in the bitmask indicates that its number as enum +* value is supported. +*/ +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range) +{ +struct drm_device *dev = plane->dev; +struct drm_property *prop; +struct drm_prop_enum_list enum_list[max (DRM_COLOR_ENCODING_MAX , +DRM_COLOR_RANGE_MAX )]; +int i, len; + +if (WARN_ON (supported_encodings ==0 || + (supported_encodings & -BIT (DRM_COLOR_ENCODING_MAX )) !=0 || + (supported_encodings &BIT (default_encoding)) ==0 )) +return -EINVAL ; + +if (WARN_ON (supported_ranges ==0 || + (supported_ranges & -BIT (DRM_COLOR_RANGE_MAX )) !=0 || + (supported_ranges &BIT (default_range)) ==0 )) +return -EINVAL ; + + len =0 ; +for (i =0 ; i <DRM_COLOR_ENCODING_MAX ; i++) { +if ((supported_encodings &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_encoding_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_ENCODING" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_encoding_property = prop; +drm_object_attach_property (&plane->base, prop, default_encoding); +if (plane->state) + plane->state->color_encoding = default_encoding; + + len =0 ; +for (i =0 ; i <DRM_COLOR_RANGE_MAX ; i++) { +if ((supported_ranges &BIT (i)) ==0 ) +continue ; + + enum_list[len].type = i; + enum_list[len].name = color_range_name[i]; + len++; + } + + prop =drm_property_create_enum (dev,0 ,"COLOR_RANGE" , + enum_list, len); +if (!prop) +return -ENOMEM ; + plane->color_range_property = prop; +drm_object_attach_property (&plane->base, prop, default_range); +if (plane->state) + plane->state->color_range = default_range; + +return 0 ; +} +EXPORT_SYMBOL (drm_plane_create_color_properties);include/drm/drm_color_mgmt.h +19
-0@@ -26,6 +26,7 @@#include <linux/ctype.h> struct drm_crtc ; +struct drm_plane ;uint32_t drm_color_lut_extract (uint32_t user_input,uint32_t bit_precision);@@ -37,4 +38,22 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +enum drm_color_encoding { +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , +DRM_COLOR_YCBCR_BT2020 , +DRM_COLOR_ENCODING_MAX , +}; + +enum drm_color_range { +DRM_COLOR_YCBCR_LIMITED_RANGE , +DRM_COLOR_YCBCR_FULL_RANGE , +DRM_COLOR_RANGE_MAX , +}; + +int drm_plane_create_color_properties (struct drm_plane *plane, +u32 supported_encodings, +u32 supported_ranges, +enum drm_color_encoding default_encoding, +enum drm_color_range default_range);#endif include/drm/drm_plane.h +32
-0@@ -26,6 +26,7 @@#include <linux/list.h> #include <linux/ctype.h> #include <drm/drm_mode_object.h> +#include <drm/drm_color_mgmt.h> struct drm_crtc ;struct drm_printer ;@@ -112,6 +113,20 @@ struct drm_plane_state {unsigned int zpos;unsigned int normalized_zpos; +/** +* @color_encoding: +* +* Color encoding for non RGB formats +*/ +enum drm_color_encoding color_encoding; + +/** +* @color_range: +* +* Color range for non RGB formats +*/ +enum drm_color_range color_range; +/* Clipped coordinates */ struct drm_rect src, dst;@@ -558,6 +573,23 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/** +* @color_encoding_property: +* +* Optional "COLOR_ENCODING" enum property for specifying +* color encoding for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_encoding_property; +/** +* @color_range_property: +* +* Optional "COLOR_RANGE" enum property for specifying +* color range for non RGB formats. +* See drm_plane_create_color_properties(). +*/ +struct drm_property *color_range_property; };
Quoted 3 lines
Quoted 1 line
Quoted 1 line
include/drm/drm_plane.h struct drm_plane { · line 595
Quoted 1 line
include/drm/drm_plane.h +0
-0#define obj_to_plane (x) container_of(x, struct drm_plane, base)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/8 drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
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.
--- drivers/gpu/drm/drm_color_mgmt.c | 1 + include/drm/drm_color_mgmt.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_color_mgmt.c +1 -0
@@ -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[] = {
include/drm/drm_color_mgmt.h +2 -1
@@ -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 , };
Signature · 6 lines
2.13.6 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/8] drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property
Quoted 27 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
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 <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>CC Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Cc Jyri Sarha <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 1 + include/drm/drm_color_mgmt.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_color_mgmt.c +0
-0
drivers/gpu/drm/drm_color_mgmt.c static const char * const color_encoding_name[] = { · line 360
Quoted 4 lines
drivers/gpu/drm/drm_color_mgmt.c +1
-0@@ -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...
Quoted 19 lines
drivers/gpu/drm/drm_color_mgmt.c +0
-0};static const char *const color_range_name[] = {include/drm/drm_color_mgmt.h +2
-1@@ -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 , };Signature · 1 line
2.13.6
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/8 drm/atomic: Include color encoding/range in plane state dump
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Include color_enconding and color_range in the plane state dump.
--- drivers/gpu/drm/drm_atomic.c | 4 ++++ drivers/gpu/drm/drm_color_mgmt.c | 16 ++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 ++ 3 files changed, 22 insertions(+)
drivers/gpu/drm/drm_atomic.c +4 -0
@@ -952,6 +952,10 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,drm_printf (p,"\tcrtc-pos=" DRM_RECT_FMT "\n" ,DRM_RECT_ARG (&dest));drm_printf (p,"\tsrc-pos=" DRM_RECT_FP_FMT "\n" ,DRM_RECT_FP_ARG (&src));drm_printf (p,"\trotation=%x\n" , state->rotation); +drm_printf (p,"\tcolor-encoding=%s\n" , +drm_get_color_encoding_name (state->color_encoding)); +drm_printf (p,"\tcolor-range=%s\n" , +drm_get_color_range_name (state->color_range));if (plane->funcs->atomic_print_state) plane->funcs->atomic_print_state (p, state);
drivers/gpu/drm/drm_color_mgmt.c +16 -0
@@ -365,6 +365,22 @@ static const char * const color_range_name[] = { [DRM_COLOR_YCBCR_LIMITED_RANGE] = "YCbCr limited range", }; +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding) +{ +if (WARN_ON (encoding >=ARRAY_SIZE (color_encoding_name))) +return "unknown" ; + +return color_encoding_name[encoding]; +} + +const char *drm_get_color_range_name (enum drm_color_range range) +{ +if (WARN_ON (range >=ARRAY_SIZE (color_range_name))) +return "unknown" ; + +return color_range_name[range]; +} +/** * drm_plane_create_color_properties - color encoding related plane properties * @supported_encodings: bitfield indicating supported color encodings
drivers/gpu/drm/drm_crtc_internal.h +2 -0
@@ -71,6 +71,8 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);/* drm_color_mgmt.c */ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding); +const char *drm_get_color_range_name (enum drm_color_range range);/* IOCTLs */ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
Signature · 6 lines
2.13.6 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/8] drm/atomic: Include color encoding/range in plane state dump
Quoted 40 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Include
color_encondingandcolor_rangein the plane state dump.Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Cc Jyri Sarha <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 4 ++++ drivers/gpu/drm/drm_color_mgmt.c | 16 ++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 ++ 3 files changed, 22 insertions(+)drivers/gpu/drm/drm_atomic.c +4
-0@@ -952,6 +952,10 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,drm_printf (p,"\tcrtc-pos=" DRM_RECT_FMT "\n" ,DRM_RECT_ARG (&dest));drm_printf (p,"\tsrc-pos=" DRM_RECT_FP_FMT "\n" ,DRM_RECT_FP_ARG (&src));drm_printf (p,"\trotation=%x\n" , state->rotation); +drm_printf (p,"\tcolor-encoding=%s\n" , +drm_get_color_encoding_name (state->color_encoding)); +drm_printf (p,"\tcolor-range=%s\n" , +drm_get_color_range_name (state->color_range));if (plane->funcs->atomic_print_state) plane->funcs->atomic_print_state (p, state);drivers/gpu/drm/drm_color_mgmt.c +0
-0
drivers/gpu/drm/drm_color_mgmt.c static const char * const color_range_name[] = { · line 367
Quoted 3 lines
drivers/gpu/drm/drm_color_mgmt.c +0
-0@@ -365,6 +365,22 @@ static const char * const color_range_name[] = { [DRM_COLOR_YCBCR_LIMITED_RANGE] = "YCbCr limited range", };
kerneldoc would be neat here ...
-Daniel
Quoted 35 lines
drivers/gpu/drm/drm_color_mgmt.c +16
-0+const char *drm_get_color_encoding_name (enum drm_color_encoding encoding) +{ +if (WARN_ON (encoding >=ARRAY_SIZE (color_encoding_name))) +return "unknown" ; + +return color_encoding_name[encoding]; +} + +const char *drm_get_color_range_name (enum drm_color_range range) +{ +if (WARN_ON (range >=ARRAY_SIZE (color_range_name))) +return "unknown" ; + +return color_range_name[range]; +} +/** * drm_plane_create_color_properties - color encoding related plane properties * @supported_encodings: bitfield indicating supported color encodings drivers/gpu/drm/drm_crtc_internal.h +2
-0@@ -71,6 +71,8 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);/* drm_color_mgmt.c */ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding); +const char *drm_get_color_range_name (enum drm_color_range range);/* IOCTLs */ int drm_mode_gamma_get_ioctl(struct drm_device *dev,Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/8 drm/atomic: Include color encoding/range in plane state dump
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Include color_enconding and color_range in the plane state dump.
v2: Add kerneldoc (danvet)
--- drivers/gpu/drm/drm_atomic.c | 4 ++++ drivers/gpu/drm/drm_color_mgmt.c | 30 ++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 ++ 3 files changed, 36 insertions(+)
drivers/gpu/drm/drm_atomic.c +4 -0
@@ -952,6 +952,10 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,drm_printf (p,"\tcrtc-pos=" DRM_RECT_FMT "\n" ,DRM_RECT_ARG (&dest));drm_printf (p,"\tsrc-pos=" DRM_RECT_FP_FMT "\n" ,DRM_RECT_FP_ARG (&src));drm_printf (p,"\trotation=%x\n" , state->rotation); +drm_printf (p,"\tcolor-encoding=%s\n" , +drm_get_color_encoding_name (state->color_encoding)); +drm_printf (p,"\tcolor-range=%s\n" , +drm_get_color_range_name (state->color_range));if (plane->funcs->atomic_print_state) plane->funcs->atomic_print_state (p, state);
drivers/gpu/drm/drm_color_mgmt.c +30 -0
@@ -367,6 +367,36 @@ static const char * const color_range_name[] = { };/** +* drm_get_color_encoding_name - return a string for color encoding +* @encoding: color encoding to compute name of +* +* In contrast to the other drm_get_*_name functions this one here returns a +* const pointer and hence is threadsafe. +*/ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding) +{ +if (WARN_ON (encoding >=ARRAY_SIZE (color_encoding_name))) +return "unknown" ; + +return color_encoding_name[encoding]; +} + +/** +* drm_get_color_range_name - return a string for color range +* @range: color range to compute name of +* +* In contrast to the other drm_get_*_name functions this one here returns a +* const pointer and hence is threadsafe. +*/ +const char *drm_get_color_range_name (enum drm_color_range range) +{ +if (WARN_ON (range >=ARRAY_SIZE (color_range_name))) +return "unknown" ; + +return color_range_name[range]; +} + +/** * drm_plane_create_color_properties - color encoding related plane properties * @plane: plane object * @supported_encodings: bitfield indicating supported color encodings
drivers/gpu/drm/drm_crtc_internal.h +2 -0
@@ -71,6 +71,8 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);/* drm_color_mgmt.c */ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding); +const char *drm_get_color_range_name (enum drm_color_range range);/* IOCTLs */ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
Signature · 6 lines
2.13.6 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 3/8] drm/atomic: Include color encoding/range in plane state dump
Quoted 6 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Include
color_encondingandcolor_rangein the plane state dump.v2: Add kerneldoc (danvet)
Quoted 10 lines
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Cc Jyri Sarha <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 78 lines
--- drivers/gpu/drm/drm_atomic.c | 4 ++++ drivers/gpu/drm/drm_color_mgmt.c | 30 ++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 ++ 3 files changed, 36 insertions(+)drivers/gpu/drm/drm_atomic.c +4
-0@@ -952,6 +952,10 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,drm_printf (p,"\tcrtc-pos=" DRM_RECT_FMT "\n" ,DRM_RECT_ARG (&dest));drm_printf (p,"\tsrc-pos=" DRM_RECT_FP_FMT "\n" ,DRM_RECT_FP_ARG (&src));drm_printf (p,"\trotation=%x\n" , state->rotation); +drm_printf (p,"\tcolor-encoding=%s\n" , +drm_get_color_encoding_name (state->color_encoding)); +drm_printf (p,"\tcolor-range=%s\n" , +drm_get_color_range_name (state->color_range));if (plane->funcs->atomic_print_state) plane->funcs->atomic_print_state (p, state);drivers/gpu/drm/drm_color_mgmt.c +30
-0@@ -367,6 +367,36 @@ static const char * const color_range_name[] = { };/** +* drm_get_color_encoding_name - return a string for color encoding +* @encoding: color encoding to compute name of +* +* In contrast to the other drm_get_*_name functions this one here returns a +* const pointer and hence is threadsafe. +*/ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding) +{ +if (WARN_ON (encoding >=ARRAY_SIZE (color_encoding_name))) +return "unknown" ; + +return color_encoding_name[encoding]; +} + +/** +* drm_get_color_range_name - return a string for color range +* @range: color range to compute name of +* +* In contrast to the other drm_get_*_name functions this one here returns a +* const pointer and hence is threadsafe. +*/ +const char *drm_get_color_range_name (enum drm_color_range range) +{ +if (WARN_ON (range >=ARRAY_SIZE (color_range_name))) +return "unknown" ; + +return color_range_name[range]; +} + +/** * drm_plane_create_color_properties - color encoding related plane properties * @plane: plane object * @supported_encodings: bitfield indicating supported color encodings drivers/gpu/drm/drm_crtc_internal.h +2
-0@@ -71,6 +71,8 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);/* drm_color_mgmt.c */ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding); +const char *drm_get_color_range_name (enum drm_color_range range);/* IOCTLs */ int drm_mode_gamma_get_ioctl(struct drm_device *dev,Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 3/8] drm/atomic: Include color encoding/range in plane state dump
In reply to Ville SyrjalaQuoted 6 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Include
color_encondingandcolor_rangein the plane state dump.v2: Add kerneldoc (danvet)
Quoted 10 lines
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Cc Jyri Sarha <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Latest patches for 1-3 are
Harry
Quoted 68 lines
--- drivers/gpu/drm/drm_atomic.c | 4 ++++ drivers/gpu/drm/drm_color_mgmt.c | 30 ++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 ++ 3 files changed, 36 insertions(+)drivers/gpu/drm/drm_atomic.c +4
-0@@ -952,6 +952,10 @@ static void drm_atomic_plane_print_state(struct drm_printer *p,drm_printf (p,"\tcrtc-pos=" DRM_RECT_FMT "\n" ,DRM_RECT_ARG (&dest));drm_printf (p,"\tsrc-pos=" DRM_RECT_FP_FMT "\n" ,DRM_RECT_FP_ARG (&src));drm_printf (p,"\trotation=%x\n" , state->rotation); +drm_printf (p,"\tcolor-encoding=%s\n" , +drm_get_color_encoding_name (state->color_encoding)); +drm_printf (p,"\tcolor-range=%s\n" , +drm_get_color_range_name (state->color_range));if (plane->funcs->atomic_print_state) plane->funcs->atomic_print_state (p, state);drivers/gpu/drm/drm_color_mgmt.c +30
-0@@ -367,6 +367,36 @@ static const char * const color_range_name[] = { };/** +* drm_get_color_encoding_name - return a string for color encoding +* @encoding: color encoding to compute name of +* +* In contrast to the other drm_get_*_name functions this one here returns a +* const pointer and hence is threadsafe. +*/ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding) +{ +if (WARN_ON (encoding >=ARRAY_SIZE (color_encoding_name))) +return "unknown" ; + +return color_encoding_name[encoding]; +} + +/** +* drm_get_color_range_name - return a string for color range +* @range: color range to compute name of +* +* In contrast to the other drm_get_*_name functions this one here returns a +* const pointer and hence is threadsafe. +*/ +const char *drm_get_color_range_name (enum drm_color_range range) +{ +if (WARN_ON (range >=ARRAY_SIZE (color_range_name))) +return "unknown" ; + +return color_range_name[range]; +} + +/** * drm_plane_create_color_properties - color encoding related plane properties * @plane: plane object * @supported_encodings: bitfield indicating supported color encodings drivers/gpu/drm/drm_crtc_internal.h +0
-0
drivers/gpu/drm/drm_crtc_internal.h int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, · line 78
Quoted 8 lines
drivers/gpu/drm/drm_crtc_internal.h +2
-0@@ -71,6 +71,8 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);/* drm_color_mgmt.c */ +const char *drm_get_color_encoding_name (enum drm_color_encoding encoding); +const char *drm_get_color_range_name (enum drm_color_range range);/* IOCTLs */ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/8 drm/i915: Correctly handle limited range YCbCr data on VLV/CHV
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Turns out the VLV/CHV fixed function sprite CSC expects full range data as input. We've been feeding it limited range data to it all along. To expand the data out to full range we'll use the color correction registers (brightness, contrast, and saturation).
On CHV pipe B we were actually doing the right thing already because we progammed the custom CSC matrix to do expect limited range input. Now that well pre-expand the data out with the color correction unit, we need to change the CSC matrix to operate with full range input instead.
This should make the sprite output of the other pipes match the sprite output of pipe B reasonably well. Looking at the resulting pipe CRCs, there can be a slight difference in the output, but as I don't know the formula used by the fixed function CSC of the other pipes, I don't think it's worth the effort to try to match the output exactly. It might not even be possible due to difference in internal precision etc.
One slight caveat here is that the color correction registers are single bufferred, so we should really be updating them during vblank, but we still don't have a mechanism for that, so just toss in another FIXME.
v2: Rebase
v3: s/bri/brightness/ s/con/contrast/ (Shashank)
v4: Clarify the constants and math (Shashank)
--- drivers/gpu/drm/i915/i915_reg.h | 10 +++++ drivers/gpu/drm/i915/intel_sprite.c | 81 ++++++++++++++++++++++++++++--------- 2 files changed, 73 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +10 -0
@@ -6305,6 +6305,12 @@ enum {#define _SPATILEOFF (VLV_DISPLAY_BASE + 0x721a4)#define _SPACONSTALPHA (VLV_DISPLAY_BASE + 0x721a8)#define SP_CONST_ALPHA_ENABLE (1<<31) +#define _SPACLRC0 (VLV_DISPLAY_BASE + 0x721d0) +#define SP_CONTRAST (x) ((x) << 18)/* u3.6 */ +#define SP_BRIGHTNESS (x) ((x) & 0xff)/* s8 */ +#define _SPACLRC1 (VLV_DISPLAY_BASE + 0x721d4) +#define SP_SH_SIN (x) (((x) & 0x7ff) << 16)/* s4.7 */ +#define SP_SH_COS (x) (x)/* u3.7 */ #define _SPAGAMC (VLV_DISPLAY_BASE + 0x721f4)#define _SPBCNTR (VLV_DISPLAY_BASE + 0x72280)
@@ -6318,6 +6324,8 @@ enum {#define _SPBKEYMAXVAL (VLV_DISPLAY_BASE + 0x722a0)#define _SPBTILEOFF (VLV_DISPLAY_BASE + 0x722a4)#define _SPBCONSTALPHA (VLV_DISPLAY_BASE + 0x722a8) +#define _SPBCLRC0 (VLV_DISPLAY_BASE + 0x722d0) +#define _SPBCLRC1 (VLV_DISPLAY_BASE + 0x722d4)#define _SPBGAMC (VLV_DISPLAY_BASE + 0x722f4)#define _MMIO_VLV_SPR (pipe, plane_id, reg_a, reg_b) \
@@ -6334,6 +6342,8 @@ enum {#define SPKEYMAXVAL (pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAKEYMAXVAL, _SPBKEYMAXVAL)#define SPTILEOFF (pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPATILEOFF, _SPBTILEOFF)#define SPCONSTALPHA (pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACONSTALPHA, _SPBCONSTALPHA) +#define SPCLRC0 (pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC0, _SPBCLRC0) +#define SPCLRC1 (pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC1, _SPBCLRC1)#define SPGAMC (pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPAGAMC, _SPBGAMC)/*
drivers/gpu/drm/i915/intel_sprite.c +63 -18
115 lines not on this page · raw message
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/8 drm/i915: Fix plane YCbCr->RGB conversion for GLK
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
On GLK the plane CSC controls moved into the COLOR_CTL register. Update the code to progam the YCbCr->RGB CSC mode correctly when faced with an YCbCr framebuffer.
The spec is rather confusing as it calls the mode "YUV601 to RGB709". I'm going to assume that just means it's going to use the YCbCr->RGB matrix as specified in BT.601 and doesn't actually change the gamut.
--- drivers/gpu/drm/i915/i915_reg.h | 5 +++++ drivers/gpu/drm/i915/intel_display.c | 3 +++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_sprite.c | 10 +++++----- 4 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +5 -0
@@ -6463,6 +6463,11 @@ enum {#define _PLANE_COLOR_CTL_3_A 0x703CC/* GLK+ */ #define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_COLOR_CSC_MODE_BYPASS (0 << 17) +#define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 (1 << 17) +#define PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709 (2 << 17) +#define PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020 (3 << 17) +#define PLANE_COLOR_CSC_MODE_RGB709_TO_RGB2020 (4 << 17)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13)#define PLANE_COLOR_ALPHA_MASK (0x3 << 4)#define PLANE_COLOR_ALPHA_DISABLE (0 << 4)
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -3573,6 +3573,9 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); +if (intel_format_is_yuv (fb->format->format)) + plane_color_ctl |=PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 ; +return plane_color_ctl; }
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1591,6 +1591,7 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); +u32 glk_color_ctl (const struct intel_plane_state *plane_state);u32 skl_plane_stride (const struct drm_framebuffer *fb,int plane,unsigned int rotation); int skl_check_plane_surface(const struct intel_crtc_state *crtc_state,
@@ -2016,6 +2017,7 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,/* intel_sprite.c */ +bool intel_format_is_yuv (u32 format);int intel_usecs_to_scanlines (const struct drm_display_mode *adjusted_mode,int usecs); struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_sprite.c +5 -5
@@ -41,8 +41,7 @@#include <drm/i915_drm.h> #include "i915_drv.h" -static bool -format_is_yuv (uint32_t format) +bool intel_format_is_yuv (u32 format) {switch (format) {case DRM_FORMAT_YUYV :
@@ -266,6 +265,7 @@ skl_update_plane(struct intel_plane *plane,if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv))I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), plane_state->color_ctl); +if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);
@@ -354,7 +354,7 @@ chv_update_csc(const struct intel_plane_state *plane_state)enum plane_id plane_id = plane->id;/* Seems RGB data bypasses the CSC always */ -if (!format_is_yuv (fb->format->format)) +if (!intel_format_is_yuv (fb->format->format))return ;/*
@@ -399,7 +399,7 @@ vlv_update_clrc(const struct intel_plane_state *plane_state)enum plane_id plane_id = plane->id;int contrast, brightness, sh_scale, sh_sin, sh_cos; -if (format_is_yuv (fb->format->format)) { +if (intel_format_is_yuv (fb->format->format)) {/* * Expand limited range to full range: * Contrast is applied first and is used to expand Y range.
@@ -1024,7 +1024,7 @@ intel_check_sprite_plane(struct intel_plane *plane, src_y = src->y1 >>16 ; src_h =drm_rect_height (src) >>16 ; -if (format_is_yuv (fb->format->format)) { +if (intel_format_is_yuv (fb->format->format)) { src_x &= ~1 ; src_w &= ~1 ;
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 5/8] drm/i915: Fix plane YCbCr->RGB conversion for GLK
Quoted 10 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
On GLK the plane CSC controls moved into the
COLOR_CTLregister. Update the code to progam theYCbCr->RGBCSC mode correctly when faced with an YCbCr framebuffer.The spec is rather confusing as it calls the mode "YUV601 to RGB709". I'm going to assume that just means it's going to use the
YCbCr->RGBmatrix as specified in BT.601 and doesn't actually change the gamut.
Quoted 9 lines
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Matches the spec, so:
I asked for clarification in the spec about the BT.601 vs. 709 oddity you noticed.
Quoted 113 lines
--- drivers/gpu/drm/i915/i915_reg.h | 5 +++++ drivers/gpu/drm/i915/intel_display.c | 3 +++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_sprite.c | 10 +++++----- 4 files changed, 15 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/i915_reg.h +5
-0@@ -6463,6 +6463,11 @@ enum {#define _PLANE_COLOR_CTL_3_A 0x703CC/* GLK+ */ #define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23) +#define PLANE_COLOR_CSC_MODE_BYPASS (0 << 17) +#define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 (1 << 17) +#define PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709 (2 << 17) +#define PLANE_COLOR_CSC_MODE_YUV2020_TO_RGB2020 (3 << 17) +#define PLANE_COLOR_CSC_MODE_RGB709_TO_RGB2020 (4 << 17)#define PLANE_COLOR_PLANE_GAMMA_DISABLE (1 << 13)#define PLANE_COLOR_ALPHA_MASK (0x3 << 4)#define PLANE_COLOR_ALPHA_DISABLE (0 << 4)drivers/gpu/drm/i915/intel_display.c +3
-0@@ -3573,6 +3573,9 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); +if (intel_format_is_yuv (fb->format->format)) + plane_color_ctl |=PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 ; +return plane_color_ctl; }drivers/gpu/drm/i915/intel_drv.h +2
-0@@ -1591,6 +1591,7 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, const struct intel_plane_state *plane_state);u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state,const struct intel_plane_state *plane_state); +u32 glk_color_ctl (const struct intel_plane_state *plane_state);u32 skl_plane_stride (const struct drm_framebuffer *fb,int plane,unsigned int rotation); int skl_check_plane_surface(const struct intel_crtc_state *crtc_state,@@ -2016,6 +2017,7 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,/* intel_sprite.c */ +bool intel_format_is_yuv (u32 format);int intel_usecs_to_scanlines (const struct drm_display_mode *adjusted_mode,int usecs); struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,drivers/gpu/drm/i915/intel_sprite.c +5
-5@@ -41,8 +41,7 @@#include <drm/i915_drm.h> #include "i915_drv.h" -static bool -format_is_yuv (uint32_t format) +bool intel_format_is_yuv (u32 format) {switch (format) {case DRM_FORMAT_YUYV :@@ -266,6 +265,7 @@ skl_update_plane(struct intel_plane *plane,if (INTEL_GEN (dev_priv) >=10 ||IS_GEMINILAKE (dev_priv))I915_WRITE_FW (PLANE_COLOR_CTL (pipe, plane_id), plane_state->color_ctl); +if (key->flags) {I915_WRITE_FW (PLANE_KEYVAL (pipe, plane_id), key->min_value);I915_WRITE_FW (PLANE_KEYMAX (pipe, plane_id), key->max_value);@@ -354,7 +354,7 @@ chv_update_csc(const struct intel_plane_state *plane_state)enum plane_id plane_id = plane->id;/* Seems RGB data bypasses the CSC always */ -if (!format_is_yuv (fb->format->format)) +if (!intel_format_is_yuv (fb->format->format))return ;/* @@ -399,7 +399,7 @@ vlv_update_clrc(const struct intel_plane_state *plane_state)enum plane_id plane_id = plane->id;int contrast, brightness, sh_scale, sh_sin, sh_cos; -if (format_is_yuv (fb->format->format)) { +if (intel_format_is_yuv (fb->format->format)) {/* * Expand limited range to full range: * Contrast is applied first and is used to expand Y range. @@ -1024,7 +1024,7 @@ intel_check_sprite_plane(struct intel_plane *plane, src_y = src->y1 >>16 ; src_h =drm_rect_height (src) >>16 ; -if (format_is_yuv (fb->format->format)) { +if (intel_format_is_yuv (fb->format->format)) { src_x &= ~1 ; src_w &= ~1 ;Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/8 drm/i915: Add support for the YCbCr COLOR_ENCODING property
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Add support for the COLOR_ENCODING plane property which selects the matrix coefficients used for the YCbCr->RGB conversion. Our hardware can generally handle BT.601 and BT.709.
CHV pipe B sprites have a fully programmable matrix, so in theory we could handle anything, but it doesn't seem all that useful to expose anything beyond BT.601 and BT.709 at this time.
GLK can supposedly do BT.2020, but let's leave enabling that for the future as well.
v2: Rename bit defines to match the spec more closely (Shashank)
--- drivers/gpu/drm/i915/i915_reg.h | 5 ++- drivers/gpu/drm/i915/intel_display.c | 19 +++++++++-- drivers/gpu/drm/i915/intel_sprite.c | 61 +++++++++++++++++++++++++++--------- 3 files changed, 67 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -1
@@ -6140,6 +6140,7 @@ enum {#define DVS_PIPE_CSC_ENABLE (1<<24)#define DVS_SOURCE_KEY (1<<22)#define DVS_RGB_ORDER_XBGR (1<<20) +#define DVS_YUV_FORMAT_BT709 (1<<18)#define DVS_YUV_BYTE_ORDER_MASK (3<<16)#define DVS_YUV_ORDER_YUYV (0<<16)#define DVS_YUV_ORDER_UYVY (1<<16)
@@ -6210,7 +6211,7 @@ enum {#define SPRITE_SOURCE_KEY (1<<22)#define SPRITE_RGB_ORDER_RGBX (1<<20)/* only for 888 and 161616 */ #define SPRITE_YUV_TO_RGB_CSC_DISABLE (1<<19) -#define SPRITE_YUV_CSC_FORMAT_BT709 (1<<18)/* 0 is BT601 */ +#define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 (1<<18)/* 0 is BT601 */ #define SPRITE_YUV_BYTE_ORDER_MASK (3<<16)#define SPRITE_YUV_ORDER_YUYV (0<<16)#define SPRITE_YUV_ORDER_UYVY (1<<16)
@@ -6286,6 +6287,7 @@ enum {#define SP_FORMAT_RGBA8888 (0xf<<26)#define SP_ALPHA_PREMULTIPLY (1<<23)/* CHV pipe B */ #define SP_SOURCE_KEY (1<<22) +#define SP_YUV_FORMAT_BT709 (1<<18)#define SP_YUV_BYTE_ORDER_MASK (3<<16)#define SP_YUV_ORDER_YUYV (0<<16)#define SP_YUV_ORDER_UYVY (1<<16)
@@ -6410,6 +6412,7 @@ enum {#define PLANE_CTL_KEY_ENABLE_DESTINATION ( 2 << 21)#define PLANE_CTL_ORDER_BGRX (0 << 20)#define PLANE_CTL_ORDER_RGBX (1 << 20) +#define PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 (1 << 18)#define PLANE_CTL_YUV422_ORDER_MASK (0x3 << 16)#define PLANE_CTL_YUV422_YUYV ( 0 << 16)#define PLANE_CTL_YUV422_UYVY ( 1 << 16)
drivers/gpu/drm/i915/intel_display.c +17 -2
@@ -3544,6 +3544,9 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,PLANE_CTL_PIPE_GAMMA_ENABLE |PLANE_CTL_PIPE_CSC_ENABLE |PLANE_CTL_PLANE_GAMMA_DISABLE ; + +if (plane_state->base.color_encoding ==DRM_COLOR_YCBCR_BT709 ) + plane_ctl |=PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 ; } plane_ctl |=skl_plane_ctl_format (fb->format->format);
@@ -3573,8 +3576,12 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, plane_color_ctl |=PLANE_COLOR_PLANE_GAMMA_DISABLE ; plane_color_ctl |=glk_plane_color_ctl_alpha (fb->format->format); -if (intel_format_is_yuv (fb->format->format)) - plane_color_ctl |=PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 ; +if (intel_format_is_yuv (fb->format->format)) { +if (plane_state->base.color_encoding ==DRM_COLOR_YCBCR_BT709 ) + plane_color_ctl |=PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709 ; +else + plane_color_ctl |=PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 ; + }return plane_color_ctl; }
@@ -13314,6 +13321,14 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)DRM_MODE_ROTATE_0 , supported_rotations); +if (INTEL_GEN (dev_priv) >=9 ) +drm_plane_create_color_properties (&primary->base, +BIT (DRM_COLOR_YCBCR_BT601 ) | +BIT (DRM_COLOR_YCBCR_BT709 ), +BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ), +DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_LIMITED_RANGE ); +drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs);return primary;
drivers/gpu/drm/i915/intel_sprite.c +46 -15
100 lines not on this page · raw message
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/8 drm/i915: Change the COLOR_ENCODING prop default value to BT.709
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Bring us forward from the stone age and switch our default YCbCr->RGB conversion matrix to BT.709 from BT.601. I would expect most matrial to be BT.709 these days.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_sprite.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -13326,7 +13326,7 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)BIT (DRM_COLOR_YCBCR_BT601 ) |BIT (DRM_COLOR_YCBCR_BT709 ),BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ), -DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , DRM_COLOR_YCBCR_LIMITED_RANGE);drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs);
drivers/gpu/drm/i915/intel_sprite.c +1 -1
@@ -1532,7 +1532,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,BIT (DRM_COLOR_YCBCR_BT601 ) |BIT (DRM_COLOR_YCBCR_BT709 ),BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ), -DRM_COLOR_YCBCR_BT601 , +DRM_COLOR_YCBCR_BT709 , DRM_COLOR_YCBCR_LIMITED_RANGE);drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs);
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/8 drm/i915: Add support for the YCbCr COLOR_RANGE property
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Add support for the COLOR_RANGE property on planes. This property selects whether the input YCbCr data is to treated as limited range or full range.
On most platforms this is a matter of setting the "YUV range correction disable" bit, and on VLV/CHV we'll just have to program the color correction logic to pass the data through unmodified.
v2: Rebase
--- drivers/gpu/drm/i915/i915_reg.h | 4 ++++ drivers/gpu/drm/i915/intel_display.c | 9 ++++++++- drivers/gpu/drm/i915/intel_sprite.c | 12 ++++++++++-- 3 files changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -0
@@ -6132,6 +6132,7 @@ enum {#define _DVSACNTR 0x72180#define DVS_ENABLE (1<<31)#define DVS_GAMMA_ENABLE (1<<30) +#define DVS_YUV_RANGE_CORRECTION_DISABLE (1<<27)#define DVS_PIXFORMAT_MASK (3<<25)#define DVS_FORMAT_YUV422 (0<<25)#define DVS_FORMAT_RGBX101010 (1<<25)
@@ -6200,6 +6201,7 @@ enum {#define _SPRA_CTL 0x70280#define SPRITE_ENABLE (1<<31)#define SPRITE_GAMMA_ENABLE (1<<30) +#define SPRITE_YUV_RANGE_CORRECTION_DISABLE (1<<28)#define SPRITE_PIXFORMAT_MASK (7<<25)#define SPRITE_FORMAT_YUV422 (0<<25)#define SPRITE_FORMAT_RGBX101010 (1<<25)
@@ -6391,6 +6393,7 @@ enum {#define _PLANE_CTL_3_A 0x70380#define PLANE_CTL_ENABLE (1 << 31)#define PLANE_CTL_PIPE_GAMMA_ENABLE (1 << 30)/* Pre-GLK */ +#define PLANE_CTL_YUV_RANGE_CORRECTION_DISABLE (1 << 28)/* * ICL+ uses the same PLANE_CTL_FORMAT bits, but the field definition * expanded to include bit 23 as well. However, the shift-24 based values
@@ -6465,6 +6468,7 @@ enum {#define _PLANE_COLOR_CTL_2_A 0x702CC/* GLK+ */ #define _PLANE_COLOR_CTL_3_A 0x703CC/* GLK+ */ #define PLANE_COLOR_PIPE_GAMMA_ENABLE (1 << 30) +#define PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE (1 << 28)#define PLANE_COLOR_PIPE_CSC_ENABLE (1 << 23)#define PLANE_COLOR_CSC_MODE_BYPASS (0 << 17)#define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 (1 << 17)
drivers/gpu/drm/i915/intel_display.c +8 -1
@@ -3547,6 +3547,9 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,if (plane_state->base.color_encoding ==DRM_COLOR_YCBCR_BT709 ) plane_ctl |=PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 ; + +if (plane_state->base.color_range ==DRM_COLOR_YCBCR_FULL_RANGE ) + plane_ctl |=PLANE_CTL_YUV_RANGE_CORRECTION_DISABLE ; } plane_ctl |=skl_plane_ctl_format (fb->format->format);
@@ -3581,6 +3584,9 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state, plane_color_ctl |=PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709 ; else plane_color_ctl |= PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709; + +if (plane_state->base.color_range ==DRM_COLOR_YCBCR_FULL_RANGE ) + plane_color_ctl |=PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE ; }return plane_color_ctl;
@@ -13325,7 +13331,8 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)drm_plane_create_color_properties (&primary->base,BIT (DRM_COLOR_YCBCR_BT601 ) |BIT (DRM_COLOR_YCBCR_BT709 ), -BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ), +BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ) | +BIT (DRM_COLOR_YCBCR_FULL_RANGE ),DRM_COLOR_YCBCR_BT709 ,DRM_COLOR_YCBCR_LIMITED_RANGE );
drivers/gpu/drm/i915/intel_sprite.c +10 -2
@@ -414,7 +414,8 @@ vlv_update_clrc(const struct intel_plane_state *plane_state)enum plane_id plane_id = plane->id;int contrast, brightness, sh_scale, sh_sin, sh_cos; -if (intel_format_is_yuv (fb->format->format)) { +if (intel_format_is_yuv (fb->format->format) && + plane_state->base.color_range ==DRM_COLOR_YCBCR_LIMITED_RANGE ) {/* * Expand limited range to full range: * Contrast is applied first and is used to expand Y range.
@@ -650,6 +651,9 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state,if (plane_state->base.color_encoding ==DRM_COLOR_YCBCR_BT709 ) sprctl |=SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 ; +if (plane_state->base.color_range ==DRM_COLOR_YCBCR_FULL_RANGE ) + sprctl |=SPRITE_YUV_RANGE_CORRECTION_DISABLE ; +if (fb->modifier ==I915_FORMAT_MOD_X_TILED ) sprctl |=SPRITE_TILED ;
@@ -809,6 +813,9 @@ static u32 g4x_sprite_ctl(const struct intel_crtc_state *crtc_state,if (plane_state->base.color_encoding ==DRM_COLOR_YCBCR_BT709 ) dvscntr |=DVS_YUV_FORMAT_BT709 ; +if (plane_state->base.color_range ==DRM_COLOR_YCBCR_FULL_RANGE ) + dvscntr |=DVS_YUV_RANGE_CORRECTION_DISABLE ; +if (fb->modifier ==I915_FORMAT_MOD_X_TILED ) dvscntr |=DVS_TILED ;
@@ -1531,7 +1538,8 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,drm_plane_create_color_properties (&intel_plane->base,BIT (DRM_COLOR_YCBCR_BT601 ) |BIT (DRM_COLOR_YCBCR_BT709 ), -BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ), +BIT (DRM_COLOR_YCBCR_LIMITED_RANGE ) | +BIT (DRM_COLOR_YCBCR_FULL_RANGE ),DRM_COLOR_YCBCR_BT709 ,DRM_COLOR_YCBCR_LIMITED_RANGE );
Signature · 6 lines
2.13.6 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
URL : https://patchwork.freedesktop.org/series/38286/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip fe775e9df8ef drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane -:67: WARNING: please, no space before tabs #67: FILE: drivers/gpu/drm/drm_color_mgmt.c:96: + * ^IOptional plane enum property to support different non RGB$
-:68: WARNING: please, no space before tabs
#68: FILE: drivers/gpu/drm/drm_color_mgmt.c:97:
+ * ^Icolor encodings. The driver can provide a subset of standard$
-:69: WARNING: please, no space before tabs
#69: FILE: drivers/gpu/drm/drm_color_mgmt.c:98:
+ * ^Ienum values supported by the DRM plane.$
-:72: WARNING: please, no space before tabs
#72: FILE: drivers/gpu/drm/drm_color_mgmt.c:101:
+ * ^IOptional plane enum property to support different non RGB$
-:73: WARNING: please, no space before tabs
#73: FILE: drivers/gpu/drm/drm_color_mgmt.c:102:
+ * ^Icolor parameter ranges. The driver can provide a subset of$
-:74: WARNING: please, no space before tabs #74: FILE: drivers/gpu/drm/drm_color_mgmt.c:103:
+ * ^Istandard enum values supported by the DRM plane.$
total: 0 errors, 6 warnings, 0 checks, 175 lines checked970627907fcd drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property -:34: WARNING: line over 80 characters
#34: FILE: drivers/gpu/drm/drm_color_mgmt.c:360:
+ [DRM_COLOR_YCBCR_BT2020_CONST] = "ITU-R BT.2020 YCbCr constant luminance",
total: 0 errors, 1 warnings, 0 checks, 16 lines checked d286b7a4cbb9 drm/atomic: Include color encoding/range in plane state dump c9445dd9d6eb drm/i915: Correctly handle limited range YCbCr data on VLV/CHV -:81: WARNING: line over 80 characters
#81: FILE: drivers/gpu/drm/i915/i915_reg.h:6345:
+#define SPCLRC0(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC0, _SPBCLRC0)
-:82: WARNING: line over 80 characters
#82: FILE: drivers/gpu/drm/i915/i915_reg.h:6346:
+#define SPCLRC1(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC1, _SPBCLRC1)
-:142: WARNING: line over 80 characters #142: FILE: drivers/gpu/drm/i915/intel_sprite.c:380:
+ I915_WRITE_FW(SPCSCYGICLAMP(plane_id), SPCSC_IMAX(1023) | SPCSC_IMIN(0));
-:143: WARNING: line over 80 characters #143: FILE: drivers/gpu/drm/i915/intel_sprite.c:381:
+ I915_WRITE_FW(SPCSCCBICLAMP(plane_id), SPCSC_IMAX(512) | SPCSC_IMIN(-512));
-:144: WARNING: line over 80 characters #144: FILE: drivers/gpu/drm/i915/intel_sprite.c:382:
+ I915_WRITE_FW(SPCSCCRICLAMP(plane_id), SPCSC_IMAX(512) | SPCSC_IMIN(-512));
total: 0 errors, 5 warnings, 0 checks, 143 lines checked 956e75f5dfb0 drm/i915: Fix plane YCbCr->RGB conversion for GLK -:36: CHECK: Prefer using the BIT macro
#36: FILE: drivers/gpu/drm/i915/i915_reg.h:6467:
+#define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 (1 << 17)
total: 0 errors, 0 warnings, 1 checks, 74 lines checked 19bc29ea8f95 drm/i915: Add support for the YCbCr COLOR_ENCODING property -:42: CHECK: spaces preferred around that '<<' (ctx:VxV) #42: FILE: drivers/gpu/drm/i915/i915_reg.h:6143:
+#define DVS_YUV_FORMAT_BT709 (1<<18)
^
-:42: CHECK: Prefer using the BIT macro
#42: FILE: drivers/gpu/drm/i915/i915_reg.h:6143:
+#define DVS_YUV_FORMAT_BT709 (1<<18)
-:51: CHECK: spaces preferred around that '<<' (ctx:VxV) #51: FILE: drivers/gpu/drm/i915/i915_reg.h:6214:
+#define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 (1<<18) /* 0 is BT601 */
^
-:51: CHECK: Prefer using the BIT macro
#51: FILE: drivers/gpu/drm/i915/i915_reg.h:6214:
+#define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 (1<<18) /* 0 is BT601 */
-:59: CHECK: spaces preferred around that '<<' (ctx:VxV) #59: FILE: drivers/gpu/drm/i915/i915_reg.h:6290:
+#define SP_YUV_FORMAT_BT709 (1<<18)
^
-:59: CHECK: Prefer using the BIT macro
#59: FILE: drivers/gpu/drm/i915/i915_reg.h:6290:
+#define SP_YUV_FORMAT_BT709 (1<<18)
-:67: CHECK: Prefer using the BIT macro
#67: FILE: drivers/gpu/drm/i915/i915_reg.h:6415:
+#define PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 (1 << 18)
-:93: WARNING: line over 80 characters
#93: FILE: drivers/gpu/drm/i915/intel_display.c:3581:
+ plane_color_ctl |= PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709;
-:95: WARNING: line over 80 characters
#95: FILE: drivers/gpu/drm/i915/intel_display.c:3583:
+ plane_color_ctl |= PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709;
-:108: WARNING: line over 80 characters
#108: FILE: drivers/gpu/drm/i915/intel_display.c:13328:
+ BIT(DRM_COLOR_YCBCR_LIMITED_RANGE),
-:110: WARNING: line over 80 characters
#110: FILE: drivers/gpu/drm/i915/intel_display.c:13330:
+ DRM_COLOR_YCBCR_LIMITED_RANGE);
total: 0 errors, 4 warnings, 7 checks, 166 lines checked e2c49a51ad72 drm/i915: Change the COLOR_ENCODING prop default value to BT.709 b9af44b33bda drm/i915: Add support for the YCbCr COLOR_RANGE property -:39: CHECK: spaces preferred around that '<<' (ctx:VxV)
#39: FILE: drivers/gpu/drm/i915/i915_reg.h:6135:
+#define DVS_YUV_RANGE_CORRECTION_DISABLE (1<<27)
^
-:39: CHECK: Prefer using the BIT macro
#39: FILE: drivers/gpu/drm/i915/i915_reg.h:6135:
+#define DVS_YUV_RANGE_CORRECTION_DISABLE (1<<27)
-:47: CHECK: spaces preferred around that '<<' (ctx:VxV) #47: FILE: drivers/gpu/drm/i915/i915_reg.h:6204:
+#define SPRITE_YUV_RANGE_CORRECTION_DISABLE (1<<28)
^
-:47: CHECK: Prefer using the BIT macro
#47: FILE: drivers/gpu/drm/i915/i915_reg.h:6204:
+#define SPRITE_YUV_RANGE_CORRECTION_DISABLE (1<<28)
-:55: CHECK: Prefer using the BIT macro
#55: FILE: drivers/gpu/drm/i915/i915_reg.h:6396:
+#define PLANE_CTL_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
-:63: CHECK: Prefer using the BIT macro
#63: FILE: drivers/gpu/drm/i915/i915_reg.h:6471:
+#define PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
-:87: WARNING: line over 80 characters
#87: FILE: drivers/gpu/drm/i915/intel_display.c:3589:
+ plane_color_ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
-:96: WARNING: line over 80 characters
#96: FILE: drivers/gpu/drm/i915/intel_display.c:13334:
+ BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
-:97: WARNING: line over 80 characters
#97: FILE: drivers/gpu/drm/i915/intel_display.c:13335:
+ BIT(DRM_COLOR_YCBCR_FULL_RANGE),
total: 0 errors, 3 warnings, 6 checks, 91 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.SPARSE: warning for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
URL : https://patchwork.freedesktop.org/series/38286/
State : warning
== Summary ==
$ dim sparse origin/drm-tip Commit: drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane +drivers/gpu/drm/drm_color_mgmt.c:388:45: warning: Variable length array is used.
Commit: drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property Okay!
Commit: drm/atomic: Include color encoding/range in plane state dump Okay!
Commit: drm/i915: Correctly handle limited range YCbCr data on VLV/CHV Okay!
Commit: drm/i915: Fix plane YCbCr->RGB conversion for GLK Okay!
Commit: drm/i915: Add support for the YCbCr COLOR_ENCODING property Okay!
Commit: drm/i915: Change the COLOR_ENCODING prop default value to BT.709 Okay!
Commit: drm/i915: Add support for the YCbCr COLOR_RANGE property Okay!
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
URL : https://patchwork.freedesktop.org/series/38286/
State : success
== Summary ==
Series 38286v1 drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
https://patchwork.freedesktop.org/api/1.0/series/38286/revisions/1/mbox/
Test kms_force_connector_basic:
Subgroup force-connector-state:
skip -> PASS (fi-snb-2520m)
Subgroup force-edid:
skip -> PASS (fi-snb-2520m)
Subgroup force-load-detect:
skip -> PASS (fi-snb-2520m)
Subgroup prune-stale-modes:
skip -> PASS (fi-snb-2520m)fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:420s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:425s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:379s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:495s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:287s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:482s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:484s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:475s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:456s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:571s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:582s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:417s fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:282s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:508s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:390s fi-ilk-650 total:288 pass:227 dwarn:0 dfail:0 fail:1 skip:60 time:410s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:459s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:415s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:458s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:494s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:497s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:590s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:433s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:511s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:526s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:492s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:481s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:415s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:430s fi-snb-2520m total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:516s fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:394s Blacklisted hosts: fi-glk-dsi total:288 pass:180 dwarn:1 dfail:4 fail:0 skip:103 time:771s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:453s
1cf237a2160af1a670d75523e073ff8614780b99 drm-tip: 2018y-02m-14d-19h-43m-47s UTC integration manifest b9af44b33bda drm/i915: Add support for the YCbCr COLOR_RANGE propertye2c49a51ad72 drm/i915: Change the COLOR_ENCODING prop default value to BT.709 19bc29ea8f95 drm/i915: Add support for the YCbCr COLOR_ENCODING property 956e75f5dfb0 drm/i915: Fix plane YCbCr->RGB conversion for GLKc9445dd9d6eb drm/i915: Correctly handle limited range YCbCr data on VLV/CHV d286b7a4cbb9 drm/atomic: Include color encoding/range in plane state dump 970627907fcd drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property fe775e9df8ef drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8030/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
URL : https://patchwork.freedesktop.org/series/38286/
State : success
== Summary ==
Test gem_eio:
Subgroup hibernate:
incomplete -> PASS (shard-hsw) fdo#103540
Test kms_flip:
Subgroup flip-vs-expired-vblank:
fail -> PASS (shard-apl) fdo#102887
Subgroup plain-flip-ts-check-interruptible:
fail -> PASS (shard-hsw) fdo#100368
Test kms_sysfs_edid_timing:
warn -> PASS (shard-apl) fdo#100047
Test kms_fbcon_fbt:
Subgroup fbc-suspend:
pass -> SKIP (shard-hsw) fdo#105087fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#105087 https://bugs.freedesktop.org/show_bug.cgi?id=105087
shard-apl total:3414 pass:1774 dwarn:1 dfail:0 fail:20 skip:1618 time:13764s shard-hsw total:3427 pass:1758 dwarn:1 dfail:0 fail:10 skip:1657 time:14560s shard-snb total:3427 pass:1347 dwarn:1 dfail:0 fail:11 skip:2068 time:7587s
Blacklisted hosts:
shard-kbl total:3377 pass:1852 dwarn:23 dfail:1 fail:21 skip:1479 time:10765s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8030/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Here's a refresh of Jyri's
COLOR_ENCODINGandCOLOR_RANGEproperties, and the i915 implementation I did on top. I tossed in a few core updates as well: plane state dump, and the BT.2020 constant luminance variant.
Quoted 6 lines
Apparently nouveau is already exposing a "
iturbt_709" bool property which allows one to choose between BT.601 and BT.709 encodings, but given that we want at least BT.2020 in addition I don't think that property is good enough. Trying to implement it, and somehow extend it beyond BT.601 vs. BT.709 seems like wasted effort. Hence I think we should just ignore it and move on.
Yeah, with those legacy props in various kernels I think it's best if we ignore them, and leave the burden of figuring out compatibility interactions to the driver that went their own way. I'll ping Illia as fyi on irc at least.
-Daniel
Quoted 42 lines
My userspace implementation in the form of intel ddx
XV_COLORSPACEattribute:
https://patchwork.freedesktop.org/patch/204696/Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Jyri Sarha (1):
drm: Add optionalCOLOR_ENCODINGandCOLOR_RANGEproperties to
drm_planeVille Syrjälä (7):
drm: Add BT.2020 constant luminance enum value for theCOLOR_ENCODING
property
drm/atomic: Include color encoding/range in plane state dump drm/i915: Correctly handle limited range YCbCr data on VLV/CHV drm/i915: Fix planeYCbCr->RGBconversion for GLK drm/i915: Add support for the YCbCrCOLOR_ENCODINGproperty drm/i915: Change theCOLOR_ENCODINGprop default value to BT.709 drm/i915: Add support for the YCbCrCOLOR_RANGEpropertydrivers/gpu/drm/drm_atomic.c | 12 ++++ drivers/gpu/drm/drm_color_mgmt.c | 108 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 24 ++++++- drivers/gpu/drm/i915/intel_display.c | 25 +++++++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_sprite.c | 134 ++++++++++++++++++++++++++++------- include/drm/drm_color_mgmt.h | 20 ++++++ include/drm/drm_plane.h | 8 +++ 9 files changed, 309 insertions(+), 26 deletions(-)Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 14 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Here's a refresh of Jyri's
COLOR_ENCODINGandCOLOR_RANGEproperties, and the i915 implementation I did on top. I tossed in a few core updates as well: plane state dump, and the BT.2020 constant luminance variant.Apparently nouveau is already exposing a "
iturbt_709" bool property which allows one to choose between BT.601 and BT.709 encodings, but given that we want at least BT.2020 in addition I don't think that property is good enough. Trying to implement it, and somehow extend it beyond BT.601 vs. BT.709 seems like wasted effort. Hence I think we should just ignore it and move on.
Quoted 3 lines
My userspace implementation in the form of intel ddx
XV_COLORSPACEattribute:
https://patchwork.freedesktop.org/patch/204696/
Any plans to get this going for -modesetting too? Distro's kinda stopped shipping -intel.
-Daniel
Quoted 38 lines
Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Jyri Sarha (1):
drm: Add optionalCOLOR_ENCODINGandCOLOR_RANGEproperties to
drm_planeVille Syrjälä (7):
drm: Add BT.2020 constant luminance enum value for theCOLOR_ENCODING
property
drm/atomic: Include color encoding/range in plane state dump drm/i915: Correctly handle limited range YCbCr data on VLV/CHV drm/i915: Fix planeYCbCr->RGBconversion for GLK drm/i915: Add support for the YCbCrCOLOR_ENCODINGproperty drm/i915: Change theCOLOR_ENCODINGprop default value to BT.709 drm/i915: Add support for the YCbCrCOLOR_RANGEpropertydrivers/gpu/drm/drm_atomic.c | 12 ++++ drivers/gpu/drm/drm_color_mgmt.c | 108 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 24 ++++++- drivers/gpu/drm/i915/intel_display.c | 25 +++++++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_sprite.c | 134 ++++++++++++++++++++++++++++------- include/drm/drm_color_mgmt.h | 20 ++++++ include/drm/drm_plane.h | 8 +++ 9 files changed, 309 insertions(+), 26 deletions(-)Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Daniel Vetter
Quoted 14 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Here's a refresh of Jyri's
COLOR_ENCODINGandCOLOR_RANGEproperties, and the i915 implementation I did on top. I tossed in a few core updates as well: plane state dump, and the BT.2020 constant luminance variant.Apparently nouveau is already exposing a "
iturbt_709" bool property which allows one to choose between BT.601 and BT.709 encodings, but given that we want at least BT.2020 in addition I don't think that property is good enough. Trying to implement it, and somehow extend it beyond BT.601 vs. BT.709 seems like wasted effort. Hence I think we should just ignore it and move on.
Quoted 6 lines
Quoted 3 lines
My userspace implementation in the form of intel ddx
XV_COLORSPACEattribute:
https://patchwork.freedesktop.org/patch/204696/Any plans to get this going for -modesetting too? Distro's kinda stopped shipping -intel.
No plans by me since I don't use -modesetting. Volunteers welcome.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
URL : https://patchwork.freedesktop.org/series/38286/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip fdb4374e01b8 drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane -:72: WARNING: please, no space before tabs #72: FILE: drivers/gpu/drm/drm_color_mgmt.c:97: + * ^IOptional plane enum property to support different non RGB$
-:73: WARNING: please, no space before tabs
#73: FILE: drivers/gpu/drm/drm_color_mgmt.c:98:
+ * ^Icolor encodings. The driver can provide a subset of standard$
-:74: WARNING: please, no space before tabs
#74: FILE: drivers/gpu/drm/drm_color_mgmt.c:99:
+ * ^Ienum values supported by the DRM plane.$
-:77: WARNING: please, no space before tabs
#77: FILE: drivers/gpu/drm/drm_color_mgmt.c:102:
+ * ^IOptional plane enum property to support different non RGB$
-:78: WARNING: please, no space before tabs
#78: FILE: drivers/gpu/drm/drm_color_mgmt.c:103:
+ * ^Icolor parameter ranges. The driver can provide a subset of$
-:79: WARNING: please, no space before tabs #79: FILE: drivers/gpu/drm/drm_color_mgmt.c:104:
+ * ^Istandard enum values supported by the DRM plane.$
total: 0 errors, 6 warnings, 0 checks, 211 lines checked06974dcfd2f1 drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property -:34: WARNING: line over 80 characters
#34: FILE: drivers/gpu/drm/drm_color_mgmt.c:361:
+ [DRM_COLOR_YCBCR_BT2020_CONST] = "ITU-R BT.2020 YCbCr constant luminance",
total: 0 errors, 1 warnings, 0 checks, 16 lines checked 4ab1988ac2fc drm/atomic: Include color encoding/range in plane state dump 88ed14a83389 drm/i915: Correctly handle limited range YCbCr data on VLV/CHV -:81: WARNING: line over 80 characters
#81: FILE: drivers/gpu/drm/i915/i915_reg.h:6345:
+#define SPCLRC0(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC0, _SPBCLRC0)
-:82: WARNING: line over 80 characters
#82: FILE: drivers/gpu/drm/i915/i915_reg.h:6346:
+#define SPCLRC1(pipe, plane_id) _MMIO_VLV_SPR((pipe), (plane_id), _SPACLRC1, _SPBCLRC1)
-:142: WARNING: line over 80 characters #142: FILE: drivers/gpu/drm/i915/intel_sprite.c:380:
+ I915_WRITE_FW(SPCSCYGICLAMP(plane_id), SPCSC_IMAX(1023) | SPCSC_IMIN(0));
-:143: WARNING: line over 80 characters #143: FILE: drivers/gpu/drm/i915/intel_sprite.c:381:
+ I915_WRITE_FW(SPCSCCBICLAMP(plane_id), SPCSC_IMAX(512) | SPCSC_IMIN(-512));
-:144: WARNING: line over 80 characters #144: FILE: drivers/gpu/drm/i915/intel_sprite.c:382:
+ I915_WRITE_FW(SPCSCCRICLAMP(plane_id), SPCSC_IMAX(512) | SPCSC_IMIN(-512));
total: 0 errors, 5 warnings, 0 checks, 143 lines checked 0d7857a6c23f drm/i915: Fix plane YCbCr->RGB conversion for GLK -:36: CHECK: Prefer using the BIT macro
#36: FILE: drivers/gpu/drm/i915/i915_reg.h:6467:
+#define PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709 (1 << 17)
total: 0 errors, 0 warnings, 1 checks, 74 lines checked ab864a46c092 drm/i915: Add support for the YCbCr COLOR_ENCODING property -:42: CHECK: spaces preferred around that '<<' (ctx:VxV) #42: FILE: drivers/gpu/drm/i915/i915_reg.h:6143:
+#define DVS_YUV_FORMAT_BT709 (1<<18)
^
-:42: CHECK: Prefer using the BIT macro
#42: FILE: drivers/gpu/drm/i915/i915_reg.h:6143:
+#define DVS_YUV_FORMAT_BT709 (1<<18)
-:51: CHECK: spaces preferred around that '<<' (ctx:VxV) #51: FILE: drivers/gpu/drm/i915/i915_reg.h:6214:
+#define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 (1<<18) /* 0 is BT601 */
^
-:51: CHECK: Prefer using the BIT macro
#51: FILE: drivers/gpu/drm/i915/i915_reg.h:6214:
+#define SPRITE_YUV_TO_RGB_CSC_FORMAT_BT709 (1<<18) /* 0 is BT601 */
-:59: CHECK: spaces preferred around that '<<' (ctx:VxV) #59: FILE: drivers/gpu/drm/i915/i915_reg.h:6290:
+#define SP_YUV_FORMAT_BT709 (1<<18)
^
-:59: CHECK: Prefer using the BIT macro
#59: FILE: drivers/gpu/drm/i915/i915_reg.h:6290:
+#define SP_YUV_FORMAT_BT709 (1<<18)
-:67: CHECK: Prefer using the BIT macro
#67: FILE: drivers/gpu/drm/i915/i915_reg.h:6415:
+#define PLANE_CTL_YUV_TO_RGB_CSC_FORMAT_BT709 (1 << 18)
-:93: WARNING: line over 80 characters
#93: FILE: drivers/gpu/drm/i915/intel_display.c:3581:
+ plane_color_ctl |= PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709;
-:95: WARNING: line over 80 characters
#95: FILE: drivers/gpu/drm/i915/intel_display.c:3583:
+ plane_color_ctl |= PLANE_COLOR_CSC_MODE_YUV601_TO_RGB709;
-:108: WARNING: line over 80 characters
#108: FILE: drivers/gpu/drm/i915/intel_display.c:13329:
+ BIT(DRM_COLOR_YCBCR_LIMITED_RANGE),
-:110: WARNING: line over 80 characters
#110: FILE: drivers/gpu/drm/i915/intel_display.c:13331:
+ DRM_COLOR_YCBCR_LIMITED_RANGE);
total: 0 errors, 4 warnings, 7 checks, 166 lines checked 0596574e5da4 drm/i915: Change the COLOR_ENCODING prop default value to BT.709 fa58433149c9 drm/i915: Add support for the YCbCr COLOR_RANGE property -:39: CHECK: spaces preferred around that '<<' (ctx:VxV)
#39: FILE: drivers/gpu/drm/i915/i915_reg.h:6135:
+#define DVS_YUV_RANGE_CORRECTION_DISABLE (1<<27)
^
-:39: CHECK: Prefer using the BIT macro
#39: FILE: drivers/gpu/drm/i915/i915_reg.h:6135:
+#define DVS_YUV_RANGE_CORRECTION_DISABLE (1<<27)
-:47: CHECK: spaces preferred around that '<<' (ctx:VxV) #47: FILE: drivers/gpu/drm/i915/i915_reg.h:6204:
+#define SPRITE_YUV_RANGE_CORRECTION_DISABLE (1<<28)
^
-:47: CHECK: Prefer using the BIT macro
#47: FILE: drivers/gpu/drm/i915/i915_reg.h:6204:
+#define SPRITE_YUV_RANGE_CORRECTION_DISABLE (1<<28)
-:55: CHECK: Prefer using the BIT macro
#55: FILE: drivers/gpu/drm/i915/i915_reg.h:6396:
+#define PLANE_CTL_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
-:63: CHECK: Prefer using the BIT macro
#63: FILE: drivers/gpu/drm/i915/i915_reg.h:6471:
+#define PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE (1 << 28)
-:87: WARNING: line over 80 characters
#87: FILE: drivers/gpu/drm/i915/intel_display.c:3589:
+ plane_color_ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
-:96: WARNING: line over 80 characters
#96: FILE: drivers/gpu/drm/i915/intel_display.c:13335:
+ BIT(DRM_COLOR_YCBCR_LIMITED_RANGE) |
-:97: WARNING: line over 80 characters
#97: FILE: drivers/gpu/drm/i915/intel_display.c:13336:
+ BIT(DRM_COLOR_YCBCR_FULL_RANGE),
total: 0 errors, 3 warnings, 6 checks, 91 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.SPARSE: warning for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
URL : https://patchwork.freedesktop.org/series/38286/
State : warning
== Summary ==
$ dim sparse origin/drm-tip Commit: drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane +drivers/gpu/drm/drm_color_mgmt.c:390:45: warning: Variable length array is used.
Commit: drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property Okay!
Commit: drm/atomic: Include color encoding/range in plane state dump Okay!
Commit: drm/i915: Correctly handle limited range YCbCr data on VLV/CHV Okay!
Commit: drm/i915: Fix plane YCbCr->RGB conversion for GLK Okay!
Commit: drm/i915: Add support for the YCbCr COLOR_ENCODING property Okay!
Commit: drm/i915: Change the COLOR_ENCODING prop default value to BT.709 Okay!
Commit: drm/i915: Add support for the YCbCr COLOR_RANGE property Okay!
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
URL : https://patchwork.freedesktop.org/series/38286/
State : success
== Summary ==
Series 38286v3 drm: Add COLOR_ENCODING and COLOR_RANGE plane properties
https://patchwork.freedesktop.org/api/1.0/series/38286/revisions/3/mbox/
Test debugfs_test:
Subgroup read_all_entries:
pass -> INCOMPLETE (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
Subgroup basic-small-bo-tiledx:
pass -> FAIL (fi-gdg-551) fdo#102575
Test kms_frontbuffer_tracking:
Subgroup basic:
fail -> PASS (fi-cnl-y3) fdo#103167fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fi-bdw-5557u total:288 pass:267 dwarn:0 dfail:0 fail:0 skip:21 time:425s fi-bdw-gvtdvm total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:425s fi-blb-e6850 total:288 pass:223 dwarn:1 dfail:0 fail:0 skip:64 time:381s fi-bsw-n3050 total:288 pass:242 dwarn:0 dfail:0 fail:0 skip:46 time:490s fi-bwr-2160 total:288 pass:183 dwarn:0 dfail:0 fail:0 skip:105 time:289s fi-bxt-dsi total:288 pass:258 dwarn:0 dfail:0 fail:0 skip:30 time:483s fi-bxt-j4205 total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:489s fi-byt-j1900 total:288 pass:253 dwarn:0 dfail:0 fail:0 skip:35 time:477s fi-byt-n2820 total:288 pass:249 dwarn:0 dfail:0 fail:0 skip:39 time:463s fi-cfl-s2 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:568s fi-cnl-y3 total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:590s fi-elk-e7500 total:288 pass:229 dwarn:0 dfail:0 fail:0 skip:59 time:414s fi-gdg-551 total:288 pass:179 dwarn:0 dfail:0 fail:1 skip:108 time:286s fi-glk-1 total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:513s fi-hsw-4770 total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:393s fi-ilk-650 total:288 pass:228 dwarn:0 dfail:0 fail:0 skip:60 time:414s fi-ivb-3520m total:288 pass:259 dwarn:0 dfail:0 fail:0 skip:29 time:464s fi-ivb-3770 total:288 pass:255 dwarn:0 dfail:0 fail:0 skip:33 time:413s fi-kbl-7500u total:288 pass:263 dwarn:1 dfail:0 fail:0 skip:24 time:460s fi-kbl-7560u total:288 pass:269 dwarn:0 dfail:0 fail:0 skip:19 time:498s fi-kbl-7567u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:459s fi-kbl-r total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:502s fi-pnv-d510 total:288 pass:222 dwarn:1 dfail:0 fail:0 skip:65 time:593s fi-skl-6260u total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:432s fi-skl-6600u total:288 pass:261 dwarn:0 dfail:0 fail:0 skip:27 time:510s fi-skl-6700hq total:288 pass:262 dwarn:0 dfail:0 fail:0 skip:26 time:525s fi-skl-6700k2 total:288 pass:264 dwarn:0 dfail:0 fail:0 skip:24 time:496s fi-skl-6770hq total:288 pass:268 dwarn:0 dfail:0 fail:0 skip:20 time:477s fi-skl-guc total:288 pass:260 dwarn:0 dfail:0 fail:0 skip:28 time:415s fi-skl-gvtdvm total:288 pass:265 dwarn:0 dfail:0 fail:0 skip:23 time:431s fi-snb-2520m total:3 pass:2 dwarn:0 dfail:0 fail:0 skip:0 fi-snb-2600 total:288 pass:248 dwarn:0 dfail:0 fail:0 skip:40 time:399s
6e9c17ec8ab61a850c3c9dcb346f701f4355a334 drm-tip: 2018y-02m-19d-19h-44m-13s UTC integration manifest fa58433149c9 drm/i915: Add support for the YCbCr COLOR_RANGE property0596574e5da4 drm/i915: Change the COLOR_ENCODING prop default value to BT.709 ab864a46c092 drm/i915: Add support for the YCbCr COLOR_ENCODING property 0d7857a6c23f drm/i915: Fix plane YCbCr->RGB conversion for GLK88ed14a83389 drm/i915: Correctly handle limited range YCbCr data on VLV/CHV 4ab1988ac2fc drm/atomic: Include color encoding/range in plane state dump 06974dcfd2f1 drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property fdb4374e01b8 drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8069/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: failure for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3)
URL : https://patchwork.freedesktop.org/series/38286/
State : failure
== Summary ==
Test gem_exec_capture:
Subgroup capture-vebox:
pass -> INCOMPLETE (shard-apl)
Test gem_softpin:
Subgroup noreloc-s3:
dmesg-warn -> PASS (shard-snb) fdo#103375 +1
Test kms_plane_scaling:
Subgroup pipe-c-scaler-with-pixel-format:
pass -> DMESG-WARN (shard-apl) fdo#104727
Test kms_flip:
Subgroup 2x-flip-vs-blocking-wf-vblank:
pass -> FAIL (shard-hsw) fdo#100368
Test perf:
Subgroup oa-exponents:
fail -> PASS (shard-apl) fdo#102254fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#104727 https://bugs.freedesktop.org/show_bug.cgi?id=104727
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
shard-apl total:3322 pass:1739 dwarn:2 dfail:0 fail:11 skip:1568 time:11925s shard-hsw total:3434 pass:1761 dwarn:1 dfail:0 fail:3 skip:1668 time:11788s shard-snb total:3434 pass:1352 dwarn:1 dfail:0 fail:1 skip:2080 time:6705s
Blacklisted hosts:
shard-kbl total:3434 pass:1894 dwarn:32 dfail:2 fail:14 skip:1492 time:9683s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8069/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 7 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Here's a refresh of Jyri's
COLOR_ENCODINGandCOLOR_RANGEproperties, and the i915 implementation I did on top. I tossed in a few core updates as well: plane state dump, and the BT.2020 constant luminance variant.
Quoted 6 lines
Apparently nouveau is already exposing a "
iturbt_709" bool property which allows one to choose between BT.601 and BT.709 encodings, but given that we want at least BT.2020 in addition I don't think that property is good enough. Trying to implement it, and somehow extend it beyond BT.601 vs. BT.709 seems like wasted effort. Hence I think we should just ignore it and move on.
I discussed the nouveau situation with Illia, and apparently there's not yet any userspace using it. Which means we could still quickly rename it, before Illia adds the ddx support. Would be great if someone could do that :-)
Cheers, Daniel
Quoted 42 lines
My userspace implementation in the form of intel ddx
XV_COLORSPACEattribute:
https://patchwork.freedesktop.org/patch/204696/Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Jyri Sarha (1):
drm: Add optionalCOLOR_ENCODINGandCOLOR_RANGEproperties to
drm_planeVille Syrjälä (7):
drm: Add BT.2020 constant luminance enum value for theCOLOR_ENCODING
property
drm/atomic: Include color encoding/range in plane state dump drm/i915: Correctly handle limited range YCbCr data on VLV/CHV drm/i915: Fix planeYCbCr->RGBconversion for GLK drm/i915: Add support for the YCbCrCOLOR_ENCODINGproperty drm/i915: Change theCOLOR_ENCODINGprop default value to BT.709 drm/i915: Add support for the YCbCrCOLOR_RANGEpropertydrivers/gpu/drm/drm_atomic.c | 12 ++++ drivers/gpu/drm/drm_color_mgmt.c | 108 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 24 ++++++- drivers/gpu/drm/i915/intel_display.c | 25 +++++++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_sprite.c | 134 ++++++++++++++++++++++++++++------- include/drm/drm_color_mgmt.h | 20 ++++++ include/drm/drm_plane.h | 8 +++ 9 files changed, 309 insertions(+), 26 deletions(-)Signature · 1 line
2.13.6
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 15 lines · Daniel Vetter
Quoted 7 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Here's a refresh of Jyri's
COLOR_ENCODINGandCOLOR_RANGEproperties, and the i915 implementation I did on top. I tossed in a few core updates as well: plane state dump, and the BT.2020 constant luminance variant.Quoted 6 lines
Apparently nouveau is already exposing a "
iturbt_709" bool property which allows one to choose between BT.601 and BT.709 encodings, but given that we want at least BT.2020 in addition I don't think that property is good enough. Trying to implement it, and somehow extend it beyond BT.601 vs. BT.709 seems like wasted effort. Hence I think we should just ignore it and move on.
Quoted 2 lines
I discussed the nouveau situation with Illia, and apparently there's not yet any userspace using it.
Hmm. Yeah, looks like the Xv port attribute is there in nv/nouveau ddx but it's not implemented via the kms property.
Quoted 53 lines
Which means we could still quickly rename it,
before Illia adds the ddx support. Would be great if someone could do that :-)Cheers, Daniel
Quoted 42 lines
My userspace implementation in the form of intel ddx
XV_COLORSPACEattribute:
https://patchwork.freedesktop.org/patch/204696/Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Jyri Sarha (1):
drm: Add optionalCOLOR_ENCODINGandCOLOR_RANGEproperties to
drm_planeVille Syrjälä (7):
drm: Add BT.2020 constant luminance enum value for theCOLOR_ENCODING
property
drm/atomic: Include color encoding/range in plane state dump drm/i915: Correctly handle limited range YCbCr data on VLV/CHV drm/i915: Fix planeYCbCr->RGBconversion for GLK drm/i915: Add support for the YCbCrCOLOR_ENCODINGproperty drm/i915: Change theCOLOR_ENCODINGprop default value to BT.709 drm/i915: Add support for the YCbCrCOLOR_RANGEpropertydrivers/gpu/drm/drm_atomic.c | 12 ++++ drivers/gpu/drm/drm_color_mgmt.c | 108 ++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 2 + drivers/gpu/drm/i915/i915_reg.h | 24 ++++++- drivers/gpu/drm/i915/intel_display.c | 25 +++++++ drivers/gpu/drm/i915/intel_drv.h | 2 + drivers/gpu/drm/i915/intel_sprite.c | 134 ++++++++++++++++++++++++++++------- include/drm/drm_color_mgmt.h | 20 ++++++ include/drm/drm_plane.h | 8 +++ 9 files changed, 309 insertions(+), 26 deletions(-)Signature · 1 line
2.13.6Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 31 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Here's a refresh of Jyri's
COLOR_ENCODINGandCOLOR_RANGEproperties, and the i915 implementation I did on top. I tossed in a few core updates as well: plane state dump, and the BT.2020 constant luminance variant.Apparently nouveau is already exposing a "
iturbt_709" bool property which allows one to choose between BT.601 and BT.709 encodings, but given that we want at least BT.2020 in addition I don't think that property is good enough. Trying to implement it, and somehow extend it beyond BT.601 vs. BT.709 seems like wasted effort. Hence I think we should just ignore it and move on.My userspace implementation in the form of intel ddx
XV_COLORSPACEattribute:
https://patchwork.freedesktop.org/patch/204696/Cc Harry Wentland <[email protected]>Cc Daniel Vetter <[email protected]>Cc Daniel Stone <[email protected]>Cc Russell King - ARM Linux <[email protected]>Cc Ilia Mirkin <[email protected]>Cc Hans Verkuil <[email protected]>Cc Uma Shankar <[email protected]>Cc Shashank Sharma <[email protected]>Jyri Sarha (1):
drm: Add optionalCOLOR_ENCODINGandCOLOR_RANGEproperties to
drm_plane
Quoted 9 lines
Ville Syrjälä (7):
drm: Add BT.2020 constant luminance enum value for theCOLOR_ENCODING
property
drm/atomic: Include color encoding/range in plane state dump drm/i915: Correctly handle limited range YCbCr data on VLV/CHV drm/i915: Fix planeYCbCr->RGBconversion for GLK drm/i915: Add support for the YCbCrCOLOR_ENCODINGproperty drm/i915: Change theCOLOR_ENCODINGprop default value to BT.709 drm/i915: Add support for the YCbCrCOLOR_RANGEproperty
Userspace for i915 was deemed ready [1] so I've pushed the series (apart from the BT2020_CONST thing) to drm-misc-next. Thanks to everyone who worked on this.
[1] https://lists.freedesktop.org/archives/intel-gfx/2018-March/157512.html
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel