aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0630-drm-amd-display-Do-not-release-state-objects-on-atom.patch
blob: 8ba57f2eb1af79d85031fd87f4c90c746e7dc265 (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
From 15296a2a2ee0e49587e420cbb60f6ef0b32e1887 Mon Sep 17 00:00:00 2001
From: "Leo (Sunpeng) Li" <sunpeng.li@amd.com>
Date: Tue, 18 Jul 2017 18:33:23 -0400
Subject: [PATCH 0630/4131] drm/amd/display: Do not release state objects on
 atomic check fail

In any drm ioctl call, drm_atomic_state_clear() is called at the end to
destroy the states; even if atomic check fails. Therefore, releasing
states on atomic check failure is incorrect.

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>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 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 be24225..9519757 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
@@ -3139,7 +3139,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 				conn_state = drm_atomic_get_connector_state(state, &aconnector->base);
 				if (IS_ERR(conn_state)) {
 					ret = PTR_ERR_OR_ZERO(conn_state);
-					goto fail_crtcs;
+					goto fail;
 				}
 
 				dm_conn_state = to_dm_connector_state(conn_state);
@@ -3198,7 +3198,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 			ret = drm_atomic_add_affected_planes(state, crtc);
 			if (ret)
-				goto fail_crtcs;
+				goto fail;
 		}
 	}
 
@@ -3260,7 +3260,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 					crtc_state,
 					false);
 				if (ret)
-					goto fail_planes;
+					goto fail;
 
 
 				if (dm_plane_state->surface)
@@ -3292,13 +3292,12 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 		ret = do_aquire_global_lock(dev, state);
 		if (ret)
-			goto fail_planes;
-
+			goto fail;
 		WARN_ON(dm_state->context);
 		dm_state->context = dc_get_validate_context(dc, set, set_count);
 		if (!dm_state->context) {
 			ret = -EINVAL;
-			goto fail_planes;
+			goto fail;
 		}
 	}
 
@@ -3306,15 +3305,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 	WARN_ON(ret);
 	return ret;
 
-fail_planes:
-	for (i = 0; i < set_count; i++)
-		for (j = 0; j < set[i].surface_count; j++)
-			dc_surface_release(set[i].surfaces[j]);
-
-fail_crtcs:
-	for (i = 0; i < set_count; i++)
-		dc_stream_release(set[i].stream);
-
+fail:
 	if (ret == -EDEADLK)
 		DRM_DEBUG_KMS("Atomic check stopped due to to deadlock.\n");
 	else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS)
-- 
2.7.4