From 4713955fb81a7bb516dfa72c74e3a1060f35f749 Mon Sep 17 00:00:00 2001 From: Sandy Huang Date: Thu, 22 Jul 2021 10:18:56 +0800 Subject: [PATCH] drm/rockchip: fb: implement rockchip_drm_atomic_helper_commit_tail_rpm implement rockchip_drm_atomic_helper_commit_tail_rpm() to instead of drm_atomic_helper_commit_tail_rpm(), this is prepare to add some rockchip private implement, just like calculate bandwidth and make sure commit planes is mutually-exclusive. Signed-off-by: Sandy Huang Change-Id: I2ac87f672a3ef06611b5047781f7cf53aa4b3700 --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 3aa37e177667..8d22c816ee31 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -53,8 +53,37 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cm return fb; } +/** + * rockchip_drm_atomic_helper_commit_tail_rpm - commit atomic update to hardware + * @old_state: new modeset state to be committed + * + * This is an alternative implementation for the + * &drm_mode_config_helper_funcs.atomic_commit_tail hook, for drivers + * that support runtime_pm or need the CRTC to be enabled to perform a + * commit. Otherwise, one should use the default implementation + * drm_atomic_helper_commit_tail(). + */ +static void rockchip_drm_atomic_helper_commit_tail_rpm(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_modeset_enables(dev, old_state); + + drm_atomic_helper_commit_planes(dev, old_state, DRM_PLANE_COMMIT_ACTIVE_ONLY); + + 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 rockchip_mode_config_helpers = { - .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, + .atomic_commit_tail = rockchip_drm_atomic_helper_commit_tail_rpm, }; static struct drm_framebuffer *