diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2012-03-05 18:22:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-14 07:51:01 -0400 |
commit | ae5df813314a581225db9e9f5ca9c61f2b216775 (patch) | |
tree | 7c97ba5f004906bca999d39a52c519d0547e00a3 /drivers | |
parent | fe6adc1991b6ce0f6d1c4ca74ec9f02d2d8cb3b4 (diff) |
[media] omap3isp: Refactor collecting information on entities in pipeline
Collect information on entities in pipeline in isp_video_far_end(), outside
pipeline validation. As this causes the function to have side effects,
rename the function accordingly.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index b6c407c37502..3f5065ac9ad9 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -255,8 +255,8 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad) | |||
255 | } | 255 | } |
256 | 256 | ||
257 | /* Return a pointer to the ISP video instance at the far end of the pipeline. */ | 257 | /* Return a pointer to the ISP video instance at the far end of the pipeline. */ |
258 | static struct isp_video * | 258 | static int isp_video_get_graph_data(struct isp_video *video, |
259 | isp_video_far_end(struct isp_video *video) | 259 | struct isp_pipeline *pipe) |
260 | { | 260 | { |
261 | struct media_entity_graph graph; | 261 | struct media_entity_graph graph; |
262 | struct media_entity *entity = &video->video.entity; | 262 | struct media_entity *entity = &video->video.entity; |
@@ -267,21 +267,38 @@ isp_video_far_end(struct isp_video *video) | |||
267 | media_entity_graph_walk_start(&graph, entity); | 267 | media_entity_graph_walk_start(&graph, entity); |
268 | 268 | ||
269 | while ((entity = media_entity_graph_walk_next(&graph))) { | 269 | while ((entity = media_entity_graph_walk_next(&graph))) { |
270 | struct isp_video *__video; | ||
271 | |||
272 | pipe->entities |= 1 << entity->id; | ||
273 | |||
274 | if (far_end != NULL) | ||
275 | continue; | ||
276 | |||
270 | if (entity == &video->video.entity) | 277 | if (entity == &video->video.entity) |
271 | continue; | 278 | continue; |
272 | 279 | ||
273 | if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE) | 280 | if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE) |
274 | continue; | 281 | continue; |
275 | 282 | ||
276 | far_end = to_isp_video(media_entity_to_video_device(entity)); | 283 | __video = to_isp_video(media_entity_to_video_device(entity)); |
277 | if (far_end->type != video->type) | 284 | if (__video->type != video->type) |
278 | break; | 285 | far_end = __video; |
279 | |||
280 | far_end = NULL; | ||
281 | } | 286 | } |
282 | 287 | ||
283 | mutex_unlock(&mdev->graph_mutex); | 288 | mutex_unlock(&mdev->graph_mutex); |
284 | return far_end; | 289 | |
290 | if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
291 | pipe->input = far_end; | ||
292 | pipe->output = video; | ||
293 | } else { | ||
294 | if (far_end == NULL) | ||
295 | return -EPIPE; | ||
296 | |||
297 | pipe->input = video; | ||
298 | pipe->output = far_end; | ||
299 | } | ||
300 | |||
301 | return 0; | ||
285 | } | 302 | } |
286 | 303 | ||
287 | /* | 304 | /* |
@@ -304,8 +321,6 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
304 | struct v4l2_subdev *subdev; | 321 | struct v4l2_subdev *subdev; |
305 | int ret; | 322 | int ret; |
306 | 323 | ||
307 | pipe->entities = 0; | ||
308 | |||
309 | subdev = isp_video_remote_subdev(pipe->output, NULL); | 324 | subdev = isp_video_remote_subdev(pipe->output, NULL); |
310 | if (subdev == NULL) | 325 | if (subdev == NULL) |
311 | return -EPIPE; | 326 | return -EPIPE; |
@@ -313,8 +328,6 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
313 | while (1) { | 328 | while (1) { |
314 | unsigned int shifter_link; | 329 | unsigned int shifter_link; |
315 | 330 | ||
316 | pipe->entities |= 1U << subdev->entity.id; | ||
317 | |||
318 | /* Retrieve the sink format */ | 331 | /* Retrieve the sink format */ |
319 | pad = &subdev->entity.pads[0]; | 332 | pad = &subdev->entity.pads[0]; |
320 | if (!(pad->flags & MEDIA_PAD_FL_SINK)) | 333 | if (!(pad->flags & MEDIA_PAD_FL_SINK)) |
@@ -977,7 +990,6 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) | |||
977 | struct isp_video *video = video_drvdata(file); | 990 | struct isp_video *video = video_drvdata(file); |
978 | enum isp_pipeline_state state; | 991 | enum isp_pipeline_state state; |
979 | struct isp_pipeline *pipe; | 992 | struct isp_pipeline *pipe; |
980 | struct isp_video *far_end; | ||
981 | unsigned long flags; | 993 | unsigned long flags; |
982 | int ret; | 994 | int ret; |
983 | 995 | ||
@@ -997,6 +1009,8 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) | |||
997 | pipe = video->video.entity.pipe | 1009 | pipe = video->video.entity.pipe |
998 | ? to_isp_pipeline(&video->video.entity) : &video->pipe; | 1010 | ? to_isp_pipeline(&video->video.entity) : &video->pipe; |
999 | 1011 | ||
1012 | pipe->entities = 0; | ||
1013 | |||
1000 | if (video->isp->pdata->set_constraints) | 1014 | if (video->isp->pdata->set_constraints) |
1001 | video->isp->pdata->set_constraints(video->isp, true); | 1015 | video->isp->pdata->set_constraints(video->isp, true); |
1002 | pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); | 1016 | pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); |
@@ -1016,25 +1030,14 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type) | |||
1016 | video->bpl_padding = ret; | 1030 | video->bpl_padding = ret; |
1017 | video->bpl_value = vfh->format.fmt.pix.bytesperline; | 1031 | video->bpl_value = vfh->format.fmt.pix.bytesperline; |
1018 | 1032 | ||
1019 | /* Find the ISP video node connected at the far end of the pipeline and | 1033 | ret = isp_video_get_graph_data(video, pipe); |
1020 | * update the pipeline. | 1034 | if (ret < 0) |
1021 | */ | 1035 | goto err_check_format; |
1022 | far_end = isp_video_far_end(video); | ||
1023 | 1036 | ||
1024 | if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 1037 | if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1025 | state = ISP_PIPELINE_STREAM_OUTPUT | ISP_PIPELINE_IDLE_OUTPUT; | 1038 | state = ISP_PIPELINE_STREAM_OUTPUT | ISP_PIPELINE_IDLE_OUTPUT; |
1026 | pipe->input = far_end; | 1039 | else |
1027 | pipe->output = video; | ||
1028 | } else { | ||
1029 | if (far_end == NULL) { | ||
1030 | ret = -EPIPE; | ||
1031 | goto err_check_format; | ||
1032 | } | ||
1033 | |||
1034 | state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT; | 1040 | state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT; |
1035 | pipe->input = video; | ||
1036 | pipe->output = far_end; | ||
1037 | } | ||
1038 | 1041 | ||
1039 | /* Validate the pipeline and update its state. */ | 1042 | /* Validate the pipeline and update its state. */ |
1040 | ret = isp_video_validate_pipeline(pipe); | 1043 | ret = isp_video_validate_pipeline(pipe); |