Commit 54b5a749 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

[media] v4l: vsp1: Use media entity enumeration interface

Instead of using a bitmap directly in a driver, use the new media entity
enumeration interface to perform the same.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 17d3d405
...@@ -282,24 +282,35 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe, ...@@ -282,24 +282,35 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
struct vsp1_rwpf *output) struct vsp1_rwpf *output)
{ {
struct vsp1_entity *entity; struct vsp1_entity *entity;
unsigned int entities = 0; struct media_entity_enum ent_enum;
struct media_pad *pad; struct media_pad *pad;
int rval;
bool bru_found = false; bool bru_found = false;
input->location.left = 0; input->location.left = 0;
input->location.top = 0; input->location.top = 0;
rval = media_entity_enum_init(
&ent_enum, input->entity.pads[RWPF_PAD_SOURCE].graph_obj.mdev);
if (rval)
return rval;
pad = media_entity_remote_pad(&input->entity.pads[RWPF_PAD_SOURCE]); pad = media_entity_remote_pad(&input->entity.pads[RWPF_PAD_SOURCE]);
while (1) { while (1) {
if (pad == NULL) if (pad == NULL) {
return -EPIPE; rval = -EPIPE;
goto out;
}
/* We've reached a video node, that shouldn't have happened. */ /* We've reached a video node, that shouldn't have happened. */
if (!is_media_entity_v4l2_subdev(pad->entity)) if (!is_media_entity_v4l2_subdev(pad->entity)) {
return -EPIPE; rval = -EPIPE;
goto out;
}
entity = to_vsp1_entity(media_entity_to_v4l2_subdev(pad->entity)); entity = to_vsp1_entity(
media_entity_to_v4l2_subdev(pad->entity));
/* A BRU is present in the pipeline, store the compose rectangle /* A BRU is present in the pipeline, store the compose rectangle
* location in the input RPF for use when configuring the RPF. * location in the input RPF for use when configuring the RPF.
...@@ -322,15 +333,18 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe, ...@@ -322,15 +333,18 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
break; break;
/* Ensure the branch has no loop. */ /* Ensure the branch has no loop. */
if (entities & (1 << media_entity_id(&entity->subdev.entity))) if (media_entity_enum_test_and_set(&ent_enum,
return -EPIPE; &entity->subdev.entity)) {
rval = -EPIPE;
entities |= 1 << media_entity_id(&entity->subdev.entity); goto out;
}
/* UDS can't be chained. */ /* UDS can't be chained. */
if (entity->type == VSP1_ENTITY_UDS) { if (entity->type == VSP1_ENTITY_UDS) {
if (pipe->uds) if (pipe->uds) {
return -EPIPE; rval = -EPIPE;
goto out;
}
pipe->uds = entity; pipe->uds = entity;
pipe->uds_input = bru_found ? pipe->bru pipe->uds_input = bru_found ? pipe->bru
...@@ -348,9 +362,12 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe, ...@@ -348,9 +362,12 @@ static int vsp1_pipeline_validate_branch(struct vsp1_pipeline *pipe,
/* The last entity must be the output WPF. */ /* The last entity must be the output WPF. */
if (entity != &output->entity) if (entity != &output->entity)
return -EPIPE; rval = -EPIPE;
return 0; out:
media_entity_enum_cleanup(&ent_enum);
return rval;
} }
static void __vsp1_pipeline_cleanup(struct vsp1_pipeline *pipe) static void __vsp1_pipeline_cleanup(struct vsp1_pipeline *pipe)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment