diff options
author | Leo (Sunpeng) Li <sunpeng.li@amd.com> | 2017-10-18 14:22:23 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-12-04 16:41:29 -0500 |
commit | 1c77d4eea7c7c441214c6f30416c7ee16f921fb0 (patch) | |
tree | f6fa4941be885c81cd5069b1fa6b570253cf0b12 /drivers/gpu/drm/amd | |
parent | f01a2cf0a613c52acf941c764f344aefb8949591 (diff) |
drm/amd/display: Only add stream to freesync when modeset required
This is a follow-up patch to:
Leo (Sunpeng) Li Cleanup code that enables freesync
We should only add a stream to freesync if a modeset was requested, so
we don't fill the core freesync map with pointless streams.
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r-- | drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 28 |
1 files changed, 21 insertions, 7 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 816aa426ddd3..f4bebdc60351 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | |||
@@ -4132,12 +4132,28 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) | |||
4132 | * are removed from freesync module | 4132 | * are removed from freesync module |
4133 | */ | 4133 | */ |
4134 | if (adev->dm.freesync_module) { | 4134 | if (adev->dm.freesync_module) { |
4135 | for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { | 4135 | for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { |
4136 | struct amdgpu_dm_connector *aconnector = NULL; | 4136 | struct amdgpu_dm_connector *aconnector = NULL; |
4137 | struct dm_connector_state *dm_new_con_state = NULL; | 4137 | struct dm_connector_state *dm_new_con_state = NULL; |
4138 | struct amdgpu_crtc *acrtc = NULL; | 4138 | struct amdgpu_crtc *acrtc = NULL; |
4139 | bool modeset_needed; | ||
4139 | 4140 | ||
4140 | dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); | 4141 | dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); |
4142 | dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); | ||
4143 | modeset_needed = modeset_required( | ||
4144 | new_crtc_state, | ||
4145 | dm_new_crtc_state->stream, | ||
4146 | dm_old_crtc_state->stream); | ||
4147 | /* We add stream to freesync if: | ||
4148 | * 1. Said stream is not null, and | ||
4149 | * 2. A modeset is requested. This means that the | ||
4150 | * stream was removed previously, and needs to be | ||
4151 | * replaced. | ||
4152 | */ | ||
4153 | if (dm_new_crtc_state->stream == NULL || | ||
4154 | !modeset_needed) | ||
4155 | continue; | ||
4156 | |||
4141 | acrtc = to_amdgpu_crtc(crtc); | 4157 | acrtc = to_amdgpu_crtc(crtc); |
4142 | 4158 | ||
4143 | aconnector = | 4159 | aconnector = |
@@ -4157,12 +4173,10 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) | |||
4157 | state, &aconnector->base); | 4173 | state, &aconnector->base); |
4158 | dm_new_con_state = to_dm_connector_state(new_con_state); | 4174 | dm_new_con_state = to_dm_connector_state(new_con_state); |
4159 | 4175 | ||
4160 | if (dm_new_crtc_state->stream) { | 4176 | mod_freesync_set_user_enable(adev->dm.freesync_module, |
4161 | mod_freesync_set_user_enable(adev->dm.freesync_module, | 4177 | &dm_new_crtc_state->stream, |
4162 | &dm_new_crtc_state->stream, | 4178 | 1, |
4163 | 1, | 4179 | &dm_new_con_state->user_enable); |
4164 | &dm_new_con_state->user_enable); | ||
4165 | } | ||
4166 | } | 4180 | } |
4167 | } | 4181 | } |
4168 | 4182 | ||