drm/ast: Fix black screen when getting out of suspend
Subsystems (3)
Jocelyn Falempe
reviewerPATCH 1/1 drm/ast: Fix black screen when getting out of suspend
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on DPMS_ON, to make sure the settings are correct.
I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/
--- drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/ast/ast_mode.c +13 -0
@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) {struct ast_private *ast =to_ast_private (crtc->dev);u8 ch =AST_DPMS_VSYNC_OFF |AST_DPMS_HSYNC_OFF ; +struct ast_crtc_state *ast_state; +const struct drm_format_info *format; +struct ast_vbios_mode_info *vbios_mode_info;/* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7).
@@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)ast_dp_set_on_off (crtc->dev,1 ); } + ast_state =to_ast_crtc_state (crtc->state); + format = ast_state->format; + +if (format){ + vbios_mode_info = &ast_state->vbios_mode_info; + +ast_set_color_reg (ast, format); +ast_set_vbios_color_reg (ast, format, vbios_mode_info); + } +ast_crtc_load_lut (ast, crtc);break ;case DRM_MODE_DPMS_STANDBY :
Signature · 1 line
2.36.1
Some small nitpicks:
Quoted 9 lines · Jocelyn Falempe
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on
DPMS_ON, to make sure the settings are correct.I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/Signed-off-by Jocelyn Falempe <[email protected]>Tested-by Venkat Tadikonda <[email protected]>
Should have a Cc: to stable imho, dim can do this for you:
https://drm.pages.freedesktop.org/maintainer-tools/dim.html
Quoted 23 lines
---
drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++1 file changed, 13 insertions(+)drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) { struct ast_private *ast = to_ast_private(crtc->dev); u8 ch = AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF; + struct ast_crtc_state *ast_state; + const struct drm_format_info *format; + struct ast_vbios_mode_info *vbios_mode_info;
/* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7).drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) ast_dp_set_on_off(crtc->dev, 1); }
Quoted 5 lines
+ ast_state =to_ast_crtc_state(crtc->state); + format =ast_state->format;
+
+ if (format){
Should be a space between ')' and '{'.
With that fixed, this is: Reviewed-by: Lyude Paul <[email protected]>
Quoted 10 lines
+ vbios_mode_info =
&ast_state->vbios_mode_info; +
+ ast_set_color_reg(ast, format);
+ ast_set_vbios_color_reg(ast, format,vbios_mode_info);
+ }
+
ast_crtc_load_lut(ast, crtc);
break;
caseDRM_MODE_DPMS_STANDBY:
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat
Jocelyn Falempe
reviewerQuoted 10 lines · Lyude Paul
Some small nitpicks:
Quoted 7 lines · Jocelyn Falempe
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on
DPMS_ON, to make sure the settings are correct.I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/
Quoted 6 lines
Quoted 2 lines
Signed-off-by Jocelyn Falempe <[email protected]>Tested-by Venkat Tadikonda <[email protected]>Should have a Cc: to stable imho,
dimcan do this for you:
Sure I will add cc to stable for the v2
Quoted 25 lines
Quoted 25 lines
--- drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) { struct ast_private *ast = to_ast_private(crtc->dev); u8 ch = AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF; + struct ast_crtc_state *ast_state; + const struct drm_format_info *format; + struct ast_vbios_mode_info *vbios_mode_info; /* TODO: Maybe control display signal generation with* Sync Enable (bit CR17.7).
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) ast_dp_set_on_off(crtc->dev, 1); }
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) · line 1016
Quoted 4 lines
drivers/gpu/drm/ast/ast_mode.c +4
-0+ ast_state = to_ast_crtc_state(crtc->state); + format = ast_state->format; + + if (format){Should be a space between ')' and '{'.
looks like I forget to run checkpatch.pl on it before sending :(
I'll wait a bit for other comments, and sent a v2 with cc for stable.
Quoted 14 lines
With that fixed, this is: Reviewed-by: Lyude Paul <[email protected]>
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +6
-0+ vbios_mode_info = &ast_state->vbios_mode_info; + + ast_set_color_reg(ast, format); + ast_set_vbios_color_reg(ast, format, vbios_mode_info); + } + ast_crtc_load_lut(ast, crtc);break;
caseDRM_MODE_DPMS_STANDBY:
Jocelyn Falempe
reviewerQuoted 11 lines · Jocelyn Falempe
Quoted 10 lines · Lyude Paul
Some small nitpicks:
Quoted 7 lines · Jocelyn Falempe
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on
DPMS_ON, to make sure the settings are correct.I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Jocelyn Falempe <[email protected]>Tested-by Venkat Tadikonda <[email protected]>Should have a Cc: to stable imho,
dimcan do this for you:Sure I will add cc to stable for the v2
In fact it doesn't apply to older kernel version, (it depends on 594e9c04b586 Create the driver for ASPEED proprietory Display-Port).
So I think I will just push it to drm-misc-next, with the indentation fixed.
Quoted 49 lines
Quoted 22 lines
Quoted 22 lines
---
drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++1 file changed, 13 insertions(+)drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) { struct ast_private *ast = to_ast_private(crtc->dev); u8 ch = AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF; + struct ast_crtc_state *ast_state; + const struct drm_format_info *format; + struct ast_vbios_mode_info *vbios_mode_info; /* TODO: Maybe control display signal generation with* Sync Enable (bit CR17.7). @@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) · line 1016
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +4
-0ast_dp_set_on_off(crtc->dev, 1); } + ast_state = to_ast_crtc_state(crtc->state); + format = ast_state->format; + + if (format){Should be a space between ')' and '{'.
looks like I forget to run checkpatch.pl on it before sending :(
I'll wait a bit for other comments, and sent a v2 with cc for stable.
Quoted 14 lines
With that fixed, this is: Reviewed-by: Lyude Paul <[email protected]>
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +6
-0+ vbios_mode_info = &ast_state->vbios_mode_info; + + ast_set_color_reg(ast, format); + ast_set_vbios_color_reg(ast, format, vbios_mode_info); + } + ast_crtc_load_lut(ast, crtc);break;
caseDRM_MODE_DPMS_STANDBY:
Thomas Zimmermann
maintainerAm 27.06.22 um 09:31 schrieb Jocelyn Falempe:
Quoted 17 lines · Jocelyn Falempe
Quoted 16 lines · Lyude Paul
Quoted 15 lines
Some small nitpicks:
Quoted 9 lines · Jocelyn Falempe
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on
DPMS_ON, to make sure the settings are correct.I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/Signed-off-by Jocelyn Falempe <[email protected]>Tested-by Venkat Tadikonda <[email protected]>Should have a Cc: to stable imho,
dimcan do this for you:
Quoted 7 lines
Quoted 3 lines
Sure I will add cc to stable for the v2
In fact it doesn't apply to older kernel version, (it depends on
594e9c04b586Create the driver for ASPEED proprietory Display-Port).So I think I will just push it to drm-misc-next, with the indentation fixed.
Sure, go ahead.
Quoted 52 lines
Quoted 51 lines
Quoted 24 lines
Quoted 24 lines
---
drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++1 file changed, 13 insertions(+)drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc,int
mode)
{
structast_private*ast =to_ast_private(crtc->dev); u8 ch =AST_DPMS_VSYNC_OFF|AST_DPMS_HSYNC_OFF; + structast_crtc_state*ast_state;
+ const structdrm_format_info*format;
+ structast_vbios_mode_info*vbios_mode_info; /* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7).drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) · line 1016
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +4
-0ast_dp_set_on_off(crtc->dev, 1); } + ast_state = to_ast_crtc_state(crtc->state); + format = ast_state->format; + + if (format){Should be a space between ')' and '{'.
looks like I forget to run checkpatch.pl on it before sending :(
I'll wait a bit for other comments, and sent a v2 with cc for stable.
Quoted 14 lines
With that fixed, this is: Reviewed-by: Lyude Paul <[email protected]>
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +6
-0+ vbios_mode_info = &ast_state->vbios_mode_info; + + ast_set_color_reg(ast, format); + ast_set_vbios_color_reg(ast, format, vbios_mode_info); + } + ast_crtc_load_lut(ast, crtc);break;
caseDRM_MODE_DPMS_STANDBY:
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
Quoted 22 lines · Thomas Zimmermann
Am 27.06.22 um 09:31 schrieb Jocelyn Falempe:
Quoted 19 lines · Jocelyn Falempe
Quoted 18 lines · Lyude Paul
Quoted 16 lines
Some small nitpicks:
Quoted 9 lines · Jocelyn Falempe
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on
DPMS_ON, to make sure the settings are correct.I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/Signed-off-by Jocelyn Falempe <[email protected]>Tested-by Venkat Tadikonda <[email protected]>Should have a Cc: to stable imho,
dimcan do this for you:
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Sure I will add cc to stable for the v2
In fact it doesn't apply to older kernel version, (it depends on
594e9c04b586Create the driver for ASPEED proprietory Display-Port).So I think I will just push it to drm-misc-next, with the indentation fixed.
Sure, go ahead.
Applied to drm-misc-next, thank you all.
Quoted 54 lines
Quoted 53 lines
Quoted 52 lines
Quoted 25 lines
Quoted 25 lines
---
drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++1 file changed, 13 insertions(+)drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) { struct ast_private *ast = to_ast_private(crtc->dev); u8 ch = AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF; + struct ast_crtc_state *ast_state; + const struct drm_format_info *format; + struct ast_vbios_mode_info *vbios_mode_info; /* TODO: Maybe control display signal generation with* Sync Enable (bit CR17.7).
drivers/gpu/drm/ast/ast_mode.c +0
-0@@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)Quoted 8 lines
drivers/gpu/drm/ast/ast_mode.c static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) · line 1016
Quoted 6 lines
drivers/gpu/drm/ast/ast_mode.c +4
-0ast_dp_set_on_off(crtc->dev, 1); } + ast_state = to_ast_crtc_state(crtc->state); + format = ast_state->format; + + if (format){Should be a space between ')' and '{'.
looks like I forget to run checkpatch.pl on it before sending :(
I'll wait a bit for other comments, and sent a v2 with cc for stable.
Quoted 14 lines
With that fixed, this is: Reviewed-by: Lyude Paul <[email protected]>
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +6
-0+ vbios_mode_info = &ast_state->vbios_mode_info; + + ast_set_color_reg(ast, format); + ast_set_vbios_color_reg(ast, format, vbios_mode_info); + } + ast_crtc_load_lut(ast, crtc);break;
caseDRM_MODE_DPMS_STANDBY:
Hi
Am 22.06.22 um 14:48 schrieb Jocelyn Falempe:
Quoted 9 lines
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on
DPMS_ON, to make sure the settings are correct.I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/Signed-off-by Jocelyn Falempe <[email protected]>Tested-by Venkat Tadikonda <[email protected]>
With the small fixes that Lyude mentioned:
Best regards
Thomas
Quoted 35 lines
--- drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/gpu/drm/ast/ast_mode.c +13
-0@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) {struct ast_private *ast =to_ast_private (crtc->dev);u8 ch =AST_DPMS_VSYNC_OFF |AST_DPMS_HSYNC_OFF ; +struct ast_crtc_state *ast_state; +const struct drm_format_info *format; +struct ast_vbios_mode_info *vbios_mode_info;/* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7). @@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)ast_dp_set_on_off (crtc->dev,1 ); } + ast_state =to_ast_crtc_state (crtc->state); + format = ast_state->format; + +if (format){ + vbios_mode_info = &ast_state->vbios_mode_info; + +ast_set_color_reg (ast, format); +ast_set_vbios_color_reg (ast, format, vbios_mode_info); + } +ast_crtc_load_lut (ast, crtc);break ;case DRM_MODE_DPMS_STANDBY :
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
Hi
Am 22.06.22 um 14:48 schrieb Jocelyn Falempe:
Quoted 31 lines
With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on
DPMS_ON, to make sure the settings are correct.I didn't write this code, it comes from the out-of-tree aspeed driver v1.13
https://www.aspeedtech.com/support_driver/Signed-off-by Jocelyn Falempe <[email protected]>Tested-by Venkat Tadikonda <[email protected]>--- drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/gpu/drm/ast/ast_mode.c +3
-0@@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) {struct ast_private *ast =to_ast_private (crtc->dev);u8 ch =AST_DPMS_VSYNC_OFF |AST_DPMS_HSYNC_OFF ; +struct ast_crtc_state *ast_state; +const struct drm_format_info *format; +struct ast_vbios_mode_info *vbios_mode_info;/* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7). @@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode)ast_dp_set_on_off (crtc->dev,1 ); }
drivers/gpu/drm/ast/ast_mode.c static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) · line 1022
Quoted 10 lines
drivers/gpu/drm/ast/ast_mode.c +10
-0+ ast_state =to_ast_crtc_state (crtc->state); + format = ast_state->format; + +if (format){ + vbios_mode_info = &ast_state->vbios_mode_info; + +ast_set_color_reg (ast, format); +ast_set_vbios_color_reg (ast, format, vbios_mode_info); + } +
I've seen suspend issues on other AST devices besides the 2600. This seems to be an improvement on AST2300 at least. Therefore
The DPMS code need to be integrated into atomic_enable at some point. (It's for a later patchset.) It's a relict of the old non-atomic modesetting that never got done correctly.
Best regards
Thomas
Quoted 3 lines
drivers/gpu/drm/ast/ast_mode.c +0
-0ast_crtc_load_lut (ast, crtc);break ;case DRM_MODE_DPMS_STANDBY :
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