* [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes @ 2020-08-05 10:54 Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann ` (4 more replies) 0 siblings, 5 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov; +Cc: Thomas Zimmermann, dri-devel Since converting the ast driver to atomic modesettting, modesetting occationally locks up the graphics hardware and turns the display permanently dark. This happens once or twice per 10 mode switches. Investigation shows that the ast hardware presumably requires the HW cursor to be disabled while the modeswitch takes place. This patchset fixes the problem by disabling planes before programming the CRTC mode or format. After the switch, the planes gets re-enabled if they were enabled before. For mere pageflip operations, nothing changes. Patches #1 makes format changes work as intended: format registers are only updated if necessary. They used to be changed on each pageflip. Patch #2 puts the modesetting code before the plane-update code. This way, mode setting runs while planes are disabled. Patches #3 and #4 add a commit-tail function that disables planes if the display's mode or format is going to change. The active planes will later get re-enabled by the plane-update handler. Tested on AST2100 HW. The issue is not 100% reproducible, but does not show up after applying the patchset. I think the problem has been fixed. v2: * rewrote the whole patchset * dropped the cursor patches * moved modesetting into atomic_begin() * disable planes in commit-tail function * don't require full modeset for format changes Thomas Zimmermann (4): drm/ast: Only set format registers if primary plane's format changes drm/ast: Set display mode in atomic_begin() drm/ast: Add commit-tail function drm/ast: Disable planes while switching display modes drivers/gpu/drm/ast/ast_drv.h | 2 + drivers/gpu/drm/ast/ast_mode.c | 148 +++++++++++++++++++++++++-------- 2 files changed, 114 insertions(+), 36 deletions(-) -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes 2020-08-05 10:54 [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes Thomas Zimmermann @ 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann ` (3 subsequent siblings) 4 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: dri-devel, Thomas Zimmermann, Daniel Vetter, Y.C. Chen, stable 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 -- 2.28.0 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes @ 2020-08-05 10:54 ` Thomas Zimmermann 0 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: Daniel Vetter, stable, Thomas Zimmermann, dri-devel 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 -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-09 15:53 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes @ 2020-08-09 15:53 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-13 16:25 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes @ 2020-08-13 16:25 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-19 23:57 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:57 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes @ 2020-08-19 23:57 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:57 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-26 13:54 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:54 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes @ 2020-08-26 13:54 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:54 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes 2020-08-26 13:54 ` Sasha Levin @ 2020-08-27 9:10 ` Thomas Zimmermann -1 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-27 9:10 UTC (permalink / raw) To: Sasha Levin, airlied, daniel, sam Cc: dri-devel, Gerd Hoffmann, Daniel Vetter, Emil Velikov, Y.C. Chen, stable [-- Attachment #1.1: Type: text/plain, Size: 1214 bytes --] 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. > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 516 bytes --] ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes @ 2020-08-27 9:10 ` Thomas Zimmermann 0 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-27 9:10 UTC (permalink / raw) To: Sasha Levin, airlied, daniel, sam Cc: Daniel Vetter, dri-devel, Emil Velikov, stable, Gerd Hoffmann [-- Attachment #1.1.1: Type: text/plain, Size: 1214 bytes --] 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. > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 516 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() 2020-08-05 10:54 [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes Thomas Zimmermann @ 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann ` (3 subsequent siblings) 4 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: dri-devel, Thomas Zimmermann, Daniel Vetter, Y.C. Chen, stable Move the mode-setting code from atomic_flush() to atomic_begin(), and thus before the plane update. With the CRTC update before the plane updates, the cursor can be disabled while the mode is being changed. The patch removes the call ast_open_key() from atomic_begin(), The function unlocks ast's extended display registers; something that has been done at this point already. The now-empty implementation of atomic_flush() is also being removed. 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 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index b129833c0821..0ea8a68ac2d9 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -757,14 +757,6 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, static void ast_crtc_helper_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) -{ - struct ast_private *ast = to_ast_private(crtc->dev); - - ast_open_key(ast); -} - -static void ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, - struct drm_crtc_state *old_crtc_state) { struct drm_device *dev = crtc->dev; struct ast_private *ast = to_ast_private(dev); @@ -813,7 +805,6 @@ ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = { .atomic_check = ast_crtc_helper_atomic_check, .atomic_begin = ast_crtc_helper_atomic_begin, - .atomic_flush = ast_crtc_helper_atomic_flush, .atomic_enable = ast_crtc_helper_atomic_enable, .atomic_disable = ast_crtc_helper_atomic_disable, }; -- 2.28.0 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() @ 2020-08-05 10:54 ` Thomas Zimmermann 0 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: Daniel Vetter, stable, Thomas Zimmermann, dri-devel Move the mode-setting code from atomic_flush() to atomic_begin(), and thus before the plane update. With the CRTC update before the plane updates, the cursor can be disabled while the mode is being changed. The patch removes the call ast_open_key() from atomic_begin(), The function unlocks ast's extended display registers; something that has been done at this point already. The now-empty implementation of atomic_flush() is also being removed. 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 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index b129833c0821..0ea8a68ac2d9 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -757,14 +757,6 @@ static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, static void ast_crtc_helper_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) -{ - struct ast_private *ast = to_ast_private(crtc->dev); - - ast_open_key(ast); -} - -static void ast_crtc_helper_atomic_flush(struct drm_crtc *crtc, - struct drm_crtc_state *old_crtc_state) { struct drm_device *dev = crtc->dev; struct ast_private *ast = to_ast_private(dev); @@ -813,7 +805,6 @@ ast_crtc_helper_atomic_disable(struct drm_crtc *crtc, static const struct drm_crtc_helper_funcs ast_crtc_helper_funcs = { .atomic_check = ast_crtc_helper_atomic_check, .atomic_begin = ast_crtc_helper_atomic_begin, - .atomic_flush = ast_crtc_helper_atomic_flush, .atomic_enable = ast_crtc_helper_atomic_enable, .atomic_disable = ast_crtc_helper_atomic_disable, }; -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-09 15:53 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() @ 2020-08-09 15:53 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-13 16:25 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() @ 2020-08-13 16:25 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-19 23:56 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:56 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() @ 2020-08-19 23:56 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:56 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-26 13:53 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() @ 2020-08-26 13:53 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v1 3/4] drm/ast: Add commit-tail function 2020-08-05 10:54 [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes Thomas Zimmermann @ 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann ` (3 subsequent siblings) 4 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: dri-devel, Thomas Zimmermann, Daniel Vetter, Y.C. Chen, stable Duplicates drm_atomic_helper_commit_tail(), so that planes can be disabled on full mode-setting changes. 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 0ea8a68ac2d9..ae5cb0a333f7 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1043,6 +1043,31 @@ static int ast_connector_init(struct drm_device *dev) * Mode config */ +static void +ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) +{ + struct drm_device *dev = old_state->dev; + + drm_atomic_helper_commit_modeset_disables(dev, old_state); + + drm_atomic_helper_commit_planes(dev, old_state, 0); + + drm_atomic_helper_commit_modeset_enables(dev, old_state); + + drm_atomic_helper_fake_vblank(old_state); + + drm_atomic_helper_commit_hw_done(old_state); + + drm_atomic_helper_wait_for_vblanks(dev, old_state); + + drm_atomic_helper_cleanup_planes(dev, old_state); +} + +static const struct drm_mode_config_helper_funcs +ast_mode_config_helper_funcs = { + .atomic_commit_tail = ast_mode_config_helper_commit_tail, +}; + static const struct drm_mode_config_funcs ast_mode_config_funcs = { .fb_create = drm_gem_fb_create, .mode_valid = drm_vram_helper_mode_valid, @@ -1082,6 +1107,8 @@ int ast_mode_config_init(struct ast_private *ast) dev->mode_config.max_height = 1200; } + dev->mode_config.helper_private = &ast_mode_config_helper_funcs; + memset(&ast->primary_plane, 0, sizeof(ast->primary_plane)); ret = drm_universal_plane_init(dev, &ast->primary_plane, 0x01, &ast_primary_plane_funcs, -- 2.28.0 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCH v1 3/4] drm/ast: Add commit-tail function @ 2020-08-05 10:54 ` Thomas Zimmermann 0 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: Daniel Vetter, stable, Thomas Zimmermann, dri-devel Duplicates drm_atomic_helper_commit_tail(), so that planes can be disabled on full mode-setting changes. 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 0ea8a68ac2d9..ae5cb0a333f7 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -1043,6 +1043,31 @@ static int ast_connector_init(struct drm_device *dev) * Mode config */ +static void +ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) +{ + struct drm_device *dev = old_state->dev; + + drm_atomic_helper_commit_modeset_disables(dev, old_state); + + drm_atomic_helper_commit_planes(dev, old_state, 0); + + drm_atomic_helper_commit_modeset_enables(dev, old_state); + + drm_atomic_helper_fake_vblank(old_state); + + drm_atomic_helper_commit_hw_done(old_state); + + drm_atomic_helper_wait_for_vblanks(dev, old_state); + + drm_atomic_helper_cleanup_planes(dev, old_state); +} + +static const struct drm_mode_config_helper_funcs +ast_mode_config_helper_funcs = { + .atomic_commit_tail = ast_mode_config_helper_commit_tail, +}; + static const struct drm_mode_config_funcs ast_mode_config_funcs = { .fb_create = drm_gem_fb_create, .mode_valid = drm_vram_helper_mode_valid, @@ -1082,6 +1107,8 @@ int ast_mode_config_init(struct ast_private *ast) dev->mode_config.max_height = 1200; } + dev->mode_config.helper_private = &ast_mode_config_helper_funcs; + memset(&ast->primary_plane, 0, sizeof(ast->primary_plane)); ret = drm_universal_plane_init(dev, &ast->primary_plane, 0x01, &ast_primary_plane_funcs, -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-09 15:53 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function @ 2020-08-09 15:53 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-13 16:25 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function @ 2020-08-13 16:25 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-19 23:56 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:56 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function @ 2020-08-19 23:56 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:56 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-26 13:53 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 3/4] drm/ast: Add commit-tail function @ 2020-08-26 13:53 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-05 10:54 [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes Thomas Zimmermann @ 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann ` (3 subsequent siblings) 4 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: dri-devel, Thomas Zimmermann, Daniel Vetter, Y.C. Chen, stable The ast HW cursor requires the primary plane and CRTC to display at a valid mode and format. This is not the case while switching display modes, which can lead to the screen turing permanently dark. As a workaround, the ast driver now disables active planes while the mode or format switch takes place. It also synchronizes with the vertical refresh to give CRTC and planes some time to catch up on each other. The active planes planes (primary or cursor) will be re-enabled by each plane's atomic_update() function. v2: * move the logic into the commit-tail function 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_drv.h | 2 + drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h index c1af6b725933..467049ca8430 100644 --- a/drivers/gpu/drm/ast/ast_drv.h +++ b/drivers/gpu/drm/ast/ast_drv.h @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, #define AST_IO_MM_OFFSET (0x380) +#define AST_IO_VGAIR1_VREFRESH BIT(3) + #define __ast_read(x) \ static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ u##x val = 0;\ diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index ae5cb0a333f7..a379d51f3543 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, } +static void ast_wait_for_vretrace(struct ast_private *ast) +{ + unsigned long timeout = jiffies + HZ; + u8 vgair1; + + do { + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && + time_before(jiffies, timeout)); +} + /* * Primary plane */ @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) * Mode config */ +static bool +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, + struct drm_crtc_state *new_crtc_state) +{ + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; + + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) + return true; + + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); + + if (old_ast_crtc_state->format != new_ast_crtc_state->format) + return true; + + return false; +} + static void ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *dev = old_state->dev; + struct ast_private *ast = to_ast_private(dev); + struct drm_crtc_state *old_crtc_state, *new_crtc_state; + struct drm_crtc *crtc; + int i; + bool wait_for_vretrace = false; drm_atomic_helper_commit_modeset_disables(dev, old_state); - drm_atomic_helper_commit_planes(dev, old_state, 0); + /* + * HW cursors require the underlying primary plane and CRTC to + * display a valid mode and image. This is not the case during + * full modeset operations. So we temporarily disable any active + * plane, including the HW cursor. Each plane's atomic_update() + * helper will re-enable it if necessary. + * + * We only do this during *full* modesets. It does not affect + * simple pageflips on the planes. + */ + for_each_oldnew_crtc_in_state(old_state, crtc, + old_crtc_state, + new_crtc_state, i) { + if (!ast_crtc_needs_planes_disabled(old_crtc_state, + new_crtc_state)) + continue; + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, + false); + wait_for_vretrace = true; + } + + /* + * Ensure that no scanout takes place before reprogramming mode + * and format registers. + */ + if (wait_for_vretrace) + ast_wait_for_vretrace(ast); + + drm_atomic_helper_commit_planes(dev, old_state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_commit_modeset_enables(dev, old_state); drm_atomic_helper_fake_vblank(old_state); - drm_atomic_helper_commit_hw_done(old_state); - drm_atomic_helper_wait_for_vblanks(dev, old_state); - drm_atomic_helper_cleanup_planes(dev, old_state); } -- 2.28.0 ^ permalink raw reply related [flat|nested] 50+ messages in thread
* [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-05 10:54 ` Thomas Zimmermann 0 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:54 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov Cc: Daniel Vetter, stable, Thomas Zimmermann, dri-devel The ast HW cursor requires the primary plane and CRTC to display at a valid mode and format. This is not the case while switching display modes, which can lead to the screen turing permanently dark. As a workaround, the ast driver now disables active planes while the mode or format switch takes place. It also synchronizes with the vertical refresh to give CRTC and planes some time to catch up on each other. The active planes planes (primary or cursor) will be re-enabled by each plane's atomic_update() function. v2: * move the logic into the commit-tail function 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_drv.h | 2 + drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h index c1af6b725933..467049ca8430 100644 --- a/drivers/gpu/drm/ast/ast_drv.h +++ b/drivers/gpu/drm/ast/ast_drv.h @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, #define AST_IO_MM_OFFSET (0x380) +#define AST_IO_VGAIR1_VREFRESH BIT(3) + #define __ast_read(x) \ static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ u##x val = 0;\ diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index ae5cb0a333f7..a379d51f3543 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, } +static void ast_wait_for_vretrace(struct ast_private *ast) +{ + unsigned long timeout = jiffies + HZ; + u8 vgair1; + + do { + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && + time_before(jiffies, timeout)); +} + /* * Primary plane */ @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) * Mode config */ +static bool +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, + struct drm_crtc_state *new_crtc_state) +{ + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; + + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) + return true; + + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); + + if (old_ast_crtc_state->format != new_ast_crtc_state->format) + return true; + + return false; +} + static void ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) { struct drm_device *dev = old_state->dev; + struct ast_private *ast = to_ast_private(dev); + struct drm_crtc_state *old_crtc_state, *new_crtc_state; + struct drm_crtc *crtc; + int i; + bool wait_for_vretrace = false; drm_atomic_helper_commit_modeset_disables(dev, old_state); - drm_atomic_helper_commit_planes(dev, old_state, 0); + /* + * HW cursors require the underlying primary plane and CRTC to + * display a valid mode and image. This is not the case during + * full modeset operations. So we temporarily disable any active + * plane, including the HW cursor. Each plane's atomic_update() + * helper will re-enable it if necessary. + * + * We only do this during *full* modesets. It does not affect + * simple pageflips on the planes. + */ + for_each_oldnew_crtc_in_state(old_state, crtc, + old_crtc_state, + new_crtc_state, i) { + if (!ast_crtc_needs_planes_disabled(old_crtc_state, + new_crtc_state)) + continue; + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, + false); + wait_for_vretrace = true; + } + + /* + * Ensure that no scanout takes place before reprogramming mode + * and format registers. + */ + if (wait_for_vretrace) + ast_wait_for_vretrace(ast); + + drm_atomic_helper_commit_planes(dev, old_state, + DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_commit_modeset_enables(dev, old_state); drm_atomic_helper_fake_vblank(old_state); - drm_atomic_helper_commit_hw_done(old_state); - drm_atomic_helper_wait_for_vblanks(dev, old_state); - drm_atomic_helper_cleanup_planes(dev, old_state); } -- 2.28.0 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply related [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-07 8:50 ` daniel -1 siblings, 0 replies; 50+ messages in thread From: daniel @ 2020-08-07 8:50 UTC (permalink / raw) Cc: airlied, daniel, sam, kraxel, emil.l.velikov, dri-devel, Daniel Vetter, Y.C. Chen, stable On Wed, Aug 05, 2020 at 12:54:28PM +0200, Thomas Zimmermann wrote: > The ast HW cursor requires the primary plane and CRTC to display at > a valid mode and format. This is not the case while switching > display modes, which can lead to the screen turing permanently dark. > > As a workaround, the ast driver now disables active planes while the > mode or format switch takes place. It also synchronizes with the vertical > refresh to give CRTC and planes some time to catch up on each other. > The active planes planes (primary or cursor) will be re-enabled by > each plane's atomic_update() function. > > v2: > * move the logic into the commit-tail function > > 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_drv.h | 2 + > drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- > 2 files changed, 66 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h > index c1af6b725933..467049ca8430 100644 > --- a/drivers/gpu/drm/ast/ast_drv.h > +++ b/drivers/gpu/drm/ast/ast_drv.h > @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, > > #define AST_IO_MM_OFFSET (0x380) > > +#define AST_IO_VGAIR1_VREFRESH BIT(3) > + > #define __ast_read(x) \ > static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ > u##x val = 0;\ > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > index ae5cb0a333f7..a379d51f3543 100644 > --- a/drivers/gpu/drm/ast/ast_mode.c > +++ b/drivers/gpu/drm/ast/ast_mode.c > @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, > > } > > +static void ast_wait_for_vretrace(struct ast_private *ast) > +{ > + unsigned long timeout = jiffies + HZ; > + u8 vgair1; > + > + do { > + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); > + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && > + time_before(jiffies, timeout)); > +} > + > /* > * Primary plane > */ > @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) > * Mode config > */ > > +static bool > +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, > + struct drm_crtc_state *new_crtc_state) > +{ > + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; > + > + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) > + return true; > + > + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); > + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); > + > + if (old_ast_crtc_state->format != new_ast_crtc_state->format) > + return true; > + > + return false; > +} > + > static void > ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) > { > struct drm_device *dev = old_state->dev; > + struct ast_private *ast = to_ast_private(dev); > + struct drm_crtc_state *old_crtc_state, *new_crtc_state; > + struct drm_crtc *crtc; > + int i; > + bool wait_for_vretrace = false; > > drm_atomic_helper_commit_modeset_disables(dev, old_state); > > - drm_atomic_helper_commit_planes(dev, old_state, 0); > + /* > + * HW cursors require the underlying primary plane and CRTC to > + * display a valid mode and image. This is not the case during > + * full modeset operations. So we temporarily disable any active > + * plane, including the HW cursor. Each plane's atomic_update() > + * helper will re-enable it if necessary. > + * > + * We only do this during *full* modesets. It does not affect > + * simple pageflips on the planes. > + */ > + for_each_oldnew_crtc_in_state(old_state, crtc, > + old_crtc_state, > + new_crtc_state, i) { > + if (!ast_crtc_needs_planes_disabled(old_crtc_state, > + new_crtc_state)) > + continue; > + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, > + false); > + wait_for_vretrace = true; > + } Hm this still feels like you're fighting the framework more than using it. Comment here, but it's kinda review comments on the entire series. - ast_crtc_needs_planes_disabled feels a bit strange, the usual way to handle this kind of stuff is to set crtc_state->needs_modeset from your plane's atomic_check function. You might need your own atomic_check implementation for that, so that after the plane checks you run the modeset checks again. - with that you can put your call here to disable all planes into the crtc ->atomic_disable callback. You can then also put the ast_wait_for_retrace in there, at the end. > + > + /* > + * Ensure that no scanout takes place before reprogramming mode > + * and format registers. > + */ > + if (wait_for_vretrace) > + ast_wait_for_vretrace(ast); > + > + drm_atomic_helper_commit_planes(dev, old_state, > + DRM_PLANE_COMMIT_ACTIVE_ONLY); This order also feels a bit strange, especially with the first 2 patches where you put the crtc modeset code into atomic_begin. It feels a bit like if you do the plane commit _after_ modeset enables, then you could move the crtc code into the crtc ->atomic_enable hook, and then let the plane update stuff roll through all in commit_planes. Moving the modset code into atomic_begin at least suggests you want modeset enables before plane commit, and lots of drivers have that sequence in their commit_tail. It's even a default implementation with drm_atomic_helper_commit_tail_rpm. Sorry this is all dragging around so much, figuring out the best atomic flow is occasionally a bit an endeavour :-/ Cheers, Daniel > > drm_atomic_helper_commit_modeset_enables(dev, old_state); > > drm_atomic_helper_fake_vblank(old_state); > - > drm_atomic_helper_commit_hw_done(old_state); > - > drm_atomic_helper_wait_for_vblanks(dev, old_state); > - > drm_atomic_helper_cleanup_planes(dev, old_state); > } > > -- > 2.28.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-07 8:50 ` daniel 0 siblings, 0 replies; 50+ messages in thread From: daniel @ 2020-08-07 8:50 UTC (permalink / raw) Cc: Daniel Vetter, emil.l.velikov, dri-devel, kraxel, airlied, stable, sam On Wed, Aug 05, 2020 at 12:54:28PM +0200, Thomas Zimmermann wrote: > The ast HW cursor requires the primary plane and CRTC to display at > a valid mode and format. This is not the case while switching > display modes, which can lead to the screen turing permanently dark. > > As a workaround, the ast driver now disables active planes while the > mode or format switch takes place. It also synchronizes with the vertical > refresh to give CRTC and planes some time to catch up on each other. > The active planes planes (primary or cursor) will be re-enabled by > each plane's atomic_update() function. > > v2: > * move the logic into the commit-tail function > > 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_drv.h | 2 + > drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- > 2 files changed, 66 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h > index c1af6b725933..467049ca8430 100644 > --- a/drivers/gpu/drm/ast/ast_drv.h > +++ b/drivers/gpu/drm/ast/ast_drv.h > @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, > > #define AST_IO_MM_OFFSET (0x380) > > +#define AST_IO_VGAIR1_VREFRESH BIT(3) > + > #define __ast_read(x) \ > static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ > u##x val = 0;\ > diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > index ae5cb0a333f7..a379d51f3543 100644 > --- a/drivers/gpu/drm/ast/ast_mode.c > +++ b/drivers/gpu/drm/ast/ast_mode.c > @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, > > } > > +static void ast_wait_for_vretrace(struct ast_private *ast) > +{ > + unsigned long timeout = jiffies + HZ; > + u8 vgair1; > + > + do { > + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); > + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && > + time_before(jiffies, timeout)); > +} > + > /* > * Primary plane > */ > @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) > * Mode config > */ > > +static bool > +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, > + struct drm_crtc_state *new_crtc_state) > +{ > + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; > + > + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) > + return true; > + > + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); > + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); > + > + if (old_ast_crtc_state->format != new_ast_crtc_state->format) > + return true; > + > + return false; > +} > + > static void > ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) > { > struct drm_device *dev = old_state->dev; > + struct ast_private *ast = to_ast_private(dev); > + struct drm_crtc_state *old_crtc_state, *new_crtc_state; > + struct drm_crtc *crtc; > + int i; > + bool wait_for_vretrace = false; > > drm_atomic_helper_commit_modeset_disables(dev, old_state); > > - drm_atomic_helper_commit_planes(dev, old_state, 0); > + /* > + * HW cursors require the underlying primary plane and CRTC to > + * display a valid mode and image. This is not the case during > + * full modeset operations. So we temporarily disable any active > + * plane, including the HW cursor. Each plane's atomic_update() > + * helper will re-enable it if necessary. > + * > + * We only do this during *full* modesets. It does not affect > + * simple pageflips on the planes. > + */ > + for_each_oldnew_crtc_in_state(old_state, crtc, > + old_crtc_state, > + new_crtc_state, i) { > + if (!ast_crtc_needs_planes_disabled(old_crtc_state, > + new_crtc_state)) > + continue; > + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, > + false); > + wait_for_vretrace = true; > + } Hm this still feels like you're fighting the framework more than using it. Comment here, but it's kinda review comments on the entire series. - ast_crtc_needs_planes_disabled feels a bit strange, the usual way to handle this kind of stuff is to set crtc_state->needs_modeset from your plane's atomic_check function. You might need your own atomic_check implementation for that, so that after the plane checks you run the modeset checks again. - with that you can put your call here to disable all planes into the crtc ->atomic_disable callback. You can then also put the ast_wait_for_retrace in there, at the end. > + > + /* > + * Ensure that no scanout takes place before reprogramming mode > + * and format registers. > + */ > + if (wait_for_vretrace) > + ast_wait_for_vretrace(ast); > + > + drm_atomic_helper_commit_planes(dev, old_state, > + DRM_PLANE_COMMIT_ACTIVE_ONLY); This order also feels a bit strange, especially with the first 2 patches where you put the crtc modeset code into atomic_begin. It feels a bit like if you do the plane commit _after_ modeset enables, then you could move the crtc code into the crtc ->atomic_enable hook, and then let the plane update stuff roll through all in commit_planes. Moving the modset code into atomic_begin at least suggests you want modeset enables before plane commit, and lots of drivers have that sequence in their commit_tail. It's even a default implementation with drm_atomic_helper_commit_tail_rpm. Sorry this is all dragging around so much, figuring out the best atomic flow is occasionally a bit an endeavour :-/ Cheers, Daniel > > drm_atomic_helper_commit_modeset_enables(dev, old_state); > > drm_atomic_helper_fake_vblank(old_state); > - > drm_atomic_helper_commit_hw_done(old_state); > - > drm_atomic_helper_wait_for_vblanks(dev, old_state); > - > drm_atomic_helper_cleanup_planes(dev, old_state); > } > > -- > 2.28.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-07 8:50 ` daniel @ 2020-08-12 8:25 ` Thomas Zimmermann -1 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-12 8:25 UTC (permalink / raw) To: daniel Cc: Daniel Vetter, emil.l.velikov, dri-devel, kraxel, airlied, stable, sam [-- Attachment #1.1: Type: text/plain, Size: 7261 bytes --] Hi Am 07.08.20 um 10:50 schrieb daniel@ffwll.ch: > On Wed, Aug 05, 2020 at 12:54:28PM +0200, Thomas Zimmermann wrote: >> The ast HW cursor requires the primary plane and CRTC to display at >> a valid mode and format. This is not the case while switching >> display modes, which can lead to the screen turing permanently dark. >> >> As a workaround, the ast driver now disables active planes while the >> mode or format switch takes place. It also synchronizes with the vertical >> refresh to give CRTC and planes some time to catch up on each other. >> The active planes planes (primary or cursor) will be re-enabled by >> each plane's atomic_update() function. >> >> v2: >> * move the logic into the commit-tail function >> >> 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_drv.h | 2 + >> drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- >> 2 files changed, 66 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h >> index c1af6b725933..467049ca8430 100644 >> --- a/drivers/gpu/drm/ast/ast_drv.h >> +++ b/drivers/gpu/drm/ast/ast_drv.h >> @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, >> >> #define AST_IO_MM_OFFSET (0x380) >> >> +#define AST_IO_VGAIR1_VREFRESH BIT(3) >> + >> #define __ast_read(x) \ >> static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ >> u##x val = 0;\ >> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c >> index ae5cb0a333f7..a379d51f3543 100644 >> --- a/drivers/gpu/drm/ast/ast_mode.c >> +++ b/drivers/gpu/drm/ast/ast_mode.c >> @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, >> >> } >> >> +static void ast_wait_for_vretrace(struct ast_private *ast) >> +{ >> + unsigned long timeout = jiffies + HZ; >> + u8 vgair1; >> + >> + do { >> + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); >> + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && >> + time_before(jiffies, timeout)); >> +} >> + >> /* >> * Primary plane >> */ >> @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) >> * Mode config >> */ >> >> +static bool >> +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, >> + struct drm_crtc_state *new_crtc_state) >> +{ >> + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; >> + >> + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) >> + return true; >> + >> + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); >> + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); >> + >> + if (old_ast_crtc_state->format != new_ast_crtc_state->format) >> + return true; >> + >> + return false; >> +} >> + >> static void >> ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) >> { >> struct drm_device *dev = old_state->dev; >> + struct ast_private *ast = to_ast_private(dev); >> + struct drm_crtc_state *old_crtc_state, *new_crtc_state; >> + struct drm_crtc *crtc; >> + int i; >> + bool wait_for_vretrace = false; >> >> drm_atomic_helper_commit_modeset_disables(dev, old_state); >> >> - drm_atomic_helper_commit_planes(dev, old_state, 0); >> + /* >> + * HW cursors require the underlying primary plane and CRTC to >> + * display a valid mode and image. This is not the case during >> + * full modeset operations. So we temporarily disable any active >> + * plane, including the HW cursor. Each plane's atomic_update() >> + * helper will re-enable it if necessary. >> + * >> + * We only do this during *full* modesets. It does not affect >> + * simple pageflips on the planes. >> + */ >> + for_each_oldnew_crtc_in_state(old_state, crtc, >> + old_crtc_state, >> + new_crtc_state, i) { >> + if (!ast_crtc_needs_planes_disabled(old_crtc_state, >> + new_crtc_state)) >> + continue; >> + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, >> + false); >> + wait_for_vretrace = true; >> + } > > Hm this still feels like you're fighting the framework more than using it. > Comment here, but it's kinda review comments on the entire series. > > - ast_crtc_needs_planes_disabled feels a bit strange, the usual way to > handle this kind of stuff is to set crtc_state->needs_modeset from your > plane's atomic_check function. You might need your own atomic_check > implementation for that, so that after the plane checks you run the > modeset checks again. > > - with that you can put your call here to disable all planes into the crtc > ->atomic_disable callback. You can then also put the > ast_wait_for_retrace in there, at the end. The CRTC's atomic_disable/enable only run if needs_modeset() is true. I brought back support for fast format changes of the primary plane. Moving that code into atomic_disable/enable would require to set needs_modeset in atomic_check() for format changes. And later figure out in atomic_disable/enable if it's really a modeset or just a change of the format. That's not good either. Best regards Thomas > >> + >> + /* >> + * Ensure that no scanout takes place before reprogramming mode >> + * and format registers. >> + */ >> + if (wait_for_vretrace) >> + ast_wait_for_vretrace(ast); >> + >> + drm_atomic_helper_commit_planes(dev, old_state, >> + DRM_PLANE_COMMIT_ACTIVE_ONLY); > > This order also feels a bit strange, especially with the first 2 patches > where you put the crtc modeset code into atomic_begin. It feels a bit like > if you do the plane commit _after_ modeset enables, then you could move > the crtc code into the crtc ->atomic_enable hook, and then let the plane > update stuff roll through all in commit_planes. Moving the modset code > into atomic_begin at least suggests you want modeset enables before plane > commit, and lots of drivers have that sequence in their commit_tail. It's > even a default implementation with drm_atomic_helper_commit_tail_rpm. > > Sorry this is all dragging around so much, figuring out the best atomic > flow is occasionally a bit an endeavour :-/ > > Cheers, Daniel > >> >> drm_atomic_helper_commit_modeset_enables(dev, old_state); >> >> drm_atomic_helper_fake_vblank(old_state); >> - >> drm_atomic_helper_commit_hw_done(old_state); >> - >> drm_atomic_helper_wait_for_vblanks(dev, old_state); >> - >> drm_atomic_helper_cleanup_planes(dev, old_state); >> } >> >> -- >> 2.28.0 >> > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 516 bytes --] ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-12 8:25 ` Thomas Zimmermann 0 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-12 8:25 UTC (permalink / raw) To: daniel Cc: Daniel Vetter, dri-devel, emil.l.velikov, stable, kraxel, airlied, sam [-- Attachment #1.1.1: Type: text/plain, Size: 7261 bytes --] Hi Am 07.08.20 um 10:50 schrieb daniel@ffwll.ch: > On Wed, Aug 05, 2020 at 12:54:28PM +0200, Thomas Zimmermann wrote: >> The ast HW cursor requires the primary plane and CRTC to display at >> a valid mode and format. This is not the case while switching >> display modes, which can lead to the screen turing permanently dark. >> >> As a workaround, the ast driver now disables active planes while the >> mode or format switch takes place. It also synchronizes with the vertical >> refresh to give CRTC and planes some time to catch up on each other. >> The active planes planes (primary or cursor) will be re-enabled by >> each plane's atomic_update() function. >> >> v2: >> * move the logic into the commit-tail function >> >> 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_drv.h | 2 + >> drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- >> 2 files changed, 66 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h >> index c1af6b725933..467049ca8430 100644 >> --- a/drivers/gpu/drm/ast/ast_drv.h >> +++ b/drivers/gpu/drm/ast/ast_drv.h >> @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, >> >> #define AST_IO_MM_OFFSET (0x380) >> >> +#define AST_IO_VGAIR1_VREFRESH BIT(3) >> + >> #define __ast_read(x) \ >> static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ >> u##x val = 0;\ >> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c >> index ae5cb0a333f7..a379d51f3543 100644 >> --- a/drivers/gpu/drm/ast/ast_mode.c >> +++ b/drivers/gpu/drm/ast/ast_mode.c >> @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, >> >> } >> >> +static void ast_wait_for_vretrace(struct ast_private *ast) >> +{ >> + unsigned long timeout = jiffies + HZ; >> + u8 vgair1; >> + >> + do { >> + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); >> + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && >> + time_before(jiffies, timeout)); >> +} >> + >> /* >> * Primary plane >> */ >> @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) >> * Mode config >> */ >> >> +static bool >> +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, >> + struct drm_crtc_state *new_crtc_state) >> +{ >> + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; >> + >> + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) >> + return true; >> + >> + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); >> + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); >> + >> + if (old_ast_crtc_state->format != new_ast_crtc_state->format) >> + return true; >> + >> + return false; >> +} >> + >> static void >> ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) >> { >> struct drm_device *dev = old_state->dev; >> + struct ast_private *ast = to_ast_private(dev); >> + struct drm_crtc_state *old_crtc_state, *new_crtc_state; >> + struct drm_crtc *crtc; >> + int i; >> + bool wait_for_vretrace = false; >> >> drm_atomic_helper_commit_modeset_disables(dev, old_state); >> >> - drm_atomic_helper_commit_planes(dev, old_state, 0); >> + /* >> + * HW cursors require the underlying primary plane and CRTC to >> + * display a valid mode and image. This is not the case during >> + * full modeset operations. So we temporarily disable any active >> + * plane, including the HW cursor. Each plane's atomic_update() >> + * helper will re-enable it if necessary. >> + * >> + * We only do this during *full* modesets. It does not affect >> + * simple pageflips on the planes. >> + */ >> + for_each_oldnew_crtc_in_state(old_state, crtc, >> + old_crtc_state, >> + new_crtc_state, i) { >> + if (!ast_crtc_needs_planes_disabled(old_crtc_state, >> + new_crtc_state)) >> + continue; >> + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, >> + false); >> + wait_for_vretrace = true; >> + } > > Hm this still feels like you're fighting the framework more than using it. > Comment here, but it's kinda review comments on the entire series. > > - ast_crtc_needs_planes_disabled feels a bit strange, the usual way to > handle this kind of stuff is to set crtc_state->needs_modeset from your > plane's atomic_check function. You might need your own atomic_check > implementation for that, so that after the plane checks you run the > modeset checks again. > > - with that you can put your call here to disable all planes into the crtc > ->atomic_disable callback. You can then also put the > ast_wait_for_retrace in there, at the end. The CRTC's atomic_disable/enable only run if needs_modeset() is true. I brought back support for fast format changes of the primary plane. Moving that code into atomic_disable/enable would require to set needs_modeset in atomic_check() for format changes. And later figure out in atomic_disable/enable if it's really a modeset or just a change of the format. That's not good either. Best regards Thomas > >> + >> + /* >> + * Ensure that no scanout takes place before reprogramming mode >> + * and format registers. >> + */ >> + if (wait_for_vretrace) >> + ast_wait_for_vretrace(ast); >> + >> + drm_atomic_helper_commit_planes(dev, old_state, >> + DRM_PLANE_COMMIT_ACTIVE_ONLY); > > This order also feels a bit strange, especially with the first 2 patches > where you put the crtc modeset code into atomic_begin. It feels a bit like > if you do the plane commit _after_ modeset enables, then you could move > the crtc code into the crtc ->atomic_enable hook, and then let the plane > update stuff roll through all in commit_planes. Moving the modset code > into atomic_begin at least suggests you want modeset enables before plane > commit, and lots of drivers have that sequence in their commit_tail. It's > even a default implementation with drm_atomic_helper_commit_tail_rpm. > > Sorry this is all dragging around so much, figuring out the best atomic > flow is occasionally a bit an endeavour :-/ > > Cheers, Daniel > >> >> drm_atomic_helper_commit_modeset_enables(dev, old_state); >> >> drm_atomic_helper_fake_vblank(old_state); >> - >> drm_atomic_helper_commit_hw_done(old_state); >> - >> drm_atomic_helper_wait_for_vblanks(dev, old_state); >> - >> drm_atomic_helper_cleanup_planes(dev, old_state); >> } >> >> -- >> 2.28.0 >> > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 516 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-12 8:25 ` Thomas Zimmermann @ 2020-08-12 14:04 ` Daniel Vetter -1 siblings, 0 replies; 50+ messages in thread From: Daniel Vetter @ 2020-08-12 14:04 UTC (permalink / raw) To: Thomas Zimmermann Cc: daniel, Daniel Vetter, emil.l.velikov, dri-devel, kraxel, airlied, stable, sam On Wed, Aug 12, 2020 at 10:25:25AM +0200, Thomas Zimmermann wrote: > Hi > > Am 07.08.20 um 10:50 schrieb daniel@ffwll.ch: > > On Wed, Aug 05, 2020 at 12:54:28PM +0200, Thomas Zimmermann wrote: > >> The ast HW cursor requires the primary plane and CRTC to display at > >> a valid mode and format. This is not the case while switching > >> display modes, which can lead to the screen turing permanently dark. > >> > >> As a workaround, the ast driver now disables active planes while the > >> mode or format switch takes place. It also synchronizes with the vertical > >> refresh to give CRTC and planes some time to catch up on each other. > >> The active planes planes (primary or cursor) will be re-enabled by > >> each plane's atomic_update() function. > >> > >> v2: > >> * move the logic into the commit-tail function > >> > >> 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_drv.h | 2 + > >> drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- > >> 2 files changed, 66 insertions(+), 4 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h > >> index c1af6b725933..467049ca8430 100644 > >> --- a/drivers/gpu/drm/ast/ast_drv.h > >> +++ b/drivers/gpu/drm/ast/ast_drv.h > >> @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, > >> > >> #define AST_IO_MM_OFFSET (0x380) > >> > >> +#define AST_IO_VGAIR1_VREFRESH BIT(3) > >> + > >> #define __ast_read(x) \ > >> static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ > >> u##x val = 0;\ > >> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > >> index ae5cb0a333f7..a379d51f3543 100644 > >> --- a/drivers/gpu/drm/ast/ast_mode.c > >> +++ b/drivers/gpu/drm/ast/ast_mode.c > >> @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, > >> > >> } > >> > >> +static void ast_wait_for_vretrace(struct ast_private *ast) > >> +{ > >> + unsigned long timeout = jiffies + HZ; > >> + u8 vgair1; > >> + > >> + do { > >> + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); > >> + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && > >> + time_before(jiffies, timeout)); > >> +} > >> + > >> /* > >> * Primary plane > >> */ > >> @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) > >> * Mode config > >> */ > >> > >> +static bool > >> +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, > >> + struct drm_crtc_state *new_crtc_state) > >> +{ > >> + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; > >> + > >> + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) > >> + return true; > >> + > >> + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); > >> + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); > >> + > >> + if (old_ast_crtc_state->format != new_ast_crtc_state->format) > >> + return true; > >> + > >> + return false; > >> +} > >> + > >> static void > >> ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) > >> { > >> struct drm_device *dev = old_state->dev; > >> + struct ast_private *ast = to_ast_private(dev); > >> + struct drm_crtc_state *old_crtc_state, *new_crtc_state; > >> + struct drm_crtc *crtc; > >> + int i; > >> + bool wait_for_vretrace = false; > >> > >> drm_atomic_helper_commit_modeset_disables(dev, old_state); > >> > >> - drm_atomic_helper_commit_planes(dev, old_state, 0); > >> + /* > >> + * HW cursors require the underlying primary plane and CRTC to > >> + * display a valid mode and image. This is not the case during > >> + * full modeset operations. So we temporarily disable any active > >> + * plane, including the HW cursor. Each plane's atomic_update() > >> + * helper will re-enable it if necessary. > >> + * > >> + * We only do this during *full* modesets. It does not affect > >> + * simple pageflips on the planes. > >> + */ > >> + for_each_oldnew_crtc_in_state(old_state, crtc, > >> + old_crtc_state, > >> + new_crtc_state, i) { > >> + if (!ast_crtc_needs_planes_disabled(old_crtc_state, > >> + new_crtc_state)) > >> + continue; > >> + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, > >> + false); > >> + wait_for_vretrace = true; > >> + } > > > > Hm this still feels like you're fighting the framework more than using it. > > Comment here, but it's kinda review comments on the entire series. > > > > - ast_crtc_needs_planes_disabled feels a bit strange, the usual way to > > handle this kind of stuff is to set crtc_state->needs_modeset from your > > plane's atomic_check function. You might need your own atomic_check > > implementation for that, so that after the plane checks you run the > > modeset checks again. > > > > - with that you can put your call here to disable all planes into the crtc > > ->atomic_disable callback. You can then also put the > > ast_wait_for_retrace in there, at the end. > > The CRTC's atomic_disable/enable only run if needs_modeset() is true. > > I brought back support for fast format changes of the primary plane. > Moving that code into atomic_disable/enable would require to set > needs_modeset in atomic_check() for format changes. And later figure out > in atomic_disable/enable if it's really a modeset or just a change of > the format. That's not good either. Hm so the uapi rules are somewhat quirky, but NEEDS_MODESET generally means "no flickering". You can do transitions which take longer than 1 vblank (if resources need to be reallocated) without signalling a NEEDS_MODESET. But going to black and back is not something that should be done without signalling a modeset. Userspace would like to make that distinction and avoid such flickering as much as possible. Maybe not super relevant for ast, but still, needs_modeset should flag true for this I think. Not sure how to best model that with helpers tbh so you can keep the fast format change. Clever drivers with tricks like this all have their own modeset flow by now. Maybe just have ast state for whether you need a modeset (before you overwrite that due to plane changes) and forced plane disable (any time a modeset is indicated) and then call functions from your commit_tail depending upon that directly. -Daniel > > Best regards > Thomas > > > > >> + > >> + /* > >> + * Ensure that no scanout takes place before reprogramming mode > >> + * and format registers. > >> + */ > >> + if (wait_for_vretrace) > >> + ast_wait_for_vretrace(ast); > >> + > >> + drm_atomic_helper_commit_planes(dev, old_state, > >> + DRM_PLANE_COMMIT_ACTIVE_ONLY); > > > > This order also feels a bit strange, especially with the first 2 patches > > where you put the crtc modeset code into atomic_begin. It feels a bit like > > if you do the plane commit _after_ modeset enables, then you could move > > the crtc code into the crtc ->atomic_enable hook, and then let the plane > > update stuff roll through all in commit_planes. Moving the modset code > > into atomic_begin at least suggests you want modeset enables before plane > > commit, and lots of drivers have that sequence in their commit_tail. It's > > even a default implementation with drm_atomic_helper_commit_tail_rpm. > > > > Sorry this is all dragging around so much, figuring out the best atomic > > flow is occasionally a bit an endeavour :-/ > > > > Cheers, Daniel > > > >> > >> drm_atomic_helper_commit_modeset_enables(dev, old_state); > >> > >> drm_atomic_helper_fake_vblank(old_state); > >> - > >> drm_atomic_helper_commit_hw_done(old_state); > >> - > >> drm_atomic_helper_wait_for_vblanks(dev, old_state); > >> - > >> drm_atomic_helper_cleanup_planes(dev, old_state); > >> } > >> > >> -- > >> 2.28.0 > >> > > > > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5, 90409 Nürnberg, Germany > (HRB 36809, AG Nürnberg) > Geschäftsführer: Felix Imendörffer > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-12 14:04 ` Daniel Vetter 0 siblings, 0 replies; 50+ messages in thread From: Daniel Vetter @ 2020-08-12 14:04 UTC (permalink / raw) To: Thomas Zimmermann Cc: Daniel Vetter, emil.l.velikov, dri-devel, kraxel, airlied, stable, sam On Wed, Aug 12, 2020 at 10:25:25AM +0200, Thomas Zimmermann wrote: > Hi > > Am 07.08.20 um 10:50 schrieb daniel@ffwll.ch: > > On Wed, Aug 05, 2020 at 12:54:28PM +0200, Thomas Zimmermann wrote: > >> The ast HW cursor requires the primary plane and CRTC to display at > >> a valid mode and format. This is not the case while switching > >> display modes, which can lead to the screen turing permanently dark. > >> > >> As a workaround, the ast driver now disables active planes while the > >> mode or format switch takes place. It also synchronizes with the vertical > >> refresh to give CRTC and planes some time to catch up on each other. > >> The active planes planes (primary or cursor) will be re-enabled by > >> each plane's atomic_update() function. > >> > >> v2: > >> * move the logic into the commit-tail function > >> > >> 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_drv.h | 2 + > >> drivers/gpu/drm/ast/ast_mode.c | 68 ++++++++++++++++++++++++++++++++-- > >> 2 files changed, 66 insertions(+), 4 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h > >> index c1af6b725933..467049ca8430 100644 > >> --- a/drivers/gpu/drm/ast/ast_drv.h > >> +++ b/drivers/gpu/drm/ast/ast_drv.h > >> @@ -177,6 +177,8 @@ struct ast_private *ast_device_create(struct drm_driver *drv, > >> > >> #define AST_IO_MM_OFFSET (0x380) > >> > >> +#define AST_IO_VGAIR1_VREFRESH BIT(3) > >> + > >> #define __ast_read(x) \ > >> static inline u##x ast_read##x(struct ast_private *ast, u32 reg) { \ > >> u##x val = 0;\ > >> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c > >> index ae5cb0a333f7..a379d51f3543 100644 > >> --- a/drivers/gpu/drm/ast/ast_mode.c > >> +++ b/drivers/gpu/drm/ast/ast_mode.c > >> @@ -514,6 +514,17 @@ static void ast_set_start_address_crt1(struct ast_private *ast, > >> > >> } > >> > >> +static void ast_wait_for_vretrace(struct ast_private *ast) > >> +{ > >> + unsigned long timeout = jiffies + HZ; > >> + u8 vgair1; > >> + > >> + do { > >> + vgair1 = ast_io_read8(ast, AST_IO_INPUT_STATUS1_READ); > >> + } while (!(vgair1 & AST_IO_VGAIR1_VREFRESH) && > >> + time_before(jiffies, timeout)); > >> +} > >> + > >> /* > >> * Primary plane > >> */ > >> @@ -1043,23 +1054,72 @@ static int ast_connector_init(struct drm_device *dev) > >> * Mode config > >> */ > >> > >> +static bool > >> +ast_crtc_needs_planes_disabled(struct drm_crtc_state *old_crtc_state, > >> + struct drm_crtc_state *new_crtc_state) > >> +{ > >> + struct ast_crtc_state *old_ast_crtc_state, *new_ast_crtc_state; > >> + > >> + if (drm_atomic_crtc_needs_modeset(new_crtc_state)) > >> + return true; > >> + > >> + old_ast_crtc_state = to_ast_crtc_state(old_crtc_state); > >> + new_ast_crtc_state = to_ast_crtc_state(new_crtc_state); > >> + > >> + if (old_ast_crtc_state->format != new_ast_crtc_state->format) > >> + return true; > >> + > >> + return false; > >> +} > >> + > >> static void > >> ast_mode_config_helper_commit_tail(struct drm_atomic_state *old_state) > >> { > >> struct drm_device *dev = old_state->dev; > >> + struct ast_private *ast = to_ast_private(dev); > >> + struct drm_crtc_state *old_crtc_state, *new_crtc_state; > >> + struct drm_crtc *crtc; > >> + int i; > >> + bool wait_for_vretrace = false; > >> > >> drm_atomic_helper_commit_modeset_disables(dev, old_state); > >> > >> - drm_atomic_helper_commit_planes(dev, old_state, 0); > >> + /* > >> + * HW cursors require the underlying primary plane and CRTC to > >> + * display a valid mode and image. This is not the case during > >> + * full modeset operations. So we temporarily disable any active > >> + * plane, including the HW cursor. Each plane's atomic_update() > >> + * helper will re-enable it if necessary. > >> + * > >> + * We only do this during *full* modesets. It does not affect > >> + * simple pageflips on the planes. > >> + */ > >> + for_each_oldnew_crtc_in_state(old_state, crtc, > >> + old_crtc_state, > >> + new_crtc_state, i) { > >> + if (!ast_crtc_needs_planes_disabled(old_crtc_state, > >> + new_crtc_state)) > >> + continue; > >> + drm_atomic_helper_disable_planes_on_crtc(old_crtc_state, > >> + false); > >> + wait_for_vretrace = true; > >> + } > > > > Hm this still feels like you're fighting the framework more than using it. > > Comment here, but it's kinda review comments on the entire series. > > > > - ast_crtc_needs_planes_disabled feels a bit strange, the usual way to > > handle this kind of stuff is to set crtc_state->needs_modeset from your > > plane's atomic_check function. You might need your own atomic_check > > implementation for that, so that after the plane checks you run the > > modeset checks again. > > > > - with that you can put your call here to disable all planes into the crtc > > ->atomic_disable callback. You can then also put the > > ast_wait_for_retrace in there, at the end. > > The CRTC's atomic_disable/enable only run if needs_modeset() is true. > > I brought back support for fast format changes of the primary plane. > Moving that code into atomic_disable/enable would require to set > needs_modeset in atomic_check() for format changes. And later figure out > in atomic_disable/enable if it's really a modeset or just a change of > the format. That's not good either. Hm so the uapi rules are somewhat quirky, but NEEDS_MODESET generally means "no flickering". You can do transitions which take longer than 1 vblank (if resources need to be reallocated) without signalling a NEEDS_MODESET. But going to black and back is not something that should be done without signalling a modeset. Userspace would like to make that distinction and avoid such flickering as much as possible. Maybe not super relevant for ast, but still, needs_modeset should flag true for this I think. Not sure how to best model that with helpers tbh so you can keep the fast format change. Clever drivers with tricks like this all have their own modeset flow by now. Maybe just have ast state for whether you need a modeset (before you overwrite that due to plane changes) and forced plane disable (any time a modeset is indicated) and then call functions from your commit_tail depending upon that directly. -Daniel > > Best regards > Thomas > > > > >> + > >> + /* > >> + * Ensure that no scanout takes place before reprogramming mode > >> + * and format registers. > >> + */ > >> + if (wait_for_vretrace) > >> + ast_wait_for_vretrace(ast); > >> + > >> + drm_atomic_helper_commit_planes(dev, old_state, > >> + DRM_PLANE_COMMIT_ACTIVE_ONLY); > > > > This order also feels a bit strange, especially with the first 2 patches > > where you put the crtc modeset code into atomic_begin. It feels a bit like > > if you do the plane commit _after_ modeset enables, then you could move > > the crtc code into the crtc ->atomic_enable hook, and then let the plane > > update stuff roll through all in commit_planes. Moving the modset code > > into atomic_begin at least suggests you want modeset enables before plane > > commit, and lots of drivers have that sequence in their commit_tail. It's > > even a default implementation with drm_atomic_helper_commit_tail_rpm. > > > > Sorry this is all dragging around so much, figuring out the best atomic > > flow is occasionally a bit an endeavour :-/ > > > > Cheers, Daniel > > > >> > >> drm_atomic_helper_commit_modeset_enables(dev, old_state); > >> > >> drm_atomic_helper_fake_vblank(old_state); > >> - > >> drm_atomic_helper_commit_hw_done(old_state); > >> - > >> drm_atomic_helper_wait_for_vblanks(dev, old_state); > >> - > >> drm_atomic_helper_cleanup_planes(dev, old_state); > >> } > >> > >> -- > >> 2.28.0 > >> > > > > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5, 90409 Nürnberg, Germany > (HRB 36809, AG Nürnberg) > Geschäftsführer: Felix Imendörffer > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-09 15:53 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-09 15:53 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-09 15:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-13 16:25 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-13 16:25 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-13 16:25 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-19 23:56 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:56 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-19 23:56 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-19 23:56 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-26 13:53 ` Sasha Levin -1 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: dri-devel, Thomas Zimmermann, Gerd Hoffmann, Dave Airlie, Daniel Vetter, Sam Ravnborg, Emil Velikov, Y.C. Chen, stable 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 4/4] drm/ast: Disable planes while switching display modes @ 2020-08-26 13:53 ` Sasha Levin 0 siblings, 0 replies; 50+ messages in thread From: Sasha Levin @ 2020-08-26 13:53 UTC (permalink / raw) To: Sasha Levin, Thomas Zimmermann, airlied, daniel, sam Cc: Daniel Vetter, Emil Velikov, dri-devel, Gerd Hoffmann, Thomas Zimmermann, Dave Airlie, stable, Sam Ravnborg 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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") 1728bf6402c3 ("drm/ast: Use managed mode-config init") 2ccebf561e4a ("drm/ast: Move cursor functions to ast_cursor.c") 3a53230e1c4b ("drm/ast: Make ast_primary_plane_helper_atomic_update static") 6bb18c9be6d2 ("drm/ast: Init cursors before creating modesetting structures") beb2355eecbf ("drm/ast: Pass struct ast_private instance to cursor init/fini functions") e6949ff3ca85 ("drm/ast: Initialize mode setting in ast_mode_config_init()") 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? -- Thanks Sasha _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
* Re: [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes 2020-08-05 10:54 [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes Thomas Zimmermann ` (3 preceding siblings ...) 2020-08-05 10:54 ` Thomas Zimmermann @ 2020-08-05 10:55 ` Thomas Zimmermann 4 siblings, 0 replies; 50+ messages in thread From: Thomas Zimmermann @ 2020-08-05 10:55 UTC (permalink / raw) To: airlied, daniel, sam, kraxel, emil.l.velikov; +Cc: dri-devel [-- Attachment #1.1.1: Type: text/plain, Size: 2158 bytes --] Should say [PATCH v2 0/4] instead Am 05.08.20 um 12:54 schrieb Thomas Zimmermann: > Since converting the ast driver to atomic modesettting, modesetting > occationally locks up the graphics hardware and turns the display > permanently dark. This happens once or twice per 10 mode switches. > Investigation shows that the ast hardware presumably requires the HW > cursor to be disabled while the modeswitch takes place. > > This patchset fixes the problem by disabling planes before programming > the CRTC mode or format. After the switch, the planes gets re-enabled if > they were enabled before. For mere pageflip operations, nothing changes. > > Patches #1 makes format changes work as intended: format registers are > only updated if necessary. They used to be changed on each pageflip. > Patch #2 puts the modesetting code before the plane-update code. This > way, mode setting runs while planes are disabled. Patches #3 and #4 > add a commit-tail function that disables planes if the display's mode > or format is going to change. The active planes will later get re-enabled > by the plane-update handler. > > Tested on AST2100 HW. The issue is not 100% reproducible, but does not > show up after applying the patchset. I think the problem has been fixed. > > v2: > * rewrote the whole patchset > * dropped the cursor patches > * moved modesetting into atomic_begin() > * disable planes in commit-tail function > * don't require full modeset for format changes > > Thomas Zimmermann (4): > drm/ast: Only set format registers if primary plane's format changes > drm/ast: Set display mode in atomic_begin() > drm/ast: Add commit-tail function > drm/ast: Disable planes while switching display modes > > drivers/gpu/drm/ast/ast_drv.h | 2 + > drivers/gpu/drm/ast/ast_mode.c | 148 +++++++++++++++++++++++++-------- > 2 files changed, 114 insertions(+), 36 deletions(-) > > -- > 2.28.0 > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 516 bytes --] [-- Attachment #2: Type: text/plain, Size: 160 bytes --] _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel ^ permalink raw reply [flat|nested] 50+ messages in thread
end of thread, other threads:[~2020-08-27 9:10 UTC | newest] Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-08-05 10:54 [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes Thomas Zimmermann 2020-08-05 10:54 ` [PATCH v1 1/4] drm/ast: Only set format registers if primary plane's format changes Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-09 15:53 ` Sasha Levin 2020-08-09 15:53 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-19 23:57 ` Sasha Levin 2020-08-19 23:57 ` Sasha Levin 2020-08-26 13:54 ` Sasha Levin 2020-08-26 13:54 ` Sasha Levin 2020-08-27 9:10 ` Thomas Zimmermann 2020-08-27 9:10 ` Thomas Zimmermann 2020-08-05 10:54 ` [PATCH v1 2/4] drm/ast: Set display mode in atomic_begin() Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-09 15:53 ` Sasha Levin 2020-08-09 15:53 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-19 23:56 ` Sasha Levin 2020-08-19 23:56 ` Sasha Levin 2020-08-26 13:53 ` Sasha Levin 2020-08-26 13:53 ` Sasha Levin 2020-08-05 10:54 ` [PATCH v1 3/4] drm/ast: Add commit-tail function Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-09 15:53 ` Sasha Levin 2020-08-09 15:53 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-19 23:56 ` Sasha Levin 2020-08-19 23:56 ` Sasha Levin 2020-08-26 13:53 ` Sasha Levin 2020-08-26 13:53 ` Sasha Levin 2020-08-05 10:54 ` [PATCH v1 4/4] drm/ast: Disable planes while switching display modes Thomas Zimmermann 2020-08-05 10:54 ` Thomas Zimmermann 2020-08-07 8:50 ` daniel 2020-08-07 8:50 ` daniel 2020-08-12 8:25 ` Thomas Zimmermann 2020-08-12 8:25 ` Thomas Zimmermann 2020-08-12 14:04 ` Daniel Vetter 2020-08-12 14:04 ` Daniel Vetter 2020-08-09 15:53 ` Sasha Levin 2020-08-09 15:53 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-13 16:25 ` Sasha Levin 2020-08-19 23:56 ` Sasha Levin 2020-08-19 23:56 ` Sasha Levin 2020-08-26 13:53 ` Sasha Levin 2020-08-26 13:53 ` Sasha Levin 2020-08-05 10:55 ` [PATCH v1 0/4] drm/ast: Disable HW cursor when switching modes Thomas Zimmermann
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.