[PATCH 4/7] drm/omap: Implement CTM property for CRTC using OVL managers CPR matrix

Jyri Sarha jsarha at ti.com
Thu Sep 5 10:00:51 UTC 2019


On 05/09/2019 00:52, Laurent Pinchart wrote:
>>>>>>  static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
>>>>>>  {
>>>>>>  	struct omap_drm_private *priv = crtc->dev->dev_private;
>>>>>> @@ -402,7 +428,16 @@ static void omap_crtc_write_crtc_properties(struct drm_crtc *crtc)
>>>>>>  	info.default_color = 0x000000;
>>>>>>  	info.trans_enabled = false;
>>>>>>  	info.partial_alpha_enabled = false;
>>>>>> -	info.cpr_enable = false;
>>>>>> +
>>>>>> +	if (crtc->state->ctm) {
>>>>>> +		struct drm_color_ctm *ctm =
>>>>>> +			(struct drm_color_ctm *) crtc->state->ctm->data;
>>>>>> +
>>>>>> +		info.cpr_enable = true;
>>>>>> +		omap_crtc_cpr_coefs_from_ctm(ctm, &info.cpr_coefs);
>>>>> As an optimisation it would be nice to only write the coefficients when
>>>>> they actually change. That could be implemented on top of this series.
>>>> E.g. apply this ?
>>>>
>>>> - if (crtc->state->ctm)
>>>> + if (crtc->state->color_mgmt_changed && crtc->state->ctm)
>>> Something like that, but .mgr_setup() should then be taught not to write
>>> unchanged CTM tables to registers. Do you think it would be worth it ?
>> Hmmm, jess I should do it like this:
>> if (crtc->state->color_mgmt_changed) {
>> 	if (crtc->state->ctm) {
>> ...
>>>>>> +	} else {
>>>>>> +		info.cpr_enable = false;
>>>>>> +	}
>> }
>>
>> This way the whole CPR functionality is turned off, if the there is no
>> CTM in the crtc state.
> Yes, but you would also need to update .mgr_setup() :-) A new
> color_mgmt_changed flag would be needed in the info structure too.
> 

I am starting to thing that such an "optimization" may not be worth the
added complexity. The arithmetic and writing three registers is not that
costly and we do not commit a new crtc state that often.

If we later consider otherwise we can add the optimization as a separate
patch.

BR,
Jyri

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki


More information about the dri-devel mailing list