MLK-17231-1: drm: imx: dcss: set own KMS commit_tail callback
authorLaurentiu Palcu <laurentiu.palcu@nxp.com>
Tue, 12 Dec 2017 10:13:27 +0000 (12:13 +0200)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
According to documentation, for the default commit_tail helper:

 * Note that the default ordering of how the various stages are called is to
 * match the legacy modeset helper library closest. One peculiarity of that is
 * that it doesn't mesh well with runtime PM at all.
 *
 * For drivers supporting runtime PM the recommended sequence is instead ::
 *
 *     drm_atomic_helper_commit_modeset_disables(dev, state);
 *
 *     drm_atomic_helper_commit_modeset_enables(dev, state);
 *
 *     drm_atomic_helper_commit_planes(dev, state,
 *                                     DRM_PLANE_COMMIT_ACTIVE_ONLY);

This patch creates our own commit_tail() callback and changes the order of the
commit_modeset callbacks, as instructed.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@nxp.com>
drivers/gpu/drm/imx/dcss/dcss-crtc.c
drivers/gpu/drm/imx/dcss/dcss-kms.c
drivers/gpu/drm/imx/dcss/dcss-kms.h

index 7cc1769..82f6837 100644 (file)
@@ -332,6 +332,9 @@ static int dcss_crtc_bind(struct device *dev, struct device *master,
        if (!drm->mode_config.funcs)
                drm->mode_config.funcs = &dcss_drm_mode_config_funcs;
 
+       if (!drm->mode_config.helper_private)
+               drm->mode_config.helper_private = &dcss_drm_mode_config_helpers;
+
        dev_set_drvdata(dev, crtc);
 
        return 0;
index 65567d1..baddc87 100644 (file)
@@ -78,9 +78,31 @@ static int dcss_drm_atomic_commit(struct drm_device *drm,
        return drm_atomic_helper_commit(drm, state, nonblock);
 }
 
+static void dcss_drm_atomic_commit_tail(struct drm_atomic_state *state)
+{
+       struct drm_device *dev = state->dev;
+
+       drm_atomic_helper_commit_modeset_disables(dev, state);
+
+       drm_atomic_helper_commit_modeset_enables(dev, state);
+
+       drm_atomic_helper_commit_planes(dev, state,
+                                       DRM_PLANE_COMMIT_ACTIVE_ONLY);
+
+       drm_atomic_helper_commit_hw_done(state);
+
+       drm_atomic_helper_wait_for_vblanks(dev, state);
+
+       drm_atomic_helper_cleanup_planes(dev, state);
+}
+
 const struct drm_mode_config_funcs dcss_drm_mode_config_funcs = {
        .fb_create = drm_gem_fb_create,
        .output_poll_changed = dcss_drm_output_poll_changed,
        .atomic_check = dcss_drm_atomic_check,
        .atomic_commit = dcss_drm_atomic_commit,
 };
+
+struct drm_mode_config_helper_funcs dcss_drm_mode_config_helpers = {
+       .atomic_commit_tail = dcss_drm_atomic_commit_tail,
+};
index 3c53952..d7c233a 100644 (file)
@@ -16,5 +16,6 @@
 #define _DCSS_KMS_H_
 
 extern const struct drm_mode_config_funcs dcss_drm_mode_config_funcs;
+extern struct drm_mode_config_helper_funcs dcss_drm_mode_config_helpers;
 
 #endif