The atomic modesetting code tried to distinguish format changes from full modesetting operations. But the implementation was buggy and the format registers were often updated even for simple pageflips.
Fix this problem by distinguishing between format and mode changes; and handle each in it's own branch.
Signed-off-by: Thomas Zimmermann tzimmermann@suse.de Fixes: 4961eb60f145 ("drm/ast: Enable atomic modesetting") Cc: Thomas Zimmermann tzimmermann@suse.de Cc: Gerd Hoffmann kraxel@redhat.com Cc: Dave Airlie airlied@redhat.com Cc: Daniel Vetter daniel.vetter@ffwll.ch Cc: Sam Ravnborg sam@ravnborg.org Cc: Emil Velikov emil.l.velikov@gmail.com Cc: "Y.C. Chen" yc_chen@aspeedtech.com Cc: stable@vger.kernel.org # v5.6+ --- drivers/gpu/drm/ast/ast_mode.c | 52 ++++++++++++++++------------------ 1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 62fe682a7de6..b129833c0821 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -768,34 +768,32 @@ static void ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, { struct drm_device *dev = crtc->dev; struct ast_private *ast = to_ast_private(dev); - struct ast_crtc_state *ast_state; - const struct drm_format_info *format; - struct ast_vbios_mode_info *vbios_mode_info; - struct drm_display_mode *adjusted_mode; - - ast_state = to_ast_crtc_state(crtc->state); - - format = ast_state->format; - if (!format) - return; - - vbios_mode_info = &ast_state->vbios_mode_info; - - ast_set_color_reg(ast, format); - ast_set_vbios_color_reg(ast, format, vbios_mode_info); - - if (!crtc->state->mode_changed) - return; - - adjusted_mode = &crtc->state->adjusted_mode; + struct drm_crtc_state *crtc_state = crtc->state; + struct ast_crtc_state *ast_crtc_state = to_ast_crtc_state(crtc_state); + struct ast_crtc_state *old_ast_crtc_state = + to_ast_crtc_state(old_crtc_state); + const struct drm_format_info *format = ast_crtc_state->format; + struct ast_vbios_mode_info *vbios_mode_info = + &ast_crtc_state->vbios_mode_info; + struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; + + if (drm_WARN_ON_ONCE(dev, !format)) + return; /* BUG: We didn't set format in primary check(). */ + + if (format != old_ast_crtc_state->format) { + ast_set_color_reg(ast, format); + ast_set_vbios_color_reg(ast, format, vbios_mode_info); + }
- ast_set_vbios_mode_reg(ast, adjusted_mode, vbios_mode_info); - ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); - ast_set_std_reg(ast, adjusted_mode, vbios_mode_info); - ast_set_crtc_reg(ast, adjusted_mode, vbios_mode_info); - ast_set_dclk_reg(ast, adjusted_mode, vbios_mode_info); - ast_set_crtthd_reg(ast); - ast_set_sync_reg(ast, adjusted_mode, vbios_mode_info); + if (drm_atomic_crtc_needs_modeset(crtc_state)) { + ast_set_vbios_mode_reg(ast, adjusted_mode, vbios_mode_info); + ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); + ast_set_std_reg(ast, adjusted_mode, vbios_mode_info); + ast_set_crtc_reg(ast, adjusted_mode, vbios_mode_info); + ast_set_dclk_reg(ast, adjusted_mode, vbios_mode_info); + ast_set_crtthd_reg(ast); + ast_set_sync_reg(ast, adjusted_mode, vbios_mode_info); + } }
static void
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting").
The bot has tested the following trees: v5.8, v5.7.13.
v5.8: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
v5.7.13: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting").
The bot has tested the following trees: v5.8, v5.7.14.
v5.8: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
v5.7.14: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting").
The bot has tested the following trees: v5.8.1, v5.7.15.
v5.8.1: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
v5.7.15: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting").
The bot has tested the following trees: v5.8.2, v5.7.16.
v5.8.2: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
v5.7.16: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Hi
Am 26.08.20 um 15:54 schrieb Sasha Levin:
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 4961eb60f145 ("drm/ast: Enable atomic modesetting").
The bot has tested the following trees: v5.8.2, v5.7.16.
v5.8.2: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
v5.7.16: Failed to apply! Possible dependencies: 05f13f5b5996 ("drm/ast: Remove unused code paths for AST 1180") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") fa7dbd768884 ("drm/ast: Upcast from DRM device to ast structure via to_ast_private()")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Please drop this patch and the rest of the series.
linux-stable-mirror@lists.linaro.org