[PATCH 27/29] drm/amd/display: Explicitly call ->reset for each object

Harry Wentland harry.wentland at amd.com
Fri Oct 27 19:33:12 UTC 2017


On 2017-10-26 10:51 PM, Andrey Grodzovsky wrote:
> 
> 
> On 2017-10-26 02:35 PM, Harry Wentland wrote:
>> We need to avoid calling reset after detection.
> 
> Could you explain why please ?

Reset creates new, clean atomic_state objects. In this case we want to attach the freesync_capable property on the atomic_state at detection (see next change to convert the property from legacy to atomic). Calling reset after detection would clear that.

> 
>> This is much simpler
>> if we call ->reset on the connector right after creation but before
>> detection. To stay consistent call ->reset on every other object
>> as well after creation.
>>
>> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
>> Reviewed-by: Roman Li <Roman.Li at amd.com>
>> Acked-by: Harry Wentland <harry.wentland at amd.com>
>> ---
>>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++++++++--
>>   1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> index 6fc043957bbf..62e8db1f113c 100644
>> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
>> @@ -1436,8 +1436,6 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
>>           goto fail;
>>       }
>>   -    drm_mode_config_reset(dm->ddev);
> 
> This is a standard helper called by many drivers on driver init , it's also called in drm_atomic_helper_resume
> which we use on resume from suspend so now it's kind of asymmetrical behavior.
> 

I'll have to take a look at the resume case. It seems atomic never intended to deal with immutable properties that are set in the driver (like freesync_capable). We might have to revisit that but in light of the fact that we need to redo these properties anyways in a generic fashion for upstream freesync I was hesitant to spend too much time on our non-upstream version of the freesync properties.

Harry

> Thanks,
> Andrey
> 
>> -
>>       return 0;
>>   fail:
>>       kfree(aencoder);
>> @@ -3105,6 +3103,11 @@ static int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm,
>>         drm_plane_helper_add(&aplane->base, &dm_plane_helper_funcs);
>>   +    /* Create (reset) the plane state */
>> +    if (aplane->base.funcs->reset)
>> +        aplane->base.funcs->reset(&aplane->base);
>> +
>> +
>>       return res;
>>   }
>>   @@ -3140,6 +3143,10 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
>>         drm_crtc_helper_add(&acrtc->base, &amdgpu_dm_crtc_helper_funcs);
>>   +    /* Create (reset) the plane state */
>> +    if (acrtc->base.funcs->reset)
>> +        acrtc->base.funcs->reset(&acrtc->base);
>> +
>>       acrtc->max_cursor_width = dm->adev->dm.dc->caps.max_cursor_size;
>>       acrtc->max_cursor_height = dm->adev->dm.dc->caps.max_cursor_size;
>>   @@ -3500,6 +3507,9 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
>>               &aconnector->base,
>>               &amdgpu_dm_connector_helper_funcs);
>>   +    if (aconnector->base.funcs->reset)
>> +        aconnector->base.funcs->reset(&aconnector->base);
>> +
>>       amdgpu_dm_connector_init_helper(
>>           dm,
>>           aconnector,
> 


More information about the amd-gfx mailing list