[PATCH 02/81] drm/amd/display: Move drm_get_vblank from legacy code

sunpeng.li at amd.com sunpeng.li at amd.com
Tue Jul 25 13:53:22 UTC 2017


From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>

Previously, we assumed that allow_modeset=false => page flip. This
assumption breaks when an atomic commit is submitted with allow_modeset
set to false, since the legacy flip code is never called (the legacy
code grabs the vblank reference).

Fix: Move drm_vblank_get() from amdgpu_atomic_helper_page_flip() to
amdgpu_dm_commit_surfaces().

Change-Id: Ibd429f7efb75aeef6e254e96bb88703f5b3391a0
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index 88d4f74c..fd5d643 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -977,10 +977,6 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc,
 	if (!state)
 		return -ENOMEM;
 
-	ret = drm_crtc_vblank_get(crtc);
-	if (ret)
-		return ret;
-
 	state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
 retry:
 	crtc_state = drm_atomic_get_crtc_state(state, crtc);
@@ -2551,8 +2547,6 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
 			if (!con_state)
 				continue;
 
-
-
 			add_surface(dm->dc, crtc, plane,
 				    &dc_surfaces_constructed[planes_count]);
 			if (dc_surfaces_constructed[planes_count] == NULL) {
@@ -2571,6 +2565,10 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
 				acrtc_attach->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC ?
 				false : true;
 
+			/* TODO: Needs rework for multiplane flip */
+			if (plane->type == DRM_PLANE_TYPE_PRIMARY)
+				drm_crtc_vblank_get(crtc);
+
 			amdgpu_dm_do_flip(
 				crtc,
 				fb,
-- 
2.7.4



More information about the amd-gfx mailing list