Skip to contentSkip to conversation

drm/amd/display: Don't fail atomic check in MST S3 topology change

PATCH In review Jerry (Fangzhi) Zuo 2 participants 3 messages Jan 10, 2019 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Don't fail atomic check in MST S3 topology change

In MST S3 topology change, dc_sink is created in .get_mode hook later than the resume sequence. No stream created in atomic check is normal in MST S3 resume. In such case, mark false to mode_changed flag to skip the check in dm_crtc_helper_atomic_check(), instead of returning error.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -4
index a9ed225d2ae0..6e03b2cf0adb 100644
@@ -5628,10 +5628,9 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm,
 		 */
 
 		if (!new_stream) {
-			DRM_DEBUG_DRIVER("%s: Failed to create new stream for crtc %d\n",
-					__func__, acrtc->base.base.id);
-			ret = -ENOMEM;
-			goto fail;
+			new_crtc_state->mode_changed = false;
+			DRM_DEBUG_DRIVER("Mode change not expected on %s\n", aconnector->base.name);
+			goto next_crtc;
 		}
 
 		dm_new_crtc_state->abm_level = dm_new_conn_state->abm_level;
Signature · 6 lines
2.14.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

JFYI: In the future patches like this should also be sent to [email protected]

Anyway, sorry but NAK

It's usually OK to set crtc_state->mode_changed = true, but it's never okay to set it to false from atomic check code. This is because atomic helpers will sometimes force modesets in situations where they're required but might not otherwise happen (in fact-this is something we'll be doing in the MST helpers once we've implemented fallback link retraining support), so if you unset mode_changed you're breaking part of the atomic state and those helpers.

Additionally, I'm not sure what problem this is supposed to fix? We already have fixes for the suspend/resume issues on amdgpu, and I made amdgpu not fail the suspend/resume process if the atomic check fails since that's the behavior other drivers follow as well. We do eventually want to come up with a solution for atomic checks failing mid suspend/resume, but since I don't know of any cases this has ever broken userspace it's not really a priority right now. Fixing this is a lot more difficult then it seems: we can't change the state that userspace has set, but we also can't just "turn off" atomic checks per- say for states that aren't physically possible anymore after resume due to connector changes and that sort of thing.

Quoted 33 lines · Jerry (Fangzhi) Zuo

In MST S3 topology change, dc_sink is created in .get_mode hook later than the resume sequence. No stream created in atomic check is normal in MST S3 resume. In such case, mark false to mode_changed flag to skip the check in dm_crtc_helper_atomic_check(), instead of returning error.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -4
index a9ed225d2ae0..6e03b2cf0adb 100644
@@ -5628,10 +5628,9 @@ static int dm_update_crtc_state(struct
 amdgpu_display_manager *dm,
 		 */
 
 		if (!new_stream) {
-			DRM_DEBUG_DRIVER("%s: Failed to create new stream for
 crtc %d\n",
-					__func__, acrtc->base.base.id);
-			ret = -ENOMEM;
-			goto fail;
+			new_crtc_state->mode_changed = false;
+			DRM_DEBUG_DRIVER("Mode change not expected on %s\n",
 aconnector->base.name);
+			goto next_crtc;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
 		}
 
 		dm_new_crtc_state->abm_level = dm_new_conn_state->abm_level;
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 12f8b527f80ee848adda1f459486887282cd8faf.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

author
#4 lore raw

OK, I see your point. I originally found this issue that fails in dm_resume() due to the crtc check failure (no stream but mode set required). I'll remove it.

Jerry

-----Original Message-----
From: Lyude Paul <[email protected]>
Sent: January 10, 2019 4:26 PM
To: Zuo, Jerry <[email protected]>; [email protected]; Wentland, Harry <[email protected]>
Subject: Re: [PATCH] drm/amd/display: Don't fail atomic check in MST S3 topology change

JFYI: In the future patches like this should also be sent to [email protected]

Anyway, sorry but NAK

It's usually OK to set crtc_state->mode_changed = true, but it's never okay to set it to false from atomic check code. This is because atomic helpers will sometimes force modesets in situations where they're required but might not otherwise happen (in fact-this is something we'll be doing in the MST helpers once we've implemented fallback link retraining support), so if you unset mode_changed you're breaking part of the atomic state and those helpers.

Additionally, I'm not sure what problem this is supposed to fix? We already have fixes for the suspend/resume issues on amdgpu, and I made amdgpu not fail the suspend/resume process if the atomic check fails since that's the behavior other drivers follow as well. We do eventually want to come up with a solution for atomic checks failing mid suspend/resume, but since I don't know of any cases this has ever broken userspace it's not really a priority right now. Fixing this is a lot more difficult then it seems: we can't change the state that userspace has set, but we also can't just "turn off" atomic checks per- say for states that aren't physically possible anymore after resume due to connector changes and that sort of thing.

Quoted 30 lines · Jerry (Fangzhi) Zuo

In MST S3 topology change, dc_sink is created in .get_mode hook later than the resume sequence. No stream created in atomic check is normal in MST S3 resume. In such case, mark false to mode_changed flag to skip the check in dm_crtc_helper_atomic_check(), instead of returning error.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -4
index a9ed225d2ae0..6e03b2cf0adb 100644
@@ -5628,10 +5628,9 @@ static int dm_update_crtc_state(struct 
 amdgpu_display_manager *dm,
 		 */
 
 		if (!new_stream) {
-			DRM_DEBUG_DRIVER("%s: Failed to create new stream for
 crtc %d\n",
-					__func__, acrtc->base.base.id);
-			ret = -ENOMEM;
-			goto fail;
+			new_crtc_state->mode_changed = false;
+			DRM_DEBUG_DRIVER("Mode change not expected on %s\n",
 aconnector->base.name);
+			goto next_crtc;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c static int dm_update_crtc_state(struct amdgpu_display_manager *dm, · line 5636

Quoted 3 lines
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +0 -0
 		}
 
 		dm_new_crtc_state->abm_level = dm_new_conn_state->abm_level;

--
Cheers,
Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx