[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>
This commit is contained in:
parent
fe6adc1991
commit
ae5df81331
|
@ -255,8 +255,8 @@ isp_video_remote_subdev(struct isp_video *video, u32 *pad)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a pointer to the ISP video instance at the far end of the pipeline. */
|
/* Return a pointer to the ISP video instance at the far end of the pipeline. */
|
||||||
static struct isp_video *
|
static int isp_video_get_graph_data(struct isp_video *video,
|
||||||
isp_video_far_end(struct isp_video *video)
|
struct isp_pipeline *pipe)
|
||||||
{
|
{
|
||||||
struct media_entity_graph graph;
|
struct media_entity_graph graph;
|
||||||
struct media_entity *entity = &video->video.entity;
|
struct media_entity *entity = &video->video.entity;
|
||||||
|
@ -267,21 +267,38 @@ isp_video_far_end(struct isp_video *video)
|
||||||
media_entity_graph_walk_start(&graph, entity);
|
media_entity_graph_walk_start(&graph, entity);
|
||||||
|
|
||||||
while ((entity = media_entity_graph_walk_next(&graph))) {
|
while ((entity = media_entity_graph_walk_next(&graph))) {
|
||||||
|
struct isp_video *__video;
|
||||||
|
|
||||||
|
pipe->entities |= 1 << entity->id;
|
||||||
|
|
||||||
|
if (far_end != NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (entity == &video->video.entity)
|
if (entity == &video->video.entity)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
|
if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
far_end = to_isp_video(media_entity_to_video_device(entity));
|
__video = to_isp_video(media_entity_to_video_device(entity));
|
||||||
if (far_end->type != video->type)
|
if (__video->type != video->type)
|
||||||
break;
|
far_end = __video;
|
||||||
|
|
||||||
far_end = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&mdev->graph_mutex);
|
mutex_unlock(&mdev->graph_mutex);
|
||||||
return far_end;
|
|
||||||
|
if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
|
||||||
|
pipe->input = far_end;
|
||||||
|
pipe->output = video;
|
||||||
|
} else {
|
||||||
|
if (far_end == NULL)
|
||||||
|
return -EPIPE;
|
||||||
|
|
||||||
|
pipe->input = video;
|
||||||
|
pipe->output = far_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -304,8 +321,6 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe)
|
||||||
struct v4l2_subdev *subdev;
|
struct v4l2_subdev *subdev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pipe->entities = 0;
|
|
||||||
|
|
||||||
subdev = isp_video_remote_subdev(pipe->output, NULL);
|
subdev = isp_video_remote_subdev(pipe->output, NULL);
|
||||||
if (subdev == NULL)
|
if (subdev == NULL)
|
||||||
return -EPIPE;
|
return -EPIPE;
|
||||||
|
@ -313,8 +328,6 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe)
|
||||||
while (1) {
|
while (1) {
|
||||||
unsigned int shifter_link;
|
unsigned int shifter_link;
|
||||||
|
|
||||||
pipe->entities |= 1U << subdev->entity.id;
|
|
||||||
|
|
||||||
/* Retrieve the sink format */
|
/* Retrieve the sink format */
|
||||||
pad = &subdev->entity.pads[0];
|
pad = &subdev->entity.pads[0];
|
||||||
if (!(pad->flags & MEDIA_PAD_FL_SINK))
|
if (!(pad->flags & MEDIA_PAD_FL_SINK))
|
||||||
|
@ -977,7 +990,6 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
|
||||||
struct isp_video *video = video_drvdata(file);
|
struct isp_video *video = video_drvdata(file);
|
||||||
enum isp_pipeline_state state;
|
enum isp_pipeline_state state;
|
||||||
struct isp_pipeline *pipe;
|
struct isp_pipeline *pipe;
|
||||||
struct isp_video *far_end;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -997,6 +1009,8 @@ isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
|
||||||
pipe = video->video.entity.pipe
|
pipe = video->video.entity.pipe
|
||||||
? to_isp_pipeline(&video->video.entity) : &video->pipe;
|
? to_isp_pipeline(&video->video.entity) : &video->pipe;
|
||||||
|
|
||||||
|
pipe->entities = 0;
|
||||||
|
|
||||||
if (video->isp->pdata->set_constraints)
|
if (video->isp->pdata->set_constraints)
|
||||||
video->isp->pdata->set_constraints(video->isp, true);
|
video->isp->pdata->set_constraints(video->isp, true);
|
||||||
pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]);
|
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)
|
||||||
video->bpl_padding = ret;
|
video->bpl_padding = ret;
|
||||||
video->bpl_value = vfh->format.fmt.pix.bytesperline;
|
video->bpl_value = vfh->format.fmt.pix.bytesperline;
|
||||||
|
|
||||||
/* Find the ISP video node connected at the far end of the pipeline and
|
ret = isp_video_get_graph_data(video, pipe);
|
||||||
* update the pipeline.
|
if (ret < 0)
|
||||||
*/
|
goto err_check_format;
|
||||||
far_end = isp_video_far_end(video);
|
|
||||||
|
|
||||||
if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
|
if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
|
||||||
state = ISP_PIPELINE_STREAM_OUTPUT | ISP_PIPELINE_IDLE_OUTPUT;
|
state = ISP_PIPELINE_STREAM_OUTPUT | ISP_PIPELINE_IDLE_OUTPUT;
|
||||||
pipe->input = far_end;
|
else
|
||||||
pipe->output = video;
|
|
||||||
} else {
|
|
||||||
if (far_end == NULL) {
|
|
||||||
ret = -EPIPE;
|
|
||||||
goto err_check_format;
|
|
||||||
}
|
|
||||||
|
|
||||||
state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT;
|
state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT;
|
||||||
pipe->input = video;
|
|
||||||
pipe->output = far_end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Validate the pipeline and update its state. */
|
/* Validate the pipeline and update its state. */
|
||||||
ret = isp_video_validate_pipeline(pipe);
|
ret = isp_video_validate_pipeline(pipe);
|
||||||
|
|
Loading…
Reference in New Issue