[RFC v4 5/8] drm: Define helper function for plane color enabling

Alexandru-Cosmin Gheorghe Alexandru-Cosmin.Gheorghe at arm.com
Tue Aug 21 09:46:18 UTC 2018


Hi Uma,

On Fri, Aug 17, 2018 at 07:48:48PM +0530, Uma Shankar wrote:
> Define helper function to enable Plane color features
> to attach plane color properties to plane structure.
> 
> v2: Rebase
> 
> v3: Modiefied the function to use updated property names.
> 
> v4: Rebase
> 
> Signed-off-by: Uma Shankar <uma.shankar at intel.com>
> ---
>  drivers/gpu/drm/drm_plane.c  | 42 ++++++++++++++++++++++++++++++++++++++++++
>  include/drm/drm_color_mgmt.h |  5 +++++
>  2 files changed, 47 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index d0bf10b..d1b4ac1 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -144,6 +144,48 @@ 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.
> + */
> +void drm_plane_enable_color_mgmt(struct drm_plane *plane,
> +				uint plane_degamma_lut_size,
> +				bool plane_has_ctm,
> +				uint plane_gamma_lut_size)
> +{
> +	if (plane_degamma_lut_size) {
> +		drm_object_attach_property(&plane->base,
> +				plane->degamma_lut_property, 0);
> +		drm_object_attach_property(&plane->base,
> +				plane->degamma_lut_size_property,
> +				plane_degamma_lut_size);
> +	}
> +
> +	if (plane_has_ctm)
> +		drm_object_attach_property(&plane->base,
> +				plane->ctm_property, 0);
> +
> +	if (plane_gamma_lut_size) {
> +		drm_object_attach_property(&plane->base,
> +				plane->gamma_lut_property, 0);
> +		drm_object_attach_property(&plane->base,
> +				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
> diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h
> index 44f04233..9b8e566 100644
> --- a/include/drm/drm_color_mgmt.h
> +++ b/include/drm/drm_color_mgmt.h
> @@ -68,4 +68,9 @@ int drm_plane_create_color_properties(struct drm_plane *plane,
>  				      u32 supported_ranges,
>  				      enum drm_color_encoding default_encoding,
>  				      enum drm_color_range default_range);
> +
> +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
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe at arm.com>

-- 
Cheers,
Alex G


More information about the dri-devel mailing list