aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/vsp1/vsp1_video.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2015-08-05 16:40:31 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-19 09:22:38 -0200
commit96bfa6a5fd1dc5a7f2b5cd6f58bdcf1501146d17 (patch)
treed648e4fa4efaa9ba6fb849bcab67e8e84d9808fc /drivers/media/platform/vsp1/vsp1_video.c
parent[media] v4l: vsp1: Make the userspace API optional (diff)
downloadlinux-dev-96bfa6a5fd1dc5a7f2b5cd6f58bdcf1501146d17.tar.xz
linux-dev-96bfa6a5fd1dc5a7f2b5cd6f58bdcf1501146d17.zip
[media] v4l: vsp1: Make pipeline inputs array index by RPF index
The pipeline inputs array stores pointers to all RPFs contained in the pipeline. It's currently indexed contiguously by adding RPFs in the order they are found during graph walk. This can't easily support dynamic addition and removal of RPFs while streaming, which will be required for combined VSP+DU support. Make the array indexed by RPF index instead and skip NULL elements when iterating over RPFs. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/vsp1/vsp1_video.c')
-rw-r--r--drivers/media/platform/vsp1/vsp1_video.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c
index 92eb39c509df..b2eecabdc399 100644
--- a/drivers/media/platform/vsp1/vsp1_video.c
+++ b/drivers/media/platform/vsp1/vsp1_video.c
@@ -298,8 +298,8 @@ static int vsp1_video_pipeline_validate(struct vsp1_pipeline *pipe,
if (e->type == VSP1_ENTITY_RPF) {
rwpf = to_rwpf(subdev);
- pipe->inputs[pipe->num_inputs++] = rwpf;
- rwpf->video->pipe_index = pipe->num_inputs;
+ pipe->inputs[rwpf->entity.index] = rwpf;
+ rwpf->video->pipe_index = ++pipe->num_inputs;
} else if (e->type == VSP1_ENTITY_WPF) {
rwpf = to_rwpf(subdev);
pipe->output = rwpf;
@@ -324,7 +324,10 @@ static int vsp1_video_pipeline_validate(struct vsp1_pipeline *pipe,
/* Follow links downstream for each input and make sure the graph
* contains no loop and that all branches end at the output WPF.
*/
- for (i = 0; i < pipe->num_inputs; ++i) {
+ for (i = 0; i < video->vsp1->pdata.rpf_count; ++i) {
+ if (!pipe->inputs[i])
+ continue;
+
ret = vsp1_video_pipeline_validate_branch(pipe, pipe->inputs[i],
pipe->output);
if (ret < 0)
@@ -449,11 +452,16 @@ static void vsp1_video_frame_end(struct vsp1_pipeline *pipe,
static void vsp1_video_pipeline_frame_end(struct vsp1_pipeline *pipe)
{
+ struct vsp1_device *vsp1 = pipe->output->entity.vsp1;
unsigned int i;
/* Complete buffers on all video nodes. */
- for (i = 0; i < pipe->num_inputs; ++i)
+ for (i = 0; i < vsp1->pdata.rpf_count; ++i) {
+ if (!pipe->inputs[i])
+ continue;
+
vsp1_video_frame_end(pipe, pipe->inputs[i]);
+ }
if (!pipe->lif)
vsp1_video_frame_end(pipe, pipe->output);