Blob Blame History Raw
From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
Date: Tue, 25 Jul 2017 18:00:44 -0400
Subject: drm/amd/display: Move drm_get_vblank from legacy code
Git-commit: e29088b2932a11db6155212ca19c75029bc137aa
Patch-mainline: v4.15-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

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().

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -2383,8 +2383,6 @@ static void amdgpu_dm_commit_surfaces(st
 			if (!con_state)
 				continue;
 
-
-
 			add_surface(dm->dc, crtc, plane,
 				    &dc_surfaces_constructed[planes_count]);
 			if (dc_surfaces_constructed[planes_count] == NULL) {
@@ -2403,6 +2401,10 @@ static void amdgpu_dm_commit_surfaces(st
 				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,