Lines Matching full:video

5  * TI OMAP3 ISP - Generic video node
129 * @video: ISP video instance
135 * per line value in the pix format and information from the video instance.
139 static unsigned int isp_video_mbus_to_pix(const struct isp_video *video, in isp_video_mbus_to_pix() argument
165 if (video->bpl_max) in isp_video_mbus_to_pix()
166 bpl = clamp(bpl, min_bpl, video->bpl_max); in isp_video_mbus_to_pix()
170 if (!video->bpl_zero_padding || bpl != min_bpl) in isp_video_mbus_to_pix()
171 bpl = ALIGN(bpl, video->bpl_alignment); in isp_video_mbus_to_pix()
205 isp_video_remote_subdev(struct isp_video *video, u32 *pad) in isp_video_remote_subdev() argument
209 remote = media_pad_remote_pad_first(&video->pad); in isp_video_remote_subdev()
220 /* Return a pointer to the ISP video instance at the far end of the pipeline. */
221 static int isp_video_get_graph_data(struct isp_video *video, in isp_video_get_graph_data() argument
241 if (entity == &video->video.entity) in isp_video_get_graph_data()
248 if (__video->type != video->type) in isp_video_get_graph_data()
254 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in isp_video_get_graph_data()
256 pipe->output = video; in isp_video_get_graph_data()
261 pipe->input = video; in isp_video_get_graph_data()
269 __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) in __isp_video_get_format() argument
278 subdev = isp_video_remote_subdev(video, &pad); in __isp_video_get_format()
284 mutex_lock(&video->mutex); in __isp_video_get_format()
286 mutex_unlock(&video->mutex); in __isp_video_get_format()
291 format->type = video->type; in __isp_video_get_format()
292 return isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in __isp_video_get_format()
296 isp_video_check_format(struct isp_video *video, struct isp_video_fh *vfh) in isp_video_check_format() argument
302 ret = __isp_video_get_format(video, &format); in isp_video_check_format()
318 * Video queue operations
326 struct isp_video *video = vfh->video; in isp_video_queue_setup() local
334 *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); in isp_video_queue_setup()
344 struct isp_video *video = vfh->video; in isp_video_buffer_prepare() local
347 /* Refuse to prepare the buffer is the video node has registered an in isp_video_buffer_prepare()
353 if (unlikely(video->error)) in isp_video_buffer_prepare()
358 dev_dbg(video->isp->dev, in isp_video_buffer_prepare()
372 * @buf: Video buffer
384 struct isp_video *video = vfh->video; in isp_video_buffer_queue() local
385 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_buffer_queue()
391 spin_lock_irqsave(&video->irqlock, flags); in isp_video_buffer_queue()
393 if (unlikely(video->error)) { in isp_video_buffer_queue()
395 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
399 empty = list_empty(&video->dmaqueue); in isp_video_buffer_queue()
400 list_add_tail(&buffer->irqlist, &video->dmaqueue); in isp_video_buffer_queue()
402 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
405 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_buffer_queue()
412 video->ops->queue(video, buffer); in isp_video_buffer_queue()
413 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in isp_video_buffer_queue()
428 * @video: ISP video object
431 * Return all buffers queued on the video node to videobuf2 in the given state.
435 * The function must be called with the video irqlock held.
437 static void omap3isp_video_return_buffers(struct isp_video *video, in omap3isp_video_return_buffers() argument
440 while (!list_empty(&video->dmaqueue)) { in omap3isp_video_return_buffers()
443 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_return_buffers()
454 struct isp_video *video = vfh->video; in isp_video_start_streaming() local
455 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_start_streaming()
469 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
470 omap3isp_video_return_buffers(video, VB2_BUF_STATE_QUEUED); in isp_video_start_streaming()
471 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
475 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
476 if (list_empty(&video->dmaqueue)) in isp_video_start_streaming()
477 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in isp_video_start_streaming()
478 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
492 * @video: ISP video object
494 * Remove the current video buffer from the DMA queue and fill its timestamp and
497 * For capture video nodes the buffer state is set to VB2_BUF_STATE_DONE if no
499 * For video output nodes the buffer state is always set to VB2_BUF_STATE_DONE.
506 struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video) in omap3isp_video_buffer_next() argument
508 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in omap3isp_video_buffer_next()
513 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
514 if (WARN_ON(list_empty(&video->dmaqueue))) { in omap3isp_video_buffer_next()
515 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
519 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
522 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
526 /* Do frame number propagation only if this is the output video node. in omap3isp_video_buffer_next()
532 if (video == pipe->output && !pipe->do_propagation) in omap3isp_video_buffer_next()
544 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { in omap3isp_video_buffer_next()
553 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
555 if (list_empty(&video->dmaqueue)) { in omap3isp_video_buffer_next()
558 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
560 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_buffer_next()
569 if (video->pipe.stream_state == ISP_PIPELINE_STREAM_CONTINUOUS) in omap3isp_video_buffer_next()
570 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_buffer_next()
575 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) { in omap3isp_video_buffer_next()
581 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
584 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
590 * omap3isp_video_cancel_stream - Cancel stream on a video node
591 * @video: ISP video object
593 * Cancelling a stream returns all buffers queued on the video node to videobuf2
596 void omap3isp_video_cancel_stream(struct isp_video *video) in omap3isp_video_cancel_stream() argument
600 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_cancel_stream()
601 omap3isp_video_return_buffers(video, VB2_BUF_STATE_ERROR); in omap3isp_video_cancel_stream()
602 video->error = true; in omap3isp_video_cancel_stream()
603 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_cancel_stream()
608 * @video: ISP video object
612 * requests video queue layer to discard buffers marked as DONE if it's in
616 void omap3isp_video_resume(struct isp_video *video, int continuous) in omap3isp_video_resume() argument
620 if (continuous && video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in omap3isp_video_resume()
621 mutex_lock(&video->queue_lock); in omap3isp_video_resume()
622 vb2_discard_done(video->queue); in omap3isp_video_resume()
623 mutex_unlock(&video->queue_lock); in omap3isp_video_resume()
626 if (!list_empty(&video->dmaqueue)) { in omap3isp_video_resume()
627 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_resume()
629 video->ops->queue(video, buf); in omap3isp_video_resume()
630 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in omap3isp_video_resume()
633 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_resume()
644 struct isp_video *video = video_drvdata(file); in isp_video_querycap() local
647 strscpy(cap->card, video->video.name, sizeof(cap->card)); in isp_video_querycap()
661 struct isp_video *video = video_drvdata(file); in isp_video_get_format() local
663 if (format->type != video->type) in isp_video_get_format()
666 mutex_lock(&video->mutex); in isp_video_get_format()
668 mutex_unlock(&video->mutex); in isp_video_get_format()
677 struct isp_video *video = video_drvdata(file); in isp_video_set_format() local
680 if (format->type != video->type) in isp_video_set_format()
690 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_format()
694 /* The ISP has no concept of video standard, select the in isp_video_set_format()
703 if (video != &video->isp->isp_ccdc.video_out) in isp_video_set_format()
722 isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix); in isp_video_set_format()
724 mutex_lock(&video->mutex); in isp_video_set_format()
726 mutex_unlock(&video->mutex); in isp_video_set_format()
734 struct isp_video *video = video_drvdata(file); in isp_video_try_format() local
742 if (format->type != video->type) in isp_video_try_format()
745 subdev = isp_video_remote_subdev(video, &pad); in isp_video_try_format()
756 isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in isp_video_try_format()
763 struct isp_video *video = video_drvdata(file); in isp_video_get_selection() local
779 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_get_selection()
785 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_get_selection()
791 subdev = isp_video_remote_subdev(video, &pad); in isp_video_get_selection()
821 struct isp_video *video = video_drvdata(file); in isp_video_set_selection() local
834 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_selection()
838 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_set_selection()
844 subdev = isp_video_remote_subdev(video, &pad); in isp_video_set_selection()
849 mutex_lock(&video->mutex); in isp_video_set_selection()
851 mutex_unlock(&video->mutex); in isp_video_set_selection()
862 struct isp_video *video = video_drvdata(file); in isp_video_get_param() local
864 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_get_param()
865 video->type != a->type) in isp_video_get_param()
880 struct isp_video *video = video_drvdata(file); in isp_video_set_param() local
882 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_set_param()
883 video->type != a->type) in isp_video_set_param()
898 struct isp_video *video = video_drvdata(file); in isp_video_reqbufs() local
901 mutex_lock(&video->queue_lock); in isp_video_reqbufs()
903 mutex_unlock(&video->queue_lock); in isp_video_reqbufs()
912 struct isp_video *video = video_drvdata(file); in isp_video_querybuf() local
915 mutex_lock(&video->queue_lock); in isp_video_querybuf()
917 mutex_unlock(&video->queue_lock); in isp_video_querybuf()
926 struct isp_video *video = video_drvdata(file); in isp_video_qbuf() local
929 mutex_lock(&video->queue_lock); in isp_video_qbuf()
930 ret = vb2_qbuf(&vfh->queue, video->video.v4l2_dev->mdev, b); in isp_video_qbuf()
931 mutex_unlock(&video->queue_lock); in isp_video_qbuf()
940 struct isp_video *video = video_drvdata(file); in isp_video_dqbuf() local
943 mutex_lock(&video->queue_lock); in isp_video_dqbuf()
945 mutex_unlock(&video->queue_lock); in isp_video_dqbuf()
950 static int isp_video_check_external_subdevs(struct isp_video *video, in isp_video_check_external_subdevs() argument
953 struct isp_device *isp = video->isp; in isp_video_check_external_subdevs()
1018 ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &video->video, in isp_video_check_external_subdevs()
1047 * either a sensor or a video node. The output is always a video node.
1049 * As every pipeline has an output video node, the ISP video objects at the
1078 struct isp_video *video = video_drvdata(file); in isp_video_streamon() local
1084 if (type != video->type) in isp_video_streamon()
1087 mutex_lock(&video->stream_lock); in isp_video_streamon()
1092 pipe = to_isp_pipeline(&video->video.entity) ? : &video->pipe; in isp_video_streamon()
1094 ret = media_entity_enum_init(&pipe->ent_enum, &video->isp->media_dev); in isp_video_streamon()
1099 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); in isp_video_streamon()
1102 ret = video_device_pipeline_start(&video->video, &pipe->pipe); in isp_video_streamon()
1109 ret = isp_video_check_format(video, vfh); in isp_video_streamon()
1113 video->bpl_padding = ret; in isp_video_streamon()
1114 video->bpl_value = vfh->format.fmt.pix.bytesperline; in isp_video_streamon()
1116 ret = isp_video_get_graph_data(video, pipe); in isp_video_streamon()
1120 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamon()
1125 ret = isp_video_check_external_subdevs(video, pipe); in isp_video_streamon()
1140 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_streamon()
1143 video->queue = &vfh->queue; in isp_video_streamon()
1144 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1148 mutex_lock(&video->queue_lock); in isp_video_streamon()
1150 mutex_unlock(&video->queue_lock); in isp_video_streamon()
1154 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1159 video_device_pipeline_stop(&video->video); in isp_video_streamon()
1169 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1170 video->queue = NULL; in isp_video_streamon()
1175 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1184 struct isp_video *video = video_drvdata(file); in isp_video_streamoff() local
1185 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_streamoff()
1190 if (type != video->type) in isp_video_streamoff()
1193 mutex_lock(&video->stream_lock); in isp_video_streamoff()
1196 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1198 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1204 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamoff()
1217 omap3isp_video_cancel_stream(video); in isp_video_streamoff()
1219 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1221 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1222 video->queue = NULL; in isp_video_streamoff()
1223 video->error = false; in isp_video_streamoff()
1226 video_device_pipeline_stop(&video->video); in isp_video_streamoff()
1231 mutex_unlock(&video->stream_lock); in isp_video_streamoff()
1290 struct isp_video *video = video_drvdata(file); in isp_video_open() local
1299 v4l2_fh_init(&handle->vfh, &video->video); in isp_video_open()
1303 if (omap3isp_get(video->isp) == NULL) { in isp_video_open()
1308 ret = v4l2_pipeline_pm_get(&video->video.entity); in isp_video_open()
1310 omap3isp_put(video->isp); in isp_video_open()
1315 queue->type = video->type; in isp_video_open()
1322 queue->dev = video->isp->dev; in isp_video_open()
1326 omap3isp_put(video->isp); in isp_video_open()
1331 handle->format.type = video->type; in isp_video_open()
1334 handle->video = video; in isp_video_open()
1349 struct isp_video *video = video_drvdata(file); in isp_video_release() local
1354 isp_video_streamoff(file, vfh, video->type); in isp_video_release()
1356 mutex_lock(&video->queue_lock); in isp_video_release()
1358 mutex_unlock(&video->queue_lock); in isp_video_release()
1360 v4l2_pipeline_pm_put(&video->video.entity); in isp_video_release()
1368 omap3isp_put(video->isp); in isp_video_release()
1376 struct isp_video *video = video_drvdata(file); in isp_video_poll() local
1379 mutex_lock(&video->queue_lock); in isp_video_poll()
1381 mutex_unlock(&video->queue_lock); in isp_video_poll()
1403 * ISP video core
1409 int omap3isp_video_init(struct isp_video *video, const char *name) in omap3isp_video_init() argument
1414 switch (video->type) { in omap3isp_video_init()
1417 video->pad.flags = MEDIA_PAD_FL_SINK in omap3isp_video_init()
1422 video->pad.flags = MEDIA_PAD_FL_SOURCE in omap3isp_video_init()
1424 video->video.vfl_dir = VFL_DIR_TX; in omap3isp_video_init()
1431 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad); in omap3isp_video_init()
1435 mutex_init(&video->mutex); in omap3isp_video_init()
1436 atomic_set(&video->active, 0); in omap3isp_video_init()
1438 spin_lock_init(&video->pipe.lock); in omap3isp_video_init()
1439 mutex_init(&video->stream_lock); in omap3isp_video_init()
1440 mutex_init(&video->queue_lock); in omap3isp_video_init()
1441 spin_lock_init(&video->irqlock); in omap3isp_video_init()
1443 /* Initialize the video device. */ in omap3isp_video_init()
1444 if (video->ops == NULL) in omap3isp_video_init()
1445 video->ops = &isp_video_dummy_ops; in omap3isp_video_init()
1447 video->video.fops = &isp_video_fops; in omap3isp_video_init()
1448 snprintf(video->video.name, sizeof(video->video.name), in omap3isp_video_init()
1450 video->video.vfl_type = VFL_TYPE_VIDEO; in omap3isp_video_init()
1451 video->video.release = video_device_release_empty; in omap3isp_video_init()
1452 video->video.ioctl_ops = &isp_video_ioctl_ops; in omap3isp_video_init()
1453 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_init()
1454 video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE in omap3isp_video_init()
1457 video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT in omap3isp_video_init()
1460 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED; in omap3isp_video_init()
1462 video_set_drvdata(&video->video, video); in omap3isp_video_init()
1467 void omap3isp_video_cleanup(struct isp_video *video) in omap3isp_video_cleanup() argument
1469 media_entity_cleanup(&video->video.entity); in omap3isp_video_cleanup()
1470 mutex_destroy(&video->queue_lock); in omap3isp_video_cleanup()
1471 mutex_destroy(&video->stream_lock); in omap3isp_video_cleanup()
1472 mutex_destroy(&video->mutex); in omap3isp_video_cleanup()
1475 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) in omap3isp_video_register() argument
1479 video->video.v4l2_dev = vdev; in omap3isp_video_register()
1481 ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1); in omap3isp_video_register()
1483 dev_err(video->isp->dev, in omap3isp_video_register()
1484 "%s: could not register video device (%d)\n", in omap3isp_video_register()
1490 void omap3isp_video_unregister(struct isp_video *video) in omap3isp_video_unregister() argument
1492 video_unregister_device(&video->video); in omap3isp_video_unregister()