Duplicates drm_atomic_helper_commit_tail(), so that planes can be
disabled on full mode-setting changes.

Signed-off-by: Thomas Zimmermann <tzimmerm...@suse.de>
Fixes: 4961eb60f145 ("drm/ast: Enable atomic modesetting")
Cc: Thomas Zimmermann <tzimmerm...@suse.de>
Cc: Gerd Hoffmann <kra...@redhat.com>
Cc: Dave Airlie <airl...@redhat.com>
Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
Cc: Sam Ravnborg <s...@ravnborg.org>
Cc: Emil Velikov <emil.l.veli...@gmail.com>
Cc: "Y.C. Chen" <yc_c...@aspeedtech.com>
Cc: <sta...@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

Reply via email to