aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/0665-drm-amd-display-Roll-core_gamma-into-dc_gamma.patch
blob: 1974746fab7e1ba6d5ae1ed7a36581c46a73e96e (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
141
142
143
144
145
146
147
148
149
150
151
152
153
From dfdf56ac7ef8f808982000e2159f7eccf72db3b1 Mon Sep 17 00:00:00 2001
From: Harry Wentland <harry.wentland@amd.com>
Date: Mon, 24 Jul 2017 15:30:17 -0400
Subject: [PATCH 0665/4131] drm/amd/display: Roll core_gamma into dc_gamma

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c         |  6 ++----
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 22 +++++++++-------------
 drivers/gpu/drm/amd/display/dc/dc.h              |  6 +++---
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h     |  7 +++++++
 drivers/gpu/drm/amd/display/dc/inc/core_types.h  | 11 -----------
 5 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 30374ff..d3873ac 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1500,12 +1500,10 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 		if (srf_updates[i].gamma &&
 			srf_updates[i].gamma != surface->gamma_correction) {
 			if (surface->gamma_correction != NULL)
-				dc_gamma_release(&surface->
-						gamma_correction);
+				dc_gamma_release(&surface->gamma_correction);
 
 			dc_gamma_retain(srf_updates[i].gamma);
-			surface->gamma_correction =
-						srf_updates[i].gamma;
+			surface->gamma_correction = srf_updates[i].gamma;
 		}
 
 		if (srf_updates[i].in_transfer_func &&
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
index a8b9515..eded6b7 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -137,37 +137,33 @@ void dc_surface_release(struct dc_surface *surface)
 	}
 }
 
-void dc_gamma_retain(const struct dc_gamma *dc_gamma)
+void dc_gamma_retain(struct dc_gamma *gamma)
 {
-	struct core_gamma *gamma = DC_GAMMA_TO_CORE(dc_gamma);
-
 	ASSERT(gamma->ref_count > 0);
 	++gamma->ref_count;
 }
 
-void dc_gamma_release(const struct dc_gamma **dc_gamma)
+void dc_gamma_release(struct dc_gamma **gamma)
 {
-	struct core_gamma *gamma = DC_GAMMA_TO_CORE(*dc_gamma);
-
-	ASSERT(gamma->ref_count > 0);
-	--gamma->ref_count;
+	ASSERT((*gamma)->ref_count > 0);
+	--(*gamma)->ref_count;
 
-	if (gamma->ref_count == 0)
-		dm_free(gamma);
+	if ((*gamma)->ref_count == 0)
+		dm_free((*gamma));
 
-	*dc_gamma = NULL;
+	*gamma = NULL;
 }
 
 struct dc_gamma *dc_create_gamma()
 {
-	struct core_gamma *gamma = dm_alloc(sizeof(*gamma));
+	struct dc_gamma *gamma = dm_alloc(sizeof(*gamma));
 
 	if (gamma == NULL)
 		goto alloc_fail;
 
 	++gamma->ref_count;
 
-	return &gamma->public;
+	return gamma;
 
 alloc_fail:
 	return NULL;
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 77bd546..5523bb6 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -326,7 +326,7 @@ struct dc_surface {
 	struct dc_plane_dcc_param dcc;
 	struct dc_hdr_static_metadata hdr_static_ctx;
 
-	const struct dc_gamma *gamma_correction;
+	struct dc_gamma *gamma_correction;
 	struct dc_transfer_func *in_transfer_func;
 
 	enum dc_color_space color_space;
@@ -394,8 +394,8 @@ const struct dc_surface_status *dc_surface_get_status(
 void dc_surface_retain(struct dc_surface *dc_surface);
 void dc_surface_release(struct dc_surface *dc_surface);
 
-void dc_gamma_retain(const struct dc_gamma *dc_gamma);
-void dc_gamma_release(const struct dc_gamma **dc_gamma);
+void dc_gamma_retain(struct dc_gamma *dc_gamma);
+void dc_gamma_release(struct dc_gamma **dc_gamma);
 struct dc_gamma *dc_create_gamma(void);
 
 void dc_transfer_func_retain(struct dc_transfer_func *dc_tf);
diff --git a/drivers/gpu/drm/amd/display/dc/dc_hw_types.h b/drivers/gpu/drm/amd/display/dc/dc_hw_types.h
index 05f030e..4c5e797 100644
--- a/drivers/gpu/drm/amd/display/dc/dc_hw_types.h
+++ b/drivers/gpu/drm/amd/display/dc/dc_hw_types.h
@@ -415,6 +415,13 @@ struct dc_gamma {
 	uint16_t red[INPUT_LUT_ENTRIES];
 	uint16_t green[INPUT_LUT_ENTRIES];
 	uint16_t blue[INPUT_LUT_ENTRIES];
+
+	/* private to DC core */
+	struct dc_context *ctx;
+
+	/* private to dc_surface.c */
+	int ref_count;
+
 };
 
 /* Used by both ipp amd opp functions*/
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 43e9ada..5a47d4c 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -40,17 +40,6 @@ struct core_stream;
 
 #define MAX_CLOCK_SOURCES 7
 
-#define DC_GAMMA_TO_CORE(dc_gamma) \
-	container_of(dc_gamma, struct core_gamma, public)
-
-struct core_gamma {
-	struct dc_gamma public;
-	struct dc_context *ctx;
-
-	/* private to dc_surface.c */
-	int ref_count;
-};
-
 void enable_surface_flip_reporting(struct dc_surface *dc_surface,
 		uint32_t controller_id);
 
-- 
2.7.4