Skip to contentSkip to conversation

drm/ast: Fix no display at WayLand after power-off

PATCH In review Jammy Huang 2 participants 3 messages Dec 9, 2022 – Dec 12, 2022

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

PATCH 1/1 drm/ast: Fix no display at WayLand after power-off

With WayLand, there is error log when display waken up from power-off:
gnome-shell: Failed to post KMS update: CRTC property (GAMMA_LUT) not found
gnome-shell: Page flip discarded: CRTC property (GAMMA_LUT) not found

To fix the issue, enable GAMMA_LUT property on CRTC.

---
 drivers/gpu/drm/ast/ast_drv.h  | 2 ++
 drivers/gpu/drm/ast/ast_mode.c | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_drv.h +2 -0
index 2e44b971c3a6..fd9af1cf0563 100644
@@ -86,6 +86,8 @@ enum ast_tx_chip {
 #define AST_DRAM_4Gx16   7
 #define AST_DRAM_8Gx16   8
 
+#define MAX_COLOR_LUT_ENTRIES 256
+
 /*
  * Cursor plane
  */
drivers/gpu/drm/ast/ast_mode.c +3 -2
index 1bc0220e6783..87bd9697bb44 100644
@@ -74,7 +74,7 @@ static void ast_crtc_load_lut(struct ast_private *ast, struct drm_crtc *crtc)
 	g = r + crtc->gamma_size;
 	b = g + crtc->gamma_size;
 
-	for (i = 0; i < 256; i++)
+	for (i = 0; i < MAX_COLOR_LUT_ENTRIES; i++)
 		ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8);
 }
 
@@ -1323,7 +1323,8 @@ static int ast_crtc_init(struct drm_device *dev)
 	if (ret)
 		return ret;
 
-	drm_mode_crtc_set_gamma_size(crtc, 256);
+	drm_crtc_enable_color_mgmt(crtc, 0, false, MAX_COLOR_LUT_ENTRIES);
+	drm_mode_crtc_set_gamma_size(crtc, MAX_COLOR_LUT_ENTRIES);
 	drm_crtc_helper_add(crtc, &ast_crtc_helper_funcs);
 
 	return 0;

base-commit: 8ed710da2873c2aeb3bb805864a699affaf1d03b

Signature · 1 line
2.25.1
#1 lore raw

Hi

Am 09.12.22 um 10:11 schrieb Jammy Huang:

Quoted 5 lines

With WayLand, there is error log when display waken up from power-off:
gnome-shell: Failed to post KMS update: CRTC property (GAMMA_LUT) not found
gnome-shell: Page flip discarded: CRTC property (GAMMA_LUT) not found

To fix the issue, enable GAMMA_LUT property on CRTC.

This code has long been replaced by commit ce7fcf700386 ("drm/ast: Add Atomic gamma lut support for aspeed"), which adds proper color management to ast.

Please only submit patches for the latest driver in drm-misc-next.

Best regards
Thomas

Quoted 45 lines
---
  drivers/gpu/drm/ast/ast_drv.h  | 2 ++
  drivers/gpu/drm/ast/ast_mode.c | 5 +++--
  2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_drv.h +2 -0
index 2e44b971c3a6..fd9af1cf0563 100644
@@ -86,6 +86,8 @@ enum ast_tx_chip {
  #define AST_DRAM_4Gx16   7
  #define AST_DRAM_8Gx16   8
 
+#define MAX_COLOR_LUT_ENTRIES 256
+
  /*
   * Cursor plane
   */
drivers/gpu/drm/ast/ast_mode.c +3 -2
index 1bc0220e6783..87bd9697bb44 100644
@@ -74,7 +74,7 @@ static void ast_crtc_load_lut(struct ast_private *ast, struct drm_crtc *crtc)
  	g = r + crtc->gamma_size;
  	b = g + crtc->gamma_size;
 
-	for (i = 0; i < 256; i++)
+	for (i = 0; i < MAX_COLOR_LUT_ENTRIES; i++)
  		ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8);
  }
 
@@ -1323,7 +1323,8 @@ static int ast_crtc_init(struct drm_device *dev)
  	if (ret)
  		return ret;
 
-	drm_mode_crtc_set_gamma_size(crtc, 256);
+	drm_crtc_enable_color_mgmt(crtc, 0, false, MAX_COLOR_LUT_ENTRIES);
+	drm_mode_crtc_set_gamma_size(crtc, MAX_COLOR_LUT_ENTRIES);
  	drm_crtc_helper_add(crtc, &ast_crtc_helper_funcs);
 
  	return 0;

base-commit: 8ed710da2873c2aeb3bb805864a699affaf1d03b

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
#2 lore raw

Hi Thomas,

OK. Thanks for the reminder.

Quoted 59 lines · Thomas Zimmermann

Hi

Am 09.12.22 um 10:11 schrieb Jammy Huang:

Quoted 5 lines

With WayLand, there is error log when display waken up from power-off:
gnome-shell: Failed to post KMS update: CRTC property (GAMMA_LUT) not found
gnome-shell: Page flip discarded: CRTC property (GAMMA_LUT) not found

To fix the issue, enable GAMMA_LUT property on CRTC.

This code has long been replaced by commit ce7fcf700386 ("drm/ast: Add Atomic gamma lut support for aspeed"), which adds proper color management to ast.

Please only submit patches for the latest driver in drm-misc-next.

Best regards
Thomas

Quoted 42 lines

---
  drivers/gpu/drm/ast/ast_drv.h  | 2 ++
  drivers/gpu/drm/ast/ast_mode.c | 5 +++--

  2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_drv.h +0 -0
index 2e44b971c3a6..fd9af1cf0563 100644
@@ -86,6 +86,8 @@ enum ast_tx_chip {
   #define AST_DRAM_4Gx16   7
   #define AST_DRAM_8Gx16   8

  +#define MAX_COLOR_LUT_ENTRIES 256
+
  /*
   * Cursor plane
   */

drivers/gpu/drm/ast/ast_mode.c +1 -0
index 1bc0220e6783..87bd9697bb44 100644
@@ -74,7 +74,7 @@ static void ast_crtc_load_lut(struct ast_private 
 *ast, struct drm_crtc *crtc)
       g = r + crtc->gamma_size;
       b = g + crtc->gamma_size;
   -    for (i = 0; i < 256; i++)
+    for (i = 0; i < MAX_COLOR_LUT_ENTRIES; i++)

          ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++

Quoted 1 line
Quoted 1 line

8);

  }
  @@ -1323,7 +1323,8 @@ static int ast_crtc_init(struct drm_device *dev) if (ret)
          return ret;
  -    drm_mode_crtc_set_gamma_size(crtc, 256);
+    drm_crtc_enable_color_mgmt(crtc, 0, false, MAX_COLOR_LUT_ENTRIES); +    drm_mode_crtc_set_gamma_size(crtc, MAX_COLOR_LUT_ENTRIES); drm_crtc_helper_add(crtc, &ast_crtc_helper_funcs); return 0;

base-commit: 8ed710da2873c2aeb3bb805864a699affaf1d03b

Signature · 2 lines
Best Regards
Jammy