Add Plane Color Properties
Subsystems (3)
cover Add Plane Color Properties
This patch series adds properties for plane color features. It adds properties for degamma used to linearize data, CSC used for gamut conversion, and gamma used to again non-linearize data as per panel supported color space. These can be utilize by user space to convert planes from one format to another, one color space to another etc.
Usersapce can take smart blending decisions and utilize these hardware supported plane color features to get accurate color profile. The same can help in consistent color quality from source to panel taking advantage of advanced color features in hardware.
These patches just add the property interfaces and enable helper functions. Based on community feedabck on this one, we can build up and add hardware specific implementation on top of this series.
Note: This is just to get a design feedback whether these interfaces look ok. Once, designed is agreed will re-send the series with a hardware specific implementation along with IGT tests for plane color.
Uma Shankar (6):
drm: Add Plane Degamma properties
drm: Add Plane CTM property
drm: Add Plane Gamma properties
drm: Define helper function for plane color enabling
drm: Define helper to set legacy gamma table size drm/i915: Enable plane color features
drivers/gpu/drm/drm_atomic.c | 29 ++++++++++++++++++++ drivers/gpu/drm/drm_color_mgmt.c | 41 +++++++++++++++++++++++++++++ drivers/gpu/drm/drm_mode_config.c | 35 +++++++++++++++++++++++++ drivers/gpu/drm/drm_plane.c | 48 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 8 ++++++ drivers/gpu/drm/i915/intel_color.c | 14 ++++++++++ drivers/gpu/drm/i915/intel_display.c | 4 +++ drivers/gpu/drm/i915/intel_drv.h | 9 +++++++ drivers/gpu/drm/i915/intel_sprite.c | 4 +++ include/drm/drm_color_mgmt.h | 8 ++++++ include/drm/drm_mode_config.h | 28 ++++++++++++++++++++ include/drm/drm_plane.h | 31 ++++++++++++++++++++++ 12 files changed, 259 insertions(+)
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 1/6 drm: Add Plane Degamma properties
Add Plane Degamma as a blob property and plane
degamma size as a range property.
--- drivers/gpu/drm/drm_atomic.c | 12 ++++++++++++ drivers/gpu/drm/drm_atomic_helper.c | 6 ++++++ drivers/gpu/drm/drm_mode_config.c | 14 ++++++++++++++ include/drm/drm_mode_config.h | 11 +++++++++++ include/drm/drm_plane.h | 10 ++++++++++ 5 files changed, 53 insertions(+)
drivers/gpu/drm/drm_atomic.c +12 -0
@@ -716,6 +716,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, {struct drm_device *dev = plane->dev;struct drm_mode_config *config = &dev->mode_config; +bool replaced = false; +int ret;if (property == config->prop_fb_id) {struct drm_framebuffer *fb =drm_framebuffer_lookup (dev, val);
@@ -761,6 +763,12 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val); + }else if (property == config->plane_degamma_lut_property) { + ret =drm_atomic_replace_property_blob_from_id (dev, + &state->degamma_lut, + val,-1 , &replaced); + state->color_mgmt_changed |= replaced; +return ret; }else {return -EINVAL ; }
@@ -819,6 +827,9 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, *val = state->zpos; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); + }else if (property == config->plane_degamma_lut_property) { + *val = (state->degamma_lut) ? + state->degamma_lut->base.id :0 ; }else {return -EINVAL ; }
@@ -955,6 +966,7 @@ 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_mgmt_changed=%d\n" , state->color_mgmt_changed);if (plane->funcs->atomic_print_state) plane->funcs->atomic_print_state (p, state);
drivers/gpu/drm/drm_atomic_helper.c +6 -0
@@ -3386,6 +3386,10 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane, state->fence =NULL ; state->commit =NULL ; + +if (state->degamma_lut) +drm_property_blob_get (state->degamma_lut); + state->color_mgmt_changed = false; }EXPORT_SYMBOL (__drm_atomic_helper_plane_duplicate_state);
@@ -3430,6 +3434,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)if (state->commit)drm_crtc_commit_put (state->commit); + +drm_property_blob_put (state->degamma_lut); }EXPORT_SYMBOL (__drm_atomic_helper_plane_destroy_state);
drivers/gpu/drm/drm_mode_config.c +14 -0
@@ -344,6 +344,20 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)return -ENOMEM ; dev->mode_config.modifiers_property = prop; + prop =drm_property_create (dev, +DRM_MODE_PROP_BLOB , +"PLANE_DEGAMMA_LUT" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.plane_degamma_lut_property = prop; + + prop =drm_property_create_range (dev, +DRM_MODE_PROP_IMMUTABLE , +"PLANE_DEGAMMA_LUT_SIZE" ,0 ,UINT_MAX ); +if (!prop) +return -ENOMEM ; + dev->mode_config.plane_degamma_lut_size_property = prop; +return 0 ; }
include/drm/drm_mode_config.h +11 -0
@@ -731,6 +731,17 @@ struct drm_mode_config {struct drm_property *gamma_lut_size_property;/** +* @plane_degamma_lut_property: Optional Plane property to set the LUT +* used to convert the framebuffer's colors to linear gamma. +*/ +struct drm_property *plane_degamma_lut_property; +/** +* @plane_degamma_lut_size_property: Optional Plane property for the +* size of the degamma LUT as supported by the driver (read-only). +*/ +struct drm_property *plane_degamma_lut_size_property; + +/** * @suggested_x_property: Optional connector property with a hint for * the position of the output on the host's screen. */
include/drm/drm_plane.h +10 -0
@@ -123,6 +123,14 @@ struct drm_plane_state {*/ bool visible; +/* @degamma_lut: +* +* Lookup table for converting framebuffer pixel data before apply the +* color conversion matrix @ctm. See drm_plane_enable_color_mgmt(). The +* blob (if not NULL) is an array of &struct drm_color_lut. +*/ +struct drm_property_blob *degamma_lut; +/** * @commit: Tracks the pending commit to prevent use-after-free conditions, * and for async plane updates.
@@ -132,6 +140,8 @@ struct drm_plane_state {struct drm_crtc_commit *commit;struct drm_atomic_state *state; + + bool color_mgmt_changed : 1; }; static inline struct drm_rect
Signature · 6 lines
1.7.9.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC 2/6 drm: Add Plane CTM property
In reply to Uma ShankarAdd a blob property for plane CSC usage.
--- drivers/gpu/drm/drm_atomic.c | 10 ++++++++++ drivers/gpu/drm/drm_atomic_helper.c | 3 +++ drivers/gpu/drm/drm_mode_config.c | 7 +++++++ include/drm/drm_mode_config.h | 6 ++++++ include/drm/drm_plane.h | 8 ++++++++ 5 files changed, 34 insertions(+)
drivers/gpu/drm/drm_atomic.c +10 -0
@@ -769,6 +769,14 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, val, -1, &replaced); state->color_mgmt_changed |= replaced;return ret; + }else if (property == config->plane_ctm_property) { + ret =drm_atomic_replace_property_blob_from_id (dev, + &state->ctm, + val, +sizeof (struct drm_color_ctm ), + &replaced); + state->color_mgmt_changed |= replaced; +return ret; }else {return -EINVAL ; }
@@ -830,6 +838,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, }else if (property == config->plane_degamma_lut_property) { *val = (state->degamma_lut) ? state->degamma_lut->base.id :0 ; + }else if (property == config->plane_ctm_property) { + *val = (state->ctm) ? state->ctm->base.id :0 ; }else {return -EINVAL ; }
drivers/gpu/drm/drm_atomic_helper.c +3 -0
@@ -3389,6 +3389,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,if (state->degamma_lut)drm_property_blob_get (state->degamma_lut); +if (state->ctm) +drm_property_blob_get (state->ctm); state->color_mgmt_changed = false; }EXPORT_SYMBOL (__drm_atomic_helper_plane_duplicate_state);
@@ -3436,6 +3438,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)drm_crtc_commit_put (state->commit);drm_property_blob_put (state->degamma_lut); +drm_property_blob_put (state->ctm); }EXPORT_SYMBOL (__drm_atomic_helper_plane_destroy_state);
drivers/gpu/drm/drm_mode_config.c +7 -0
@@ -358,6 +358,13 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)return -ENOMEM ; dev->mode_config.plane_degamma_lut_size_property = prop; + prop =drm_property_create (dev, +DRM_MODE_PROP_BLOB , +"PLANE_CTM" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.plane_ctm_property = prop; +return 0 ; }
include/drm/drm_mode_config.h +6 -0
@@ -740,6 +740,12 @@ struct drm_mode_config {* size of the degamma LUT as supported by the driver (read-only). */ struct drm_property *plane_degamma_lut_size_property; +/** +* @plane_ctm_property: Optional CRTC property to set the +* matrix used to convert colors after the lookup in the +* degamma LUT. +*/ +struct drm_property *plane_ctm_property;/** * @suggested_x_property: Optional connector property with a hint for
include/drm/drm_plane.h +8 -0
@@ -132,6 +132,14 @@ struct drm_plane_state {struct drm_property_blob *degamma_lut;/** +* @ctm: +* +* Color transformation matrix. See drm_plane_enable_color_mgmt(). The +* blob (if not NULL) is a &struct drm_color_ctm. +*/ +struct drm_property_blob *ctm; + +/** * @commit: Tracks the pending commit to prevent use-after-free conditions, * and for async plane updates. *
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 3/6 drm: Add Plane Gamma properties
In reply to Uma ShankarAdd plane gamma as blob property and size as a
range property.
--- drivers/gpu/drm/drm_atomic.c | 8 ++++++++ drivers/gpu/drm/drm_atomic_helper.c | 3 +++ drivers/gpu/drm/drm_mode_config.c | 14 ++++++++++++++ include/drm/drm_mode_config.h | 11 +++++++++++ include/drm/drm_plane.h | 9 +++++++++ 5 files changed, 45 insertions(+)
drivers/gpu/drm/drm_atomic.c +8 -0
@@ -777,6 +777,12 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, &replaced); state->color_mgmt_changed |= replaced;return ret; + }else if (property == config->plane_gamma_lut_property) { + ret =drm_atomic_replace_property_blob_from_id (dev, + &state->gamma_lut, + val,-1 , &replaced); + state->color_mgmt_changed |= replaced; +return ret; }else {return -EINVAL ; }
@@ -840,6 +846,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, state->degamma_lut->base.id : 0; }else if (property == config->plane_ctm_property) { *val = (state->ctm) ? state->ctm->base.id :0 ; + }else if (property == config->plane_gamma_lut_property) { + *val = (state->gamma_lut) ? state->gamma_lut->base.id :0 ; }else {return -EINVAL ; }
drivers/gpu/drm/drm_atomic_helper.c +3 -0
@@ -3391,6 +3391,8 @@ void __drm_atomic_helper_plane_duplicate_state(struct drm_plane *plane,drm_property_blob_get (state->degamma_lut);if (state->ctm)drm_property_blob_get (state->ctm); +if (state->gamma_lut) +drm_property_blob_get (state->gamma_lut); state->color_mgmt_changed = false; }EXPORT_SYMBOL (__drm_atomic_helper_plane_duplicate_state);
@@ -3439,6 +3441,7 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane_state *state)drm_property_blob_put (state->degamma_lut);drm_property_blob_put (state->ctm); +drm_property_blob_put (state->gamma_lut); }EXPORT_SYMBOL (__drm_atomic_helper_plane_destroy_state);
drivers/gpu/drm/drm_mode_config.c +14 -0
@@ -365,6 +365,20 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)return -ENOMEM ; dev->mode_config.plane_ctm_property = prop; + prop =drm_property_create (dev, +DRM_MODE_PROP_BLOB , +"PLANE_GAMMA_LUT" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.plane_gamma_lut_property = prop; + + prop =drm_property_create_range (dev, +DRM_MODE_PROP_IMMUTABLE , +"PLANE_GAMMA_LUT_SIZE" ,0 ,UINT_MAX ); +if (!prop) +return -ENOMEM ; + dev->mode_config.plane_gamma_lut_size_property = prop; +return 0 ; }
include/drm/drm_mode_config.h +11 -0
@@ -746,6 +746,17 @@ struct drm_mode_config {* degamma LUT. */ struct drm_property *plane_ctm_property; +/** +* @plane_gamma_lut_property: Optional Plane property to set the LUT +* used to convert the colors, after the CTM matrix, to the common +* gamma space chosen for blending. +*/ +struct drm_property *plane_gamma_lut_property; +/** +* @plane_gamma_lut_size_property: Optional Plane property for the size +* of the gamma LUT as supported by the driver (read-only). +*/ +struct drm_property *plane_gamma_lut_size_property;/** * @suggested_x_property: Optional connector property with a hint for
include/drm/drm_plane.h +9 -0
@@ -140,6 +140,15 @@ struct drm_plane_state {struct drm_property_blob *ctm;/** +* @gamma_lut: +* +* Lookup table for converting pixel data after the color conversion +* matrix @ctm. See drm_plane_enable_color_mgmt(). The blob (if not +* NULL) is an array of &struct drm_color_lut. +*/ +struct drm_property_blob *gamma_lut; + +/** * @commit: Tracks the pending commit to prevent use-after-free conditions, * and for async plane updates. *
Signature · 6 lines
1.7.9.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC 4/6 drm: Define helper function for plane color enabling
In reply to Uma ShankarDefine helper function to enable Plane color features to attach plane color properties to plane structure.
--- drivers/gpu/drm/drm_plane.c | 48 ++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 5 +++++ 2 files changed, 53 insertions(+)
drivers/gpu/drm/drm_plane.c +48 -0
@@ -144,6 +144,54 @@ static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane }/** +* drm_plane_enable_color_mgmt - enable color management properties +* @plane: DRM Plane +* @plane_degamma_lut_size: the size of the degamma lut (before CSC) +* @plane_has_ctm: whether to attach ctm_property for CSC matrix +* @plane_gamma_lut_size: the size of the gamma lut (after CSC) +* +* This function lets the driver enable the color correction +* properties on a plane. This includes 3 degamma, csc and gamma +* properties that userspace can set and 2 size properties to inform +* the userspace of the lut sizes. Each of the properties are +* optional. The gamma and degamma properties are only attached if +* their size is not 0 and ctm_property is only attached if has_ctm is +* true. +* +* Drivers should use drm_atomic_helper_legacy_gamma_set() to implement the +* legacy &drm_crtc_funcs.gamma_set callback. +*/ +void drm_plane_enable_color_mgmt (struct drm_plane *plane, +uint plane_degamma_lut_size, +bool plane_has_ctm, +uint plane_gamma_lut_size) +{ +struct drm_device *dev = plane->dev; +struct drm_mode_config *config = &dev->mode_config; + +if (plane_degamma_lut_size) { +drm_object_attach_property (&plane->base, + config->plane_degamma_lut_property,0 ); +drm_object_attach_property (&plane->base, + config->plane_degamma_lut_size_property, + plane_degamma_lut_size); + } + +if (plane_has_ctm) +drm_object_attach_property (&plane->base, + config->plane_ctm_property,0 ); + +if (plane_gamma_lut_size) { +drm_object_attach_property (&plane->base, + config->plane_gamma_lut_property,0 ); +drm_object_attach_property (&plane->base, + config->plane_gamma_lut_size_property, + plane_gamma_lut_size); + } +} +EXPORT_SYMBOL (drm_plane_enable_color_mgmt); + +/** * drm_universal_plane_init - Initialize a new universal plane object * @dev: DRM device * @plane: plane object to init
include/drm/drm_color_mgmt.h +5 -0
@@ -37,4 +37,9 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,int drm_mode_crtc_set_gamma_size (struct drm_crtc *crtc,int gamma_size); +void drm_plane_enable_color_mgmt (struct drm_plane *plane, +uint plane_degamma_lut_size, +bool plane_has_ctm, +uint plane_gamma_lut_size); +#endif
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 5/6 drm: Define helper to set legacy gamma table size
In reply to Uma ShankarDefine a helper function to set legacy gamma table size for planes.
--- drivers/gpu/drm/drm_color_mgmt.c | 41 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ include/drm/drm_plane.h | 4 ++++ 3 files changed, 48 insertions(+)
drivers/gpu/drm/drm_color_mgmt.c +41 -0
@@ -204,6 +204,47 @@ int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,EXPORT_SYMBOL (drm_mode_crtc_set_gamma_size);/** +* drm_mode_plane_set_gamma_size - set the gamma table size +* @plane: Plane to set the gamma table size for +* @gamma_size: size of the gamma table +* +* Drivers which support gamma tables should set this to the supported gamma +* table size when initializing the Plane. Currently the drm core only supports +* a fixed gamma table size. +* +* Returns: +* Zero on success, negative errno on failure. +*/ +int drm_mode_plane_set_gamma_size (struct drm_plane *plane, +int gamma_size) +{ +uint16_t *r_base, *g_base, *b_base; +int i; + + plane->gamma_size = gamma_size; + + plane->gamma_store =kcalloc (gamma_size,sizeof (uint16_t ) *3 , +GFP_KERNEL ); +if (!plane->gamma_store) { + plane->gamma_size =0 ; +return -ENOMEM ; + } + + r_base = plane->gamma_store; + g_base = r_base + gamma_size; + b_base = g_base + gamma_size; +for (i =0 ; i < gamma_size; i++) { + r_base[i] = i <<8 ; + g_base[i] = i <<8 ; + b_base[i] = i <<8 ; + } + + +return 0 ; +} +EXPORT_SYMBOL (drm_mode_plane_set_gamma_size); + +/** * drm_mode_gamma_set_ioctl - set the gamma table * @dev: DRM device * @data: ioctl data
include/drm/drm_color_mgmt.h +3 -0
@@ -42,4 +42,7 @@ void drm_plane_enable_color_mgmt(struct drm_plane *plane,bool plane_has_ctm, uint plane_gamma_lut_size); +int drm_mode_plane_set_gamma_size (struct drm_plane *plane, +int plane_gamma_size); +#endif
include/drm/drm_plane.h +4 -0
@@ -575,6 +575,10 @@ struct drm_plane {struct drm_property *zpos_property;struct drm_property *rotation_property; + +/* Legacy FB Plane gamma size for reporting to userspace */ +uint32_t gamma_size; +uint16_t *gamma_store; };#define obj_to_plane (x) container_of(x, struct drm_plane, base)
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
Hey,
Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
Quoted 10 lines
Define a helper function to set legacy gamma table size for planes.
Signed-off-by Uma Shankar <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 41 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ include/drm/drm_plane.h | 4 ++++ 3 files changed, 48 insertions(+)
Is this needed? I'm not aware of legacy tables for planes.
Kind regards,
Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
Quoted 24 lines
-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Lankhorst, Maarten
Sent: Tuesday, September 26, 2017 3:36 PM
To: Shankar, Uma <[email protected]>; [email protected]; [email protected]
Cc: Syrjala, Ville <[email protected]>
Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table sizeHey,
Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
Quoted 9 lines
Define a helper function to set legacy gamma table size for planes.
Signed-off-by Uma Shankar <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 41 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ include/drm/drm_plane.h | 4 ++++ 3 files changed, 48 insertions(+)
Quoted 1 line
Is this needed? I'm not aware of legacy tables for planes.
I was not getting very concrete info on this. So kept it as per pipe gamma implementation. I will try to get some more info and drop this in case it's not required.
Regards,
Uma Shankar
Quoted 6 lines
Kind regards,
Maarten
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
Shankar, Uma schreef op di 26-09-2017 om 15:41 [+0530]:
Quoted 26 lines
Quoted 26 lines
-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of
Lankhorst, Maarten
Sent: Tuesday, September 26, 2017 3:36 PM
To: Shankar, Uma <[email protected]>; [email protected] op.org;
[email protected]
Cc: Syrjala, Ville <[email protected]>
Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table sizeHey,
Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
Quoted 10 lines
Define a helper function to set legacy gamma table size for planes.
Signed-off-by Uma Shankar <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 41 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ include/drm/drm_plane.h | 4 ++++ 3 files changed, 48 insertions(+)
Quoted 7 lines
Quoted 1 line
Is this needed? I'm not aware of legacy tables for planes.
I was not getting very concrete info on this. So kept it as per pipe gamma implementation.
I will try to get some more info and drop this in case it's not required.
It's not, legacy gamma would only be used in drm_mode_gamma_get_ioctl, which if you look at it only works for a crtc. :)
~Maarten
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [RFC v1 5/6] drm: Define helper to set legacy gamma table size
Quoted 37 lines
-----Original Message-----
From: Lankhorst, Maarten
Sent: Tuesday, September 26, 2017 3:45 PM
To: Shankar, Uma <[email protected]>; [email protected]; [email protected]
Cc: Syrjala, Ville <[email protected]>
Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table sizeShankar, Uma schreef op di 26-09-2017 om 15:41 [+0530]:
Quoted 26 lines
Quoted 25 lines
-----Original Message-----
From: dri-devel [mailto:[email protected]] On Behalf Of Lankhorst, Maarten
Sent: Tuesday, September 26, 2017 3:36 PM
To: Shankar, Uma <[email protected]>; [email protected] op.org; [email protected]
Cc: Syrjala, Ville <[email protected]>
Subject: Re: [RFC v1 5/6] drm: Define helper to set legacy gamma table sizeHey,
Uma Shankar schreef op di 26-09-2017 om 13:32 [+0530]:
Quoted 10 lines
Define a helper function to set legacy gamma table size for planes.
Signed-off-by Uma Shankar <[email protected]>--- drivers/gpu/drm/drm_color_mgmt.c | 41 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_color_mgmt.h | 3 +++ include/drm/drm_plane.h | 4 ++++ 3 files changed, 48 insertions(+)Is this needed? I'm not aware of legacy tables for planes.
Quoted 9 lines
Quoted 5 lines
I was not getting very concrete info on this. So kept it as per pipe gamma implementation.
I will try to get some more info and drop this in case it's not required.It's not, legacy gamma would only be used in
drm_mode_gamma_get_ioctl, which if you look at it only works for a crtc. :)
Yeah I thought that it was just added for crtc, and implementation for plane was not done. Was not sure if it can also be extended for plane.
Will drop this change. Thanks for clarifying.
Regards,
Uma Shankar
Quoted 1 line
~Maarten
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC 6/6 drm/i915: Enable plane color features
In reply to Uma ShankarEnable and initilaize plane color features.
--- drivers/gpu/drm/i915/i915_drv.h | 8 ++++++++ drivers/gpu/drm/i915/intel_color.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 4 ++++ drivers/gpu/drm/i915/intel_drv.h | 9 +++++++++ drivers/gpu/drm/i915/intel_sprite.c | 4 ++++ 5 files changed, 39 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +8 -0
@@ -742,6 +742,9 @@ struct drm_i915_display_funcs {void (*load_csc_matrix)(struct drm_crtc_state *crtc_state);void (*load_luts)(struct drm_crtc_state *crtc_state); +/* Add Plane Color callbacks */ +void (*load_plane_csc_matrix)(struct drm_plane_state *plane_state); +void (*load_plane_luts)(struct drm_plane_state *plane_state); };#define CSR_VERSION (major, minor) ((major) << 16 | (minor))
@@ -880,6 +883,11 @@ struct intel_device_info {u16 degamma_lut_size;u16 gamma_lut_size; } color; + +struct plane_color_luts { +u16 plane_degamma_lut_size; +u16 plane_gamma_lut_size; + } plane_color; };struct intel_display_error_state ;
drivers/gpu/drm/i915/intel_color.c +14 -0
@@ -643,6 +643,20 @@ int intel_color_check(struct drm_crtc *crtc,return -EINVAL ; } +void intel_plane_color_init (struct drm_plane *plane) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->dev); + +drm_mode_plane_set_gamma_size (plane,16 ); + +/* Enable color management support when we have degamma & gamma LUTs. */ +if (INTEL_INFO (dev_priv)->plane_color.plane_degamma_lut_size !=0 && +INTEL_INFO (dev_priv)->plane_color.plane_gamma_lut_size !=0 ) +drm_plane_enable_color_mgmt (plane, +INTEL_INFO (dev_priv)->plane_color.plane_degamma_lut_size, + true,INTEL_INFO (dev_priv)->plane_color.plane_gamma_lut_size); +} +void intel_color_init (struct drm_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->dev);
drivers/gpu/drm/i915/intel_display.c +4 -0
@@ -13302,6 +13302,10 @@ static bool intel_cursor_plane_format_mod_supported(struct drm_plane *plane,DRM_MODE_ROTATE_0 , supported_rotations); +/* Add Plane Color properties */ +if (INTEL_GEN (dev_priv) >=9 ) +intel_plane_color_init (&primary->base); +drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs);return primary;
drivers/gpu/drm/i915/intel_drv.h +9 -0
@@ -440,6 +440,14 @@ struct intel_plane_state {*/ int scaler_id; +/* +* Use reduced/limited/broadcast rbg range, compressing from the full +* range fed into the crtcs. +*/ +bool limited_color_range; +/* Gamma mode programmed on the plane */ +uint32_t gamma_mode; +struct drm_intel_sprite_colorkey ckey; };
@@ -2000,6 +2008,7 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_int intel_color_check (struct drm_crtc *crtc,struct drm_crtc_state *state);void intel_color_set_csc (struct drm_crtc_state *crtc_state);void intel_color_load_luts (struct drm_crtc_state *crtc_state); +void intel_plane_color_init (struct drm_plane *plane);/* intel_lspcon.c */ bool lspcon_init (struct intel_digital_port *intel_dig_port);
drivers/gpu/drm/i915/intel_sprite.c +4 -0
@@ -1324,6 +1324,10 @@ struct intel_plane *DRM_MODE_ROTATE_0 , supported_rotations); +/* Add Plane Color properties */ +if (INTEL_GEN (dev_priv) >=9 ) +intel_plane_color_init (&intel_plane->base); +drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs);return intel_plane;
Signature · 6 lines
1.7.9.5 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Patchwork
CI✓ Fi.CI.BAT: success for Add Plane Color Properties
In reply to Uma Shankar== Series Details ==
== Series Details ==
Series: Add Plane Color Properties
URL : https://patchwork.freedesktop.org/series/30875/
State : success
== Summary ==
Series 30875v1 Add Plane Color Properties
https://patchwork.freedesktop.org/api/1.0/series/30875/revisions/1/mbox/
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-b:
dmesg-warn -> INCOMPLETE (fi-cfl-s) fdo#102294
Test drv_module_reload:
Subgroup basic-no-display:
dmesg-warn -> PASS (fi-glk-1) fdo#102777fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:448s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:469s fi-blb-e6850 total:289 pass:224 dwarn:1 dfail:0 fail:0 skip:64 time:424s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:514s fi-bwr-2160 total:289 pass:184 dwarn:0 dfail:0 fail:0 skip:105 time:277s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:505s fi-byt-j1900 total:289 pass:254 dwarn:1 dfail:0 fail:0 skip:34 time:489s fi-byt-n2820 total:289 pass:250 dwarn:1 dfail:0 fail:0 skip:38 time:492s fi-cfl-s total:231 pass:188 dwarn:17 dfail:0 fail:0 skip:25 fi-cnl-y total:289 pass:256 dwarn:0 dfail:0 fail:6 skip:27 time:637s fi-elk-e7500 total:289 pass:230 dwarn:0 dfail:0 fail:0 skip:59 time:417s fi-glk-1 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:565s fi-hsw-4770 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:425s fi-hsw-4770r total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:403s fi-ilk-650 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:433s fi-ivb-3520m total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:491s fi-ivb-3770 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:459s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:474s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:590s fi-pnv-d510 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:546s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:452s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:747s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:487s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:471s fi-snb-2520m total:289 pass:251 dwarn:0 dfail:0 fail:0 skip:38 time:566s fi-snb-2600 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:421s
fi-kbl-7560u failed to connect after reboot
b7dc379de4c0776d101c6be461ff5e18a2e9ae6e drm-tip: 2017y-09m-26d-08h-41m-45s UTC integration manifest fe16c4775028 drm/i915: Enable plane color featuresb6cc051ed4f7 drm: Define helper to set legacy gamma table sized2c72cf8e4ec drm: Define helper function for plane color enabling38c3e81c76d9 drm: Add Plane Gamma properties36280cc42061 drm: Add Plane CTM property4da58c1cba9d drm: Add Plane Degamma properties
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5812/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines · Uma Shankar
This patch series adds properties for plane color features. It adds properties for degamma used to linearize data, CSC used for gamut conversion, and gamma used to again non-linearize data as per panel supported color space. These can be utilize by user space to convert planes from one format to another, one color space to another etc.
Usersapce can take smart blending decisions and utilize these hardware supported plane color features to get accurate color profile. The same can help in consistent color quality from source to panel taking advantage of advanced color features in hardware.
Quoted 7 lines
These patches just add the property interfaces and enable helper functions. Based on community feedabck on this one, we can build up and add hardware specific implementation on top of this series.
Note: This is just to get a design feedback whether these interfaces look ok. Once, designed is agreed will re-send the series with a hardware specific implementation along with IGT tests for plane color.
What's missing from this is the property documentation for the userspace abi, like we have for the pipe color manager stuff:
https://dri.freedesktop.org/docs/drm/gpu/drm-kms.html#color-management-properties
Otherwise looks like a reasonable series, but the real challenges here is properly enabling this in a HDR (or at least color space) aware compositor. -Daniel
Quoted 30 lines
Uma Shankar (6):
drm: Add Plane Degamma properties
drm: Add Plane CTM property
drm: Add Plane Gamma properties
drm: Define helper function for plane color enabling
drm: Define helper to set legacy gamma table size drm/i915: Enable plane color featuresdrivers/gpu/drm/drm_atomic.c | 29 ++++++++++++++++++++ drivers/gpu/drm/drm_color_mgmt.c | 41 +++++++++++++++++++++++++++++ drivers/gpu/drm/drm_mode_config.c | 35 +++++++++++++++++++++++++ drivers/gpu/drm/drm_plane.c | 48 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 8 ++++++ drivers/gpu/drm/i915/intel_color.c | 14 ++++++++++ drivers/gpu/drm/i915/intel_display.c | 4 +++ drivers/gpu/drm/i915/intel_drv.h | 9 +++++++ drivers/gpu/drm/i915/intel_sprite.c | 4 +++ include/drm/drm_color_mgmt.h | 8 ++++++ include/drm/drm_mode_config.h | 28 ++++++++++++++++++++ include/drm/drm_plane.h | 31 ++++++++++++++++++++++ 12 files changed, 259 insertions(+)Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
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
Patchwork
CI✓ Fi.CI.IGT: success for Add Plane Color Properties
In reply to Uma Shankar== Series Details ==
== Series Details ==
Series: Add Plane Color Properties
URL : https://patchwork.freedesktop.org/series/30875/
State : success
== Summary ==
Test kms_plane:
Subgroup plane-panning-bottom-right-suspend-pipe-C-planes:
skip -> PASS (shard-hsw)
Subgroup plane-position-covered-pipe-A-planes:
skip -> PASS (shard-hsw)
Test kms_frontbuffer_tracking:
Subgroup fbc-1p-primscrn-spr-indfb-draw-mmap-wc:
skip -> PASS (shard-hsw)
Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
skip -> PASS (shard-hsw)
Test kms_vblank:
Subgroup query-forked-busy:
skip -> PASS (shard-hsw)
Test kms_atomic:
Subgroup plane_invalid_params_fence:
skip -> PASS (shard-hsw)
Test kms_chv_cursor_fail:
Subgroup pipe-B-64x64-bottom-edge:
skip -> PASS (shard-hsw)
Test kms_cursor_crc:
Subgroup cursor-64x64-sliding:
skip -> PASS (shard-hsw)
Test perf:
Subgroup blocking:
pass -> FAIL (shard-hsw) fdo#102252fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
shard-hsw total:2429 pass:1323 dwarn:6 dfail:0 fail:17 skip:1083 time:10000s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5812/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx