[PATCH v5 1/4] drm: drm_helper_crtc_enable_color_mgmt() => drm_crtc_enable_color_mgmt()

Tomi Valkeinen tomi.valkeinen at ti.com
Thu May 26 09:05:32 UTC 2016


Hi Jyri, Daniel,

On 26/05/16 11:35, Jyri Sarha wrote:
> Add drm_crtc_enable_color_mgmt(), remove drm_helper_crtc_enable_color_mgmt()
> and update drm/i915-driver (the only user of the old function).
> 
> The new function is more flexible. It allows driver to enable only the
> features it has without forcing to enable all three color management
> properties: degamma lut, csc matrix (ctm), and gamma lut.
> 
> Suggested-by: Daniel Vetter <daniel at ffwll.ch>
> Signed-off-by: Jyri Sarha <jsarha at ti.com>

> +void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
> +				uint degamma_lut_size,
> +				bool has_ctm,
> +				uint gamma_lut_size)
> +{
> +	struct drm_device *dev = crtc->dev;
> +	struct drm_mode_config *config = &dev->mode_config;
> +
> +	if (degamma_lut_size) {
> +		drm_object_attach_property(&crtc->base,
> +					   config->degamma_lut_property, 0);
> +		drm_object_attach_property(&crtc->base,
> +					   config->degamma_lut_size_property,
> +					   degamma_lut_size);
> +	}
> +
> +	if (has_ctm)
> +		drm_object_attach_property(&crtc->base,
> +					   config->ctm_property, 0);
> +
> +	if (gamma_lut_size) {
> +		drm_object_attach_property(&crtc->base,
> +					   config->gamma_lut_property, 0);
> +		drm_object_attach_property(&crtc->base,
> +					   config->gamma_lut_size_property,
> +					   gamma_lut_size);
> +	}
> +}

As I mentioned, I think it would make sense to call
drm_mode_crtc_set_gamma_size() here. At least from omapdrm perspective.

I had a look at i915, and that one looks a bit odd. It always sets
drm_mode_crtc_set_gamma_size(256), but then only calls
drm_helper_crtc_enable_color_mgmt() if
INTEL_INFO(dev)->color.gamma_lut_size > 0, and gives gamma_lut_size as
the size.

Is there some legacy stuff at play here? drm_mode_crtc_set_gamma_size()
should always be 256 (as X expects that), but the GAMMA_LUT property can
give the real gamma lut size?

 Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160526/1af86fc5/attachment-0001.sig>


More information about the dri-devel mailing list