Skip to contentSkip to conversation

drm/ast: Don't check new mode if CRTC is being disabled

PATCH In review Thomas Zimmermann 3 participants 4 messages May 7, 2020 – Jan 24, 2022

Subsystems (4)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH v3 1/1 drm/ast: Don't check new mode if CRTC is being disabled

Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.

v3:
* fixed commit message
v2:
* added Tested-by/Reported-by tags
* added Fixes tags and CC (Sam)
* improved comment

Fixes b48e1b6ffd28 ("drm/ast: Add CRTC helpers for atomic modesetting")
Cc Thomas Zimmermann <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc <[email protected]> # v5.6+
---
 drivers/gpu/drm/ast/ast_mode.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_mode.c +3 -0
index 7a9f20a2fd303..0cbbb21edb4e1 100644
@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
+	if (!state->enable)
+		return 0; /* no mode checks if CRTC is being disabled */
+
 	ast_state = to_ast_crtc_state(state);
 
 	format = ast_state->format;
Signature · 1 line
2.26.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 10 lines · Thomas Zimmermann

Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.

v3:
* fixed commit message
v2:
* added Tested-by/Reported-by tags
* added Fixes tags and CC (Sam)
* improved comment

Quoted 10 lines
Fixes b48e1b6ffd28 ("drm/ast: Add CRTC helpers for atomic modesetting")
Cc Thomas Zimmermann <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc <[email protected]> # v5.6+

Yeah legacy crtc helpers just let you shut stuff off and no checks.

Quoted 21 lines
---
 drivers/gpu/drm/ast/ast_mode.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_mode.c +3 -0
index 7a9f20a2fd303..0cbbb21edb4e1 100644
@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
+	if (!state->enable)
+		return 0; /* no mode checks if CRTC is being disabled */
+
 	ast_state = to_ast_crtc_state(state);
 
 	format = ast_state->format;
Signature · 1 line
2.26.0
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
#2 lore raw
In reply to Thomas Zimmermann
Quoted 29 lines · Thomas Zimmermann

Suspending failed because there's no mode if the CRTC is being disabled. Early-out in this case. This fixes runtime PM for ast.

v3:
* fixed commit message
v2:
* added Tested-by/Reported-by tags
* added Fixes tags and CC (Sam)
* improved comment

Fixes b48e1b6ffd28 ("drm/ast: Add CRTC helpers for atomic modesetting")
Cc Thomas Zimmermann <[email protected]>
Cc Gerd Hoffmann <[email protected]>
Cc Dave Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc <[email protected]> # v5.6+
---
 drivers/gpu/drm/ast/ast_mode.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/ast/ast_mode.c +0 -0
index 7a9f20a2fd303..0cbbb21edb4e1 100644

drivers/gpu/drm/ast/ast_mode.c static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, · line 809

Quoted 9 lines
drivers/gpu/drm/ast/ast_mode.c +3 -0
@@ -801,6 +801,9 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
 		return -EINVAL;
 	}
 
+	if (!state->enable)
+		return 0; /* no mode checks if CRTC is being disabled */
+
 	ast_state = to_ast_crtc_state(state);
 
 	format = ast_state->format;

hey,
I'm seeing a regression that I bisected down to this change. I
installed GNOME on a couple of different server models that have AMI-based BMCs, which provide a web-based graphics display (virtual KVM). When I enter the lock screen on current upstream kernels, the display freezes, and I see the following messages appear in syslog whenever I generate keyboard/mouse events on that display:

Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Page flip discarded: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Page flip discarded: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Page flip discarded: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument

If I back out this change w/ the following patch (code has evolved slightly preventing a clean revert), then the lock screen once again behaves normally:

drivers/gpu/drm/ast/ast_mode.c +0 -3
index 956c8982192b..336c545c46f5 100644
@@ -1012,9 +1012,6 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
 	const struct drm_format_info *format;
 	bool succ;
 
-	if (!crtc_state->enable)
-		return 0; /* no mode checks if CRTC is being disabled */
-
 	ast_state = to_ast_crtc_state(crtc_state);
 
 	format = ast_state->format;

Apologies for noticing so long after the fact. I don't normally run a desktop environment on these servers, I just happened to be debugging something recently that required it.

-dann

author maintainer
#3 lore raw

Hi

Am 21.01.22 um 16:25 schrieb dann frazier:
[...]

Quoted 9 lines

hey,
I'm seeing a regression that I bisected down to this change. I
installed GNOME on a couple of different server models that have AMI-based BMCs, which provide a web-based graphics display (virtual KVM). When I enter the lock screen on current upstream kernels, the display freezes, and I see the following messages appear in syslog whenever I generate keyboard/mouse events on that display:

Quoted 7 lines
Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Page flip discarded: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Page flip discarded: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Page flip discarded: drmModeAtomicCommit: Invalid argument
Jan 19 20:34:53 starbuck gnome-shell[5002]: Failed to post KMS update: drmModeAtomicCommit: Invalid argument

Thanks for reporting. I'll investigate soon.

Best regards
Thomas

Quoted 26 lines

If I back out this change w/ the following patch (code has evolved slightly preventing a clean revert), then the lock screen once again behaves normally:

drivers/gpu/drm/ast/ast_mode.c +0 -3
index 956c8982192b..336c545c46f5 100644
@@ -1012,9 +1012,6 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc,
  	const struct drm_format_info *format;
  	bool succ;
 
-	if (!crtc_state->enable)
-		return 0; /* no mode checks if CRTC is being disabled */
-
  	ast_state = to_ast_crtc_state(crtc_state);
 
  	format = ast_state->format;

Apologies for noticing so long after the fact. I don't normally run a desktop environment on these servers, I just happened to be debugging something recently that required it.

-dann

Signature · 6 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev