aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/0695-drm-amd-display-Add-per-surface-validation-hook.patch
blob: a762a1916f2e9e9db8f61012b08f2692d4d8a373 (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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
From 2a4a04244f9a00eac9f7046552beb5d948453f8a Mon Sep 17 00:00:00 2001
From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Date: Wed, 26 Jul 2017 15:51:31 -0400
Subject: [PATCH 0695/4131] drm/amd/display: Add per surface validation hook.

For now just validate pixel format in the hook.

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>
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c       | 11 +++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h                     |  1 +
 drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c | 12 +++++++++++-
 drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h |  2 ++
 drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c |  3 +++
 drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c |  5 ++++-
 drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c   |  4 +++-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h         |  2 ++
 8 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 36cd077..a34b256 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -2535,3 +2535,14 @@ bool dc_validate_stream(const struct dc *dc, struct dc_stream *stream)
 
 	return res == DC_OK;
 }
+
+bool dc_validate_surface(const struct dc *dc, const struct dc_surface *surface)
+{
+	struct core_dc *core_dc = DC_TO_CORE(dc);
+
+	/* TODO For now validates pixel format only */
+	if (core_dc->res_pool->funcs->validate_surface)
+		return core_dc->res_pool->funcs->validate_surface(surface) == DC_OK;
+
+	return true;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 58bfb86..e9c9b91 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -589,6 +589,7 @@ struct dc_validation_set {
 
 bool dc_validate_stream(const struct dc *dc, struct dc_stream *stream);
 
+bool dc_validate_surface(const struct dc *dc, const struct dc_surface *surface);
 /*
  * This function takes a set of resources and checks that they are cofunctional.
  *
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
index 9ac246f..59f4caf 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
@@ -804,12 +804,22 @@ static void dce100_destroy_resource_pool(struct resource_pool **pool)
 	*pool = NULL;
 }
 
+enum dc_status dce100_validate_surface(const struct dc_surface *surface)
+{
+
+	if (surface->format < SURFACE_PIXEL_FORMAT_VIDEO_BEGIN)
+		return DC_OK;
+
+	return DC_FAIL_SURFACE_VALIDATE;
+}
+
 static const struct resource_funcs dce100_res_pool_funcs = {
 	.destroy = dce100_destroy_resource_pool,
 	.link_enc_create = dce100_link_encoder_create,
 	.validate_with_context = dce100_validate_with_context,
 	.validate_guaranteed = dce100_validate_guaranteed,
-	.validate_bandwidth = dce100_validate_bandwidth
+	.validate_bandwidth = dce100_validate_bandwidth,
+	.validate_surface = dce100_validate_surface,
 };
 
 static bool construct(
diff --git a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h
index bfd7518..13fc637 100644
--- a/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h
+++ b/drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.h
@@ -16,4 +16,6 @@ struct resource_pool *dce100_create_resource_pool(
 	uint8_t num_virtual_links,
 	struct core_dc *dc);
 
+enum dc_status dce100_validate_surface(const struct dc_surface *surface);
+
 #endif /* DCE100_RESOURCE_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
index 9589208..495f387 100644
--- a/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
@@ -55,6 +55,8 @@
 #include "dce/dce_11_2_d.h"
 #include "dce/dce_11_2_sh_mask.h"
 
+#include "dce100/dce100_resource.h"
+
 #ifndef mmDP_DPHY_INTERNAL_CTRL
 	#define mmDP_DPHY_INTERNAL_CTRL 0x4aa7
 	#define mmDP0_DP_DPHY_INTERNAL_CTRL 0x4aa7
@@ -992,6 +994,7 @@ static const struct resource_funcs dce112_res_pool_funcs = {
 	.validate_with_context = dce112_validate_with_context,
 	.validate_guaranteed = dce112_validate_guaranteed,
 	.validate_bandwidth = dce112_validate_bandwidth,
+	.validate_surface = dce100_validate_surface
 };
 
 static void bw_calcs_data_update_from_pplib(struct core_dc *dc)
diff --git a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
index f829b6e..b31307b 100644
--- a/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c
@@ -60,6 +60,8 @@
 #include "vega10/NBIO/nbio_6_1_offset.h"
 #include "reg_helper.h"
 
+#include "dce100/dce100_resource.h"
+
 #ifndef mmDP0_DP_DPHY_INTERNAL_CTRL
 	#define mmDP0_DP_DPHY_INTERNAL_CTRL		0x210f
 	#define mmDP0_DP_DPHY_INTERNAL_CTRL_BASE_IDX	2
@@ -698,7 +700,8 @@ static const struct resource_funcs dce120_res_pool_funcs = {
 	.link_enc_create = dce120_link_encoder_create,
 	.validate_with_context = dce112_validate_with_context,
 	.validate_guaranteed = dce112_validate_guaranteed,
-	.validate_bandwidth = dce112_validate_bandwidth
+	.validate_bandwidth = dce112_validate_bandwidth,
+	.validate_surface = dce100_validate_surface
 };
 
 static void bw_calcs_data_update_from_pplib(struct core_dc *dc)
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index 92f01ed..6eeb5e9 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -49,6 +49,7 @@
 #include "dce/dce_audio.h"
 #include "dce/dce_hwseq.h"
 #include "dce80/dce80_hw_sequencer.h"
+#include "dce100/dce100_resource.h"
 
 #include "reg_helper.h"
 
@@ -823,7 +824,8 @@ static const struct resource_funcs dce80_res_pool_funcs = {
 	.link_enc_create = dce80_link_encoder_create,
 	.validate_with_context = dce80_validate_with_context,
 	.validate_guaranteed = dce80_validate_guaranteed,
-	.validate_bandwidth = dce80_validate_bandwidth
+	.validate_bandwidth = dce80_validate_bandwidth,
+	.validate_surface = dce100_validate_surface
 };
 
 static bool construct(
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 b312bb3..ab389ab 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -105,6 +105,8 @@ struct resource_funcs {
 			struct validate_context *context,
 			const struct resource_pool *pool,
 			struct dc_stream *stream);
+
+	enum dc_status (*validate_surface)(const struct dc_surface *surface);
 };
 
 struct audio_support{
-- 
2.7.4