drm/amd/display: Atomic freesync ASSERT fix
authorBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Mon, 16 Oct 2017 19:51:00 +0000 (15:51 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 4 Dec 2017 21:41:28 +0000 (16:41 -0500)
Changes to atomic set property for freesync.

Now In set property, just set the freesync variables and return 0.
Based on the variables call mod_freesync_set_user_enable() inside
commit_tail

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index b2359bc4900d9a0233f3849cba964ff8e4643db5..e99ba554f5b9cde0cc3307bc92b10c6183a56269 100644 (file)
@@ -4154,6 +4154,33 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                        mod_freesync_add_stream(adev->dm.freesync_module,
                                                new_stream, &aconnector->caps);
                }
+
+               list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
+
+                       struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
+                       struct amdgpu_dm_connector *aconnector = NULL;
+                       struct dm_connector_state *conn_state = NULL;
+                       struct dm_crtc_state *acrtc_state = NULL;
+
+                       acrtc_state = to_dm_crtc_state(acrtc->base.state);
+
+
+                       aconnector =
+                               amdgpu_dm_find_first_crtc_matching_connector(
+                                       state,
+                                       crtc,
+                                       false);
+                       if (aconnector) {
+                               conn_state = to_dm_connector_state(aconnector->base.state);
+
+                               if (new_stream) {
+                                       mod_freesync_set_user_enable(adev->dm.freesync_module,
+                                                                    &acrtc_state->stream,
+                                                                    1,
+                                                                    &conn_state->user_enable);
+                               }
+                       }
+               }
        }
 
        if (dm_state->context)