aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0545-drm-amd-dal-simplify-atomic-gamma-programming-code.patch
blob: d504ee7b3402ee3fd5bbfa75e07bbc17916c407a (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
From f4bb1a4a62b205458c674f79c31fcaf8255896ff Mon Sep 17 00:00:00 2001
From: Mykola Lysenko <Mykola.Lysenko@amd.com>
Date: Tue, 1 Dec 2015 19:29:49 +0800
Subject: [PATCH 0545/1110] drm/amd/dal: simplify atomic gamma programming code

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 .../gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c    | 67 +++++++++++-----------
 1 file changed, 35 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
index 113c2e0..90bb0d2 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_types.c
@@ -932,36 +932,28 @@ static void amdgpu_dm_atomic_crtc_gamma_set(
 
 static int dm_crtc_funcs_atomic_set_property(
 	struct drm_crtc *crtc,
-	struct drm_crtc_state *state,
+	struct drm_crtc_state *crtc_state,
 	struct drm_property *property,
 	uint64_t val)
 {
-	struct drm_crtc_state *new_crtc_state;
-	struct drm_crtc *new_crtc;
-	int i;
-
-	for_each_crtc_in_state(state->state, new_crtc, new_crtc_state, i) {
-		if (new_crtc == crtc) {
-			struct drm_plane_state *plane_state;
+	struct drm_plane_state *plane_state;
 
-			new_crtc_state->planes_changed = true;
+	crtc_state->planes_changed = true;
 
-			/*
-			 * Bit of magic done here. We need to ensure
-			 * that planes get update after mode is set.
-			 * So, we need to add primary plane to state,
-			 * and this way atomic_update would be called
-			 * for it
-			 */
-			plane_state =
-				drm_atomic_get_plane_state(
-					state->state,
-					crtc->primary);
+	/*
+	 * Bit of magic done here. We need to ensure
+	 * that planes get update after mode is set.
+	 * So, we need to add primary plane to state,
+	 * and this way atomic_update would be called
+	 * for it
+	 */
+	plane_state =
+		drm_atomic_get_plane_state(
+			crtc_state->state,
+			crtc->primary);
 
-			if (!plane_state)
-				return -EINVAL;
-		}
-	}
+	if (!plane_state)
+		return -EINVAL;
 
 	return 0;
 }
@@ -1007,7 +999,7 @@ amdgpu_dm_connector_detect(struct drm_connector *connector, bool force)
 
 int amdgpu_dm_connector_atomic_set_property(
 	struct drm_connector *connector,
-	struct drm_connector_state *state,
+	struct drm_connector_state *connector_state,
 	struct drm_property *property,
 	uint64_t val)
 {
@@ -1016,7 +1008,7 @@ int amdgpu_dm_connector_atomic_set_property(
 	struct dm_connector_state *dm_old_state =
 		to_dm_connector_state(connector->state);
 	struct dm_connector_state *dm_new_state =
-		to_dm_connector_state(state);
+		to_dm_connector_state(connector_state);
 
 	if (property == dev->mode_config.scaling_mode_property) {
 		struct drm_crtc_state *new_crtc_state;
@@ -1045,8 +1037,13 @@ int amdgpu_dm_connector_atomic_set_property(
 
 		dm_new_state->scaling = rmx_type;
 
-		for_each_crtc_in_state(state->state, crtc, new_crtc_state, i) {
-			if (crtc == state->crtc) {
+		for_each_crtc_in_state(
+			connector_state->state,
+			crtc,
+			new_crtc_state,
+			i) {
+
+			if (crtc == connector_state->crtc) {
 				struct drm_plane_state *plane_state;
 
 				new_crtc_state->mode_changed = true;
@@ -1060,7 +1057,7 @@ int amdgpu_dm_connector_atomic_set_property(
 				 */
 				plane_state =
 					drm_atomic_get_plane_state(
-						state->state,
+						connector_state->state,
 						crtc->primary);
 
 				if (!plane_state)
@@ -1081,8 +1078,14 @@ int amdgpu_dm_connector_atomic_set_property(
 		int i;
 
 		dm_new_state->underscan_enable = val;
-		for_each_crtc_in_state(state->state, crtc, new_crtc_state, i) {
-			if (crtc == state->crtc) {
+
+		for_each_crtc_in_state(
+			connector_state->state,
+			crtc,
+			new_crtc_state,
+			i) {
+
+			if (crtc == connector_state->crtc) {
 				struct drm_plane_state *plane_state;
 
 				/*
@@ -1094,7 +1097,7 @@ int amdgpu_dm_connector_atomic_set_property(
 				 */
 				plane_state =
 					drm_atomic_get_plane_state(
-						state->state,
+						connector_state->state,
 						crtc->primary);
 
 				if (!plane_state)
-- 
2.7.4