]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/komeda: Add komeda_assemble_pipelines
authorjames qian wang (Arm Technology China) <james.qian.wang@arm.com>
Tue, 22 Jan 2019 09:24:16 +0000 (09:24 +0000)
committerLiviu Dudau <Liviu.Dudau@arm.com>
Mon, 1 Apr 2019 17:08:26 +0000 (18:08 +0100)
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>
drivers/gpu/drm/arm/display/komeda/komeda_dev.c
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h

index 70e9bb7fa30c6c5ee900819349a2ee02045c4de5..780ca86c9db9d21594d297ae085207deba8b5884 100644 (file)
@@ -147,6 +147,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
                goto err_cleanup;
        }
 
+       err = komeda_assemble_pipelines(mdev);
+       if (err) {
+               DRM_ERROR("assemble display pipelines failed.\n");
+               goto err_cleanup;
+       }
+
        return mdev;
 
 err_cleanup:
index e9871305df974340050ed9fa62e5dac520442cc4..ca85e12312a388c5dd42765cca51ed2d450e4161 100644 (file)
@@ -200,3 +200,78 @@ void komeda_component_destroy(struct komeda_dev *mdev,
 {
        devm_kfree(mdev->dev, c);
 }
+
+static void komeda_component_dump(struct komeda_component *c)
+{
+       if (!c)
+               return;
+
+       DRM_DEBUG("     %s: ID %d-0x%08lx.\n",
+                 c->name, c->id, BIT(c->id));
+       DRM_DEBUG("             max_active_inputs:%d, supported_inputs: 0x%08x.\n",
+                 c->max_active_inputs, c->supported_inputs);
+       DRM_DEBUG("             max_active_outputs:%d, supported_outputs: 0x%08x.\n",
+                 c->max_active_outputs, c->supported_outputs);
+}
+
+static void komeda_pipeline_dump(struct komeda_pipeline *pipe)
+{
+       struct komeda_component *c;
+       int id;
+
+       DRM_INFO("Pipeline-%d: n_layers: %d, n_scalers: %d, output: %s\n",
+                pipe->id, pipe->n_layers, pipe->n_scalers,
+                pipe->of_output_dev ? pipe->of_output_dev->full_name : "none");
+
+       dp_for_each_set_bit(id, pipe->avail_comps) {
+               c = komeda_pipeline_get_component(pipe, id);
+
+               komeda_component_dump(c);
+       }
+}
+
+static void komeda_component_verify_inputs(struct komeda_component *c)
+{
+       struct komeda_pipeline *pipe = c->pipeline;
+       struct komeda_component *input;
+       int id;
+
+       dp_for_each_set_bit(id, c->supported_inputs) {
+               input = komeda_pipeline_get_component(pipe, id);
+               if (!input) {
+                       c->supported_inputs &= ~(BIT(id));
+                       DRM_WARN("Can not find input(ID-%d) for component: %s.\n",
+                                id, c->name);
+                       continue;
+               }
+
+               input->supported_outputs |= BIT(c->id);
+       }
+}
+
+static void komeda_pipeline_assemble(struct komeda_pipeline *pipe)
+{
+       struct komeda_component *c;
+       int id;
+
+       dp_for_each_set_bit(id, pipe->avail_comps) {
+               c = komeda_pipeline_get_component(pipe, id);
+
+               komeda_component_verify_inputs(c);
+       }
+}
+
+int komeda_assemble_pipelines(struct komeda_dev *mdev)
+{
+       struct komeda_pipeline *pipe;
+       int i;
+
+       for (i = 0; i < mdev->n_pipelines; i++) {
+               pipe = mdev->pipelines[i];
+
+               komeda_pipeline_assemble(pipe);
+               komeda_pipeline_dump(pipe);
+       }
+
+       return 0;
+}
index 943aa52189d455ad32a145b6cc05fecd0d2db1e0..f9b7f517a48426240adfca58aaf4f9414940b59a 100644 (file)
@@ -363,7 +363,7 @@ komeda_pipeline_add(struct komeda_dev *mdev, size_t size,
                    struct komeda_pipeline_funcs *funcs);
 void komeda_pipeline_destroy(struct komeda_dev *mdev,
                             struct komeda_pipeline *pipe);
-
+int komeda_assemble_pipelines(struct komeda_dev *mdev);
 struct komeda_component *
 komeda_pipeline_get_component(struct komeda_pipeline *pipe, int id);