Skip to contentSkip to conversation

drm/ast: Fix black screen when getting out of suspend

PATCH In review Jocelyn Falempe 3 participants 8 messages Jun 22, 2022 – Jun 27, 2022

Subsystems (3)
lore
Share & tools
lore

Jocelyn Falempe

author reviewer
#0 lore raw

PATCH 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
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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
#1 lore raw

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/

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
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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;
        case DRM_MODE_DPMS_STANDBY:

Signature · 3 lines
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat
author reviewer
#2 lore raw
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 6 lines
Quoted 2 lines

Should have a Cc: to stable imho, dim can do this for you:

https://drm.pages.freedesktop.org/maintainer-tools/dim.html

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
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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;
        case DRM_MODE_DPMS_STANDBY:

author reviewer
#3 lore raw
Quoted 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

Should have a Cc: to stable imho, dim can do this for you:

https://drm.pages.freedesktop.org/maintainer-tools/dim.html

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
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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 -0
                          ast_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;
         case DRM_MODE_DPMS_STANDBY:

#4 lore raw

Am 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/

Should have a Cc: to stable imho, dim can do this for you:

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

https://drm.pages.freedesktop.org/maintainer-tools/dim.html

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.

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
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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 -0
                          ast_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;
         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
author reviewer Applied
#5 lore raw
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/

Should have a Cc: to stable imho, dim can do this for you:

https://drm.pages.freedesktop.org/maintainer-tools/dim.html

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 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.

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
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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 -0
                          ast_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;
         case DRM_MODE_DPMS_STANDBY:

maintainer Acked-by on v1 1/1
#6 lore raw
In reply to Jocelyn Falempe

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/

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
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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
maintainer Tested-by on v1 1/1
#7 lore raw
In reply to Jocelyn Falempe

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/

---
  drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/gpu/drm/ast/ast_mode.c +3 -0
index 3eb9afecd9d4..cdddcb5c4439 100644
@@ -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 -0
  		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