aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjames qian wang (Arm Technology China) <james.qian.wang@arm.com>2019-01-22 04:24:16 -0500
committerLiviu Dudau <Liviu.Dudau@arm.com>2019-04-01 13:08:26 -0400
commit321e925c5813c228bafda5ea3729ebddb00a3040 (patch)
tree41255f87620dea74bff102c6c386ad037833f8af
parentf5f0a68e00688311fe9104fa32422e4e27ae8d3b (diff)
drm/komeda: Add komeda_assemble_pipelines
komeda_accemble_pipelines is for: 1. Verifing the component->supported_inputs according to the pipeline->avail_components. 2. Generating component->supported_outputs. v2: Lower the debug message of komeda_component_dump to DRM_DEBUG. Signed-off-by: James Qian Wang (Arm Technology China) <james.qian.wang@arm.com> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_dev.c6
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c75
-rw-r--r--drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h2
3 files changed, 82 insertions, 1 deletions
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
index 70e9bb7fa30c..780ca86c9db9 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
@@ -147,6 +147,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
147 goto err_cleanup; 147 goto err_cleanup;
148 } 148 }
149 149
150 err = komeda_assemble_pipelines(mdev);
151 if (err) {
152 DRM_ERROR("assemble display pipelines failed.\n");
153 goto err_cleanup;
154 }
155
150 return mdev; 156 return mdev;
151 157
152err_cleanup: 158err_cleanup:
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
index e9871305df97..ca85e12312a3 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
@@ -200,3 +200,78 @@ void komeda_component_destroy(struct komeda_dev *mdev,
200{ 200{
201 devm_kfree(mdev->dev, c); 201 devm_kfree(mdev->dev, c);
202} 202}
203
204static void komeda_component_dump(struct komeda_component *c)
205{
206 if (!c)
207 return;
208
209 DRM_DEBUG(" %s: ID %d-0x%08lx.\n",
210 c->name, c->id, BIT(c->id));
211 DRM_DEBUG(" max_active_inputs:%d, supported_inputs: 0x%08x.\n",
212 c->max_active_inputs, c->supported_inputs);
213 DRM_DEBUG(" max_active_outputs:%d, supported_outputs: 0x%08x.\n",
214 c->max_active_outputs, c->supported_outputs);
215}
216
217static void komeda_pipeline_dump(struct komeda_pipeline *pipe)
218{
219 struct komeda_component *c;
220 int id;
221
222 DRM_INFO("Pipeline-%d: n_layers: %d, n_scalers: %d, output: %s\n",
223 pipe->id, pipe->n_layers, pipe->n_scalers,
224 pipe->of_output_dev ? pipe->of_output_dev->full_name : "none");
225
226 dp_for_each_set_bit(id, pipe->avail_comps) {
227 c = komeda_pipeline_get_component(pipe, id);
228
229 komeda_component_dump(c);
230 }
231}
232
233static void komeda_component_verify_inputs(struct komeda_component *c)
234{
235 struct komeda_pipeline *pipe = c->pipeline;
236 struct komeda_component *input;
237 int id;
238
239 dp_for_each_set_bit(id, c->supported_inputs) {
240 input = komeda_pipeline_get_component(pipe, id);
241 if (!input) {
242 c->supported_inputs &= ~(BIT(id));
243 DRM_WARN("Can not find input(ID-%d) for component: %s.\n",
244 id, c->name);
245 continue;
246 }
247
248 input->supported_outputs |= BIT(c->id);
249 }
250}
251
252static void komeda_pipeline_assemble(struct komeda_pipeline *pipe)
253{
254 struct komeda_component *c;
255 int id;
256
257 dp_for_each_set_bit(id, pipe->avail_comps) {
258 c = komeda_pipeline_get_component(pipe, id);
259
260 komeda_component_verify_inputs(c);
261 }
262}
263
264int komeda_assemble_pipelines(struct komeda_dev *mdev)
265{
266 struct komeda_pipeline *pipe;
267 int i;
268
269 for (i = 0; i < mdev->n_pipelines; i++) {
270 pipe = mdev->pipelines[i];
271
272 komeda_pipeline_assemble(pipe);
273 komeda_pipeline_dump(pipe);
274 }
275
276 return 0;
277}
diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
index 943aa52189d4..f9b7f517a484 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h
@@ -363,7 +363,7 @@ komeda_pipeline_add(struct komeda_dev *mdev, size_t size,
363 struct komeda_pipeline_funcs *funcs); 363 struct komeda_pipeline_funcs *funcs);
364void komeda_pipeline_destroy(struct komeda_dev *mdev, 364void komeda_pipeline_destroy(struct komeda_dev *mdev,
365 struct komeda_pipeline *pipe); 365 struct komeda_pipeline *pipe);
366 366int komeda_assemble_pipelines(struct komeda_dev *mdev);
367struct komeda_component * 367struct komeda_component *
368komeda_pipeline_get_component(struct komeda_pipeline *pipe, int id); 368komeda_pipeline_get_component(struct komeda_pipeline *pipe, int id);
369 369