aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0252-drm-amd-display-Remove-page_fleep_needed-function.patch
blob: c4900833fe597308f878de1174b021da3afab345 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
From b145199fed6dc8b9078e4bb9a002da09fe946933 Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Date: Tue, 28 Feb 2017 16:45:46 -0500
Subject: [PATCH 0252/4131] drm/amd/display: Remove page_fleep_needed function.

This function makes a lot of assumptions to try and deduce
tha an atomic_commit came from FLIP ioctl. Those assumptions
are not explicit contract with DRM API and might lead to wrong
result as the code changes. Instead use drm_atomic_state.allow_modeset
flag which explicitly is set to false only in atomic flip
helper function, otherwise this flag is always true.
P.S When we get to do actual atomic IOCTL this will have to be revised
with the atomic call behavior.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 92 +---------------------
 1 file changed, 3 insertions(+), 89 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 1e4f2b7..38d37c2 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
@@ -1592,80 +1592,6 @@ static const struct drm_plane_funcs dm_plane_funcs = {
 	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state
 };
 
-static void clear_unrelated_fields(struct drm_plane_state *state)
-{
-	state->crtc = NULL;
-	state->fb = NULL;
-	state->state = NULL;
-	state->fence = NULL;
-}
-
-/*TODO update because event is always present now */
-static bool page_flip_needed(
-	const struct drm_plane_state *new_state,
-	const struct drm_plane_state *old_state,
-	struct drm_pending_vblank_event *event,
-	bool commit_surface_required)
-{
-	struct drm_plane_state old_state_tmp;
-	struct drm_plane_state new_state_tmp;
-
-	struct amdgpu_framebuffer *amdgpu_fb_old;
-	struct amdgpu_framebuffer *amdgpu_fb_new;
-	struct amdgpu_crtc *acrtc_new;
-
-	uint64_t old_tiling_flags;
-	uint64_t new_tiling_flags;
-
-	bool page_flip_required;
-
-	if (!old_state)
-		return false;
-
-	if (!old_state->fb)
-		return false;
-
-	if (!new_state)
-		return false;
-
-	if (!new_state->fb)
-		return false;
-
-	old_state_tmp = *old_state;
-	new_state_tmp = *new_state;
-
-	if (!event)
-		return false;
-
-	amdgpu_fb_old = to_amdgpu_framebuffer(old_state->fb);
-	amdgpu_fb_new = to_amdgpu_framebuffer(new_state->fb);
-
-	if (!get_fb_info(amdgpu_fb_old, &old_tiling_flags, NULL))
-		return false;
-
-	if (!get_fb_info(amdgpu_fb_new, &new_tiling_flags, NULL))
-		return false;
-
-	if (commit_surface_required == true &&
-	    old_tiling_flags != new_tiling_flags)
-		return false;
-
-	clear_unrelated_fields(&old_state_tmp);
-	clear_unrelated_fields(&new_state_tmp);
-
-	page_flip_required = memcmp(&old_state_tmp,
-				    &new_state_tmp,
-				    sizeof(old_state_tmp)) == 0 ? true:false;
-
-	if (new_state->crtc && page_flip_required == false) {
-		acrtc_new = to_amdgpu_crtc(new_state->crtc);
-		if (acrtc_new->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC)
-			page_flip_required = true;
-	}
-
-	return page_flip_required;
-}
-
 static int dm_plane_helper_prepare_fb(
 	struct drm_plane *plane,
 	struct drm_plane_state *new_state)
@@ -2647,11 +2573,7 @@ void amdgpu_dm_atomic_commit_tail(
 		 * 1. This commit is not a page flip.
 		 * 2. This commit is a page flip, and streams are created.
 		 */
-		pflip_needed = !state->allow_modeset &&
-				page_flip_needed(
-				plane_state,
-				old_plane_state,
-				crtc->state->event, true);
+		pflip_needed = !state->allow_modeset;
 		if (!pflip_needed ||
 		     action == DM_COMMIT_ACTION_DPMS_ON ||
 		     action == DM_COMMIT_ACTION_SET) {
@@ -2710,12 +2632,7 @@ void amdgpu_dm_atomic_commit_tail(
 		if (!fb || !crtc || !crtc->state->planes_changed ||
 			!crtc->state->active)
 			continue;
-		pflip_needed = !state->allow_modeset &&
-				page_flip_needed(
-				plane_state,
-				old_plane_state,
-				crtc->state->event,
-				false);
+		pflip_needed = !state->allow_modeset;
 
 		if (pflip_needed) {
 			amdgpu_dm_do_flip(
@@ -3097,7 +3014,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 	for (i = 0; i < set_count; i++) {
 		for_each_plane_in_state(state, plane, plane_state, j) {
-			struct drm_plane_state *old_plane_state = plane->state;
 			struct drm_crtc *crtc = plane_state->crtc;
 			struct drm_framebuffer *fb = plane_state->fb;
 			struct drm_connector *connector;
@@ -3118,9 +3034,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 			 * 2. This commit is a page flip, and streams are created.
 			 */
 			crtc_state = drm_atomic_get_crtc_state(state, crtc);
-			pflip_needed = !state->allow_modeset &&
-					page_flip_needed(plane_state, old_plane_state,
-					crtc_state->event, true);
+			pflip_needed = !state->allow_modeset;
 			if (!pflip_needed ||
 				action == DM_COMMIT_ACTION_DPMS_ON ||
 				action == DM_COMMIT_ACTION_SET) {
-- 
2.7.4