aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0606-drm-amd-display-Skip-DC-validation-for-flips-and-cur.patch
blob: e626aff82c8801bb90aff7107e43bc8d2c4f64cd (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
From 23ed0312b5666c4c4da046a0f86911a9945bb7e5 Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Date: Tue, 11 Jul 2017 13:45:57 -0400
Subject: [PATCH 0606/4131] drm/amd/display: Skip DC validation for flips and
 cursor.

Nothing to validate in DC in this case. Skip it.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 35 +++++++++++-----------
 1 file changed, 18 insertions(+), 17 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 1880dcb..534e270 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
@@ -1453,8 +1453,7 @@ int amdgpu_dm_connector_mode_valid(
 
 	if (context) {
 		result = MODE_OK;
-		dc_resource_validate_ctx_destruct(context);
-		dm_free(context);
+		dc_release_validate_context(context);
 	}
 
 	dc_stream_release(stream);
@@ -2747,8 +2746,8 @@ void amdgpu_dm_atomic_commit_tail(
 		}
 	}
 
-	/* DC is optimized not to do anything if 'streams' didn't change. */
-	WARN_ON(!dc_commit_context(dm->dc, dm_state->context));
+	if (dm_state->context)
+		WARN_ON(!dc_commit_context(dm->dc, dm_state->context));
 
 
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -3081,9 +3080,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 	/*
 	 * This bool will be set for true for any modeset/reset
-	 * or surface update which implies non fast surfae update.
+	 * or surface update which implies non fast surface update.
 	 */
-	bool aquire_global_lock = false;
+	bool lock_and_validation_needed = false;
 
 	ret = drm_atomic_helper_check(dev, state);
 
@@ -3171,7 +3170,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 					new_acrtc_state->stream,
 					crtc);
 
-			aquire_global_lock = true;
+			lock_and_validation_needed = true;
 
 		} else if (modereset_required(crtc_state)) {
 
@@ -3185,7 +3184,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 				dc_stream_release(new_acrtc_state->stream);
 				new_acrtc_state->stream = NULL;
 
-				aquire_global_lock = true;
+				lock_and_validation_needed = true;
 			}
 		}
 
@@ -3223,7 +3222,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 		if (!is_scaling_state_different(con_new_state, con_old_state))
 			continue;
 
-		aquire_global_lock = true;
+		lock_and_validation_needed = true;
 	}
 
 	for_each_crtc_in_state(state, crtc, crtc_state, i) {
@@ -3273,17 +3272,11 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 						     new_acrtc_state->stream,
 						     surface);
 
-				aquire_global_lock = true;
+				lock_and_validation_needed = true;
 			}
 		}
 	}
 
-	dm_state->context = dc_get_validate_context(dc, set, set_count);
-	if (!dm_state->context) {
-		ret = -EINVAL;
-		goto fail_planes;
-	}
-
 	/*
 	 * For full updates case when
 	 * removing/adding/updating  streams on once CRTC while flipping
@@ -3293,10 +3286,18 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 	 * will wait for completion of any outstanding flip using DRMs
 	 * synchronization events.
 	 */
-	if (aquire_global_lock) {
+
+	if (lock_and_validation_needed) {
+
 		ret = do_aquire_global_lock(dev, state);
 		if (ret)
 			goto fail_planes;
+
+		dm_state->context = dc_get_validate_context(dc, set, set_count);
+		if (!dm_state->context) {
+			ret = -EINVAL;
+			goto fail_planes;
+		}
 	}
 
 	/* Must be success */
-- 
2.7.4