aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/2851-drm-amdkcl-4.10-free-atomic-state-on-successful-atom.patch
blob: d163b7a0eeb2316770f1cdb2618c5238c494a523 (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
From ac0a8d068a9401824d445698b3f28fd1ab7f1ad1 Mon Sep 17 00:00:00 2001
From: Xiaojie Yuan <Xiaojie.Yuan@amd.com>
Date: Tue, 12 Dec 2017 11:53:08 +0800
Subject: [PATCH 2851/4131] drm/amdkcl: [4.10] free atomic state on successful
 atomic commit

prior to 4.10 DRM core, refcount for atomic state hasn't been introduced.
driver takes ownership of atomic state on successful atomic commit,
so it's driver's responsiblity to free it.

v2: remove drm_atomic_state_free() after resume helper

Change-Id: I69f15a9e8d8123a5c2a39f8bed165e87648809e1
Signed-off-by: Xiaojie Yuan <Xiaojie.Yuan@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index fdcdb00..56def60 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -751,14 +751,9 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
 
 	ret = drm_atomic_helper_resume(ddev, adev->dm.cached_state);
 
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 10, 0) && !defined(OS_NAME_RHEL_7_4)
-	drm_atomic_state_free(adev->dm.cached_state);
-#else
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)) || defined(OS_NAME_RHEL_7_4)
 	drm_atomic_state_put(adev->dm.cached_state);
 #endif
-#endif
 	adev->dm.cached_state = NULL;
 
 	amdgpu_dm_irq_resume_late(adev);
@@ -4469,6 +4464,8 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,
 		drm_atomic_helper_cleanup_planes(dev, state);
 	}
 
+	drm_atomic_state_free(state);
+
 	return ret;
 #endif
 }
-- 
2.7.4