[PATCH xf86-video-amdgpu 02/13] Push color properties to kernel DRM on CRTC init

Michel Dänzer michel at daenzer.net
Fri May 18 07:52:37 UTC 2018


On 2018-05-17 11:43 PM, Leo Li wrote:
> On 2018-05-16 01:08 PM, Michel Dänzer wrote:
>> On 2018-05-03 08:31 PM, sunpeng.li at amd.com wrote:
>>>
>>> @@ -1458,6 +1586,14 @@ drmmode_crtc_init(ScrnInfoPtr pScrn,
>>> drmmode_ptr drmmode, drmModeResPtr mode_res
>>>       drmmode_crtc->ctm->matrix[0] = drmmode_crtc->ctm->matrix[4] =
>>>           drmmode_crtc->ctm->matrix[8] = (uint64_t)1 << 32;
>>>   +    /* Push properties to initialize them */
>>> +    for (i = 0; i < CM_NUM_PROPS; i++) {
>>> +        if (i == CM_DEGAMMA_LUT_SIZE || i == CM_GAMMA_LUT_SIZE)
>>> +            continue;
>>> +        if (drmmode_crtc_push_cm_prop(crtc, i))
>>> +            return 0;
>>
>> Per my follow-up to the cover letter, I don't think this should be
>> necessary here anyway, but FWIW:
>>
>> Returning 0 early here breaks the pAMDGPUEnt->assigned_crtcs related
>> logic in this function and drmmode_pre_init.
> 
> I originally thought it'd make sense if DDX pushes the properties on
> init, to maintain consistency between what DDX initially reports, and
> what DRM is using. It would also reset color properties if X was restarted.

My point was that this will happen from drmmode_set_mode_major anyway,
therefore no need to do it here.

OTOH if the properties are preserved by the kernel, it might make sense
to only do it here and from drmmode_crtc_gamma_set, not from
drmmode_set_mode_major.


> The other way around could also work, which I assume is what you're
> suggesting? i.e. pull all color properties from DRM into the
> driver-private crtc on crtc init, instead of pushing it to kernel?

That's not what I meant, and I suspect that would be tricky. E.g. how
could we separate the pulled values into the legacy and advanced LUTs?
And what if console (or whatever was displaying before) was using a
different colour depth (could even be 8 bpp pseudo colour)?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the amd-gfx mailing list