summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2015-12-16 11:32:29 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 12:19:20 -0200
commit74a4133079f739eb2f4604263fdb974ce10120a8 (patch)
tree4ac54a75024a8316f7c5427224d27f69923024e4 /drivers/media
parent29d8da02d13020a18929a30692d454bd863d4207 (diff)
[media] media: Keep using the same graph walk object for a given pipeline
Initialise a given graph walk object once, and then keep using it whilst the same pipeline is running. Once the pipeline is stopped, release the graph walk object. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/media-entity.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 86a8396f6ec2..3cad525c2ac1 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -379,10 +379,10 @@ __must_check int media_entity_pipeline_start(struct media_entity *entity,
mutex_lock(&mdev->graph_mutex);
- ret = media_entity_graph_walk_init(&pipe->graph, mdev);
- if (ret) {
- mutex_unlock(&mdev->graph_mutex);
- return ret;
+ if (!pipe->streaming_count++) {
+ ret = media_entity_graph_walk_init(&pipe->graph, mdev);
+ if (ret)
+ goto error_graph_walk_start;
}
media_entity_graph_walk_start(&pipe->graph, entity);
@@ -483,7 +483,9 @@ error:
break;
}
- media_entity_graph_walk_cleanup(graph);
+error_graph_walk_start:
+ if (!--pipe->streaming_count)
+ media_entity_graph_walk_cleanup(graph);
mutex_unlock(&mdev->graph_mutex);
@@ -495,9 +497,11 @@ void media_entity_pipeline_stop(struct media_entity *entity)
{
struct media_device *mdev = entity->graph_obj.mdev;
struct media_entity_graph *graph = &entity->pipe->graph;
+ struct media_pipeline *pipe = entity->pipe;
mutex_lock(&mdev->graph_mutex);
+ WARN_ON(!pipe->streaming_count);
media_entity_graph_walk_start(graph, entity);
while ((entity = media_entity_graph_walk_next(graph))) {
@@ -506,7 +510,8 @@ void media_entity_pipeline_stop(struct media_entity *entity)
entity->pipe = NULL;
}
- media_entity_graph_walk_cleanup(graph);
+ if (!--pipe->streaming_count)
+ media_entity_graph_walk_cleanup(graph);
mutex_unlock(&mdev->graph_mutex);
}