aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0648-drm-amd-display-Roll-surface-struct-into-core_surfac.patch
blob: 7597edadfca30389b0ad2c060d074d8bafb9083f (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
From cbebc992b3a3ee928031a2c1e026c2328064f878 Mon Sep 17 00:00:00 2001
From: Harry Wentland <harry.wentland@amd.com>
Date: Thu, 20 Jul 2017 10:26:23 -0400
Subject: [PATCH 0648/4131] drm/amd/display: Roll surface struct into
 core_surface

Signed-off-by: Harry Wentland <harry.wentland@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>
---
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c | 37 +++++++++---------------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h  |  4 +++
 2 files changed, 18 insertions(+), 23 deletions(-)

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 d44ddfb..3784358 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_surface.c
@@ -34,20 +34,11 @@
 /*******************************************************************************
  * Private structures
  ******************************************************************************/
-struct surface {
-	struct core_surface protected;
-	enum dc_irq_source irq_source;
-	int ref_count;
-};
-
 struct gamma {
 	struct core_gamma protected;
 	int ref_count;
 };
 
-#define DC_SURFACE_TO_SURFACE(dc_surface) container_of(dc_surface, struct surface, protected.public)
-#define CORE_SURFACE_TO_SURFACE(core_surface) container_of(core_surface, struct surface, protected)
-
 #define DC_GAMMA_TO_GAMMA(dc_gamma) \
 	container_of(dc_gamma, struct gamma, protected.public)
 #define CORE_GAMMA_TO_GAMMA(core_gamma) \
@@ -56,23 +47,23 @@ struct gamma {
 /*******************************************************************************
  * Private functions
  ******************************************************************************/
-static bool construct(struct dc_context *ctx, struct surface *surface)
+static bool construct(struct dc_context *ctx, struct core_surface *surface)
 {
-	surface->protected.ctx = ctx;
-	memset(&surface->protected.public.hdr_static_ctx,
+	surface->ctx = ctx;
+	memset(&surface->public.hdr_static_ctx,
 			0, sizeof(struct dc_hdr_static_metadata));
 	return true;
 }
 
-static void destruct(struct surface *surface)
+static void destruct(struct core_surface *surface)
 {
-	if (surface->protected.public.gamma_correction != NULL) {
-		dc_gamma_release(&surface->protected.public.gamma_correction);
+	if (surface->public.gamma_correction != NULL) {
+		dc_gamma_release(&surface->public.gamma_correction);
 	}
-	if (surface->protected.public.in_transfer_func != NULL) {
+	if (surface->public.in_transfer_func != NULL) {
 		dc_transfer_func_release(
-				surface->protected.public.in_transfer_func);
-		surface->protected.public.in_transfer_func = NULL;
+				surface->public.in_transfer_func);
+		surface->public.in_transfer_func = NULL;
 	}
 }
 
@@ -82,7 +73,7 @@ static void destruct(struct surface *surface)
 void enable_surface_flip_reporting(struct dc_surface *dc_surface,
 		uint32_t controller_id)
 {
-	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+	struct core_surface *surface = DC_SURFACE_TO_CORE(dc_surface);
 	surface->irq_source = controller_id + DC_IRQ_SOURCE_PFLIP1 - 1;
 	/*register_flip_interrupt(surface);*/
 }
@@ -91,7 +82,7 @@ struct dc_surface *dc_create_surface(const struct dc *dc)
 {
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 
-	struct surface *surface = dm_alloc(sizeof(*surface));
+	struct core_surface *surface = dm_alloc(sizeof(*surface));
 
 	if (NULL == surface)
 		goto alloc_fail;
@@ -101,7 +92,7 @@ struct dc_surface *dc_create_surface(const struct dc *dc)
 
 	++surface->ref_count;
 
-	return &surface->protected.public;
+	return &surface->public;
 
 construct_fail:
 	dm_free(surface);
@@ -146,7 +137,7 @@ const struct dc_surface_status *dc_surface_get_status(
 
 void dc_surface_retain(const struct dc_surface *dc_surface)
 {
-	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+	struct core_surface *surface = DC_SURFACE_TO_CORE(dc_surface);
 
 	ASSERT(surface->ref_count > 0);
 	++surface->ref_count;
@@ -154,7 +145,7 @@ void dc_surface_retain(const struct dc_surface *dc_surface)
 
 void dc_surface_release(const struct dc_surface *dc_surface)
 {
-	struct surface *surface = DC_SURFACE_TO_SURFACE(dc_surface);
+	struct core_surface *surface = DC_SURFACE_TO_CORE(dc_surface);
 
 	ASSERT(surface->ref_count > 0);
 	--surface->ref_count;
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 d753680..30177f8 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -53,6 +53,10 @@ struct core_surface {
 	struct dc_surface public;
 	struct dc_surface_status status;
 	struct dc_context *ctx;
+
+	/* private to dc_surface.c */
+	enum dc_irq_source irq_source;
+	int ref_count;
 };
 
 struct core_gamma {
-- 
2.7.4