aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0601-drm-amd-display-Clean-dm_plane_state-hooks.patch
blob: 28e1dd61664f33bc2f3e4a500ff27e4f77967fee (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
From a645a11b61d1836ec2bbf137778b5f99c11a6a64 Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Date: Tue, 25 Jul 2017 18:11:18 -0400
Subject: [PATCH 0601/4131] drm/amd/display: Clean dm_plane_state hooks.

New surface is created in check only, in duplicate we just
reference exsisting surface and in destroy we release it.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 43 +++-------------------
 1 file changed, 6 insertions(+), 37 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 268ff7d..4eef36e 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
@@ -1559,7 +1559,6 @@ const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs = {
 static void dm_drm_plane_reset(struct drm_plane *plane)
 {
 	struct dm_plane_state *amdgpu_state = NULL;
-	struct amdgpu_device *adev = plane->dev->dev_private;
 
 	if (plane->state)
 		plane->funcs->atomic_destroy_state(plane, plane->state);
@@ -1570,9 +1569,6 @@ static void dm_drm_plane_reset(struct drm_plane *plane)
 		plane->state = &amdgpu_state->base;
 		plane->state->plane = plane;
 		plane->state->rotation = DRM_MODE_ROTATE_0;
-
-		amdgpu_state->dc_surface = dc_create_surface(adev->dm.dc);
-		WARN_ON(!amdgpu_state->dc_surface);
 	}
 	else
 		WARN_ON(1);
@@ -1582,35 +1578,17 @@ static struct drm_plane_state *
 dm_drm_plane_duplicate_state(struct drm_plane *plane)
 {
 	struct dm_plane_state *dm_plane_state, *old_dm_plane_state;
-	struct amdgpu_device *adev = plane->dev->dev_private;
 
 	old_dm_plane_state = to_dm_plane_state(plane->state);
 	dm_plane_state = kzalloc(sizeof(*dm_plane_state), GFP_KERNEL);
 	if (!dm_plane_state)
 		return NULL;
 
-	if (old_dm_plane_state->dc_surface) {
-		struct dc_surface *dc_surface = dc_create_surface(adev->dm.dc);
-		if (WARN_ON(!dc_surface))
-			return NULL;
-
-		__drm_atomic_helper_plane_duplicate_state(plane, &dm_plane_state->base);
-
-		memcpy(dc_surface, old_dm_plane_state->dc_surface, sizeof(*dc_surface));
+	__drm_atomic_helper_plane_duplicate_state(plane, &dm_plane_state->base);
 
-		if (old_dm_plane_state->dc_surface->gamma_correction)
-			dc_gamma_retain(dc_surface->gamma_correction);
-
-		if (old_dm_plane_state->dc_surface->in_transfer_func)
-			dc_transfer_func_retain(dc_surface->in_transfer_func);
-
-		dm_plane_state->dc_surface = dc_surface;
-
-		/*TODO Check for inferred values to be reset */
-	}
-	else {
-		WARN_ON(1);
-		return NULL;
+	if (old_dm_plane_state->dc_surface) {
+		dm_plane_state->dc_surface = old_dm_plane_state->dc_surface;
+		dc_surface_retain(dm_plane_state->dc_surface);
 	}
 
 	return &dm_plane_state->base;
@@ -1621,17 +1599,8 @@ void dm_drm_plane_destroy_state(struct drm_plane *plane,
 {
 	struct dm_plane_state *dm_plane_state = to_dm_plane_state(state);
 
-	if (dm_plane_state->dc_surface) {
-		struct dc_surface *dc_surface = dm_plane_state->dc_surface;
-
-		if (dc_surface->gamma_correction)
-			dc_gamma_release(&dc_surface->gamma_correction);
-
-		if (dc_surface->in_transfer_func)
-			dc_transfer_func_release(dc_surface->in_transfer_func);
-
-		dc_surface_release(dc_surface);
-	}
+	if (dm_plane_state->dc_surface)
+		dc_surface_release(dm_plane_state->dc_surface);
 
 	__drm_atomic_helper_plane_destroy_state(state);
 	kfree(dm_plane_state);
-- 
2.7.4