• Home
  • Raw
  • Download

Lines Matching full:video

4  * TI OMAP3 ISP - Generic video node
133 * @video: ISP video instance
139 * per line value in the pix format and information from the video instance.
143 static unsigned int isp_video_mbus_to_pix(const struct isp_video *video, in isp_video_mbus_to_pix() argument
169 if (video->bpl_max) in isp_video_mbus_to_pix()
170 bpl = clamp(bpl, min_bpl, video->bpl_max); in isp_video_mbus_to_pix()
174 if (!video->bpl_zero_padding || bpl != min_bpl) in isp_video_mbus_to_pix()
175 bpl = ALIGN(bpl, video->bpl_alignment); in isp_video_mbus_to_pix()
209 isp_video_remote_subdev(struct isp_video *video, u32 *pad) in isp_video_remote_subdev() argument
213 remote = media_entity_remote_pad(&video->pad); in isp_video_remote_subdev()
224 /* Return a pointer to the ISP video instance at the far end of the pipeline. */
225 static int isp_video_get_graph_data(struct isp_video *video, in isp_video_get_graph_data() argument
229 struct media_entity *entity = &video->video.entity; in isp_video_get_graph_data()
251 if (entity == &video->video.entity) in isp_video_get_graph_data()
258 if (__video->type != video->type) in isp_video_get_graph_data()
266 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in isp_video_get_graph_data()
268 pipe->output = video; in isp_video_get_graph_data()
273 pipe->input = video; in isp_video_get_graph_data()
281 __isp_video_get_format(struct isp_video *video, struct v4l2_format *format) in __isp_video_get_format() argument
288 subdev = isp_video_remote_subdev(video, &pad); in __isp_video_get_format()
295 mutex_lock(&video->mutex); in __isp_video_get_format()
297 mutex_unlock(&video->mutex); in __isp_video_get_format()
302 format->type = video->type; in __isp_video_get_format()
303 return isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in __isp_video_get_format()
307 isp_video_check_format(struct isp_video *video, struct isp_video_fh *vfh) in isp_video_check_format() argument
313 ret = __isp_video_get_format(video, &format); in isp_video_check_format()
329 * Video queue operations
337 struct isp_video *video = vfh->video; in isp_video_queue_setup() local
345 *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0])); in isp_video_queue_setup()
355 struct isp_video *video = vfh->video; in isp_video_buffer_prepare() local
358 /* Refuse to prepare the buffer is the video node has registered an in isp_video_buffer_prepare()
364 if (unlikely(video->error)) in isp_video_buffer_prepare()
369 dev_dbg(video->isp->dev, in isp_video_buffer_prepare()
383 * @buf: Video buffer
395 struct isp_video *video = vfh->video; in isp_video_buffer_queue() local
396 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_buffer_queue()
402 spin_lock_irqsave(&video->irqlock, flags); in isp_video_buffer_queue()
404 if (unlikely(video->error)) { in isp_video_buffer_queue()
406 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
410 empty = list_empty(&video->dmaqueue); in isp_video_buffer_queue()
411 list_add_tail(&buffer->irqlist, &video->dmaqueue); in isp_video_buffer_queue()
413 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_buffer_queue()
416 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_buffer_queue()
423 video->ops->queue(video, buffer); in isp_video_buffer_queue()
424 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in isp_video_buffer_queue()
439 * @video: ISP video object
442 * Return all buffers queued on the video node to videobuf2 in the given state.
446 * The function must be called with the video irqlock held.
448 static void omap3isp_video_return_buffers(struct isp_video *video, in omap3isp_video_return_buffers() argument
451 while (!list_empty(&video->dmaqueue)) { in omap3isp_video_return_buffers()
454 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_return_buffers()
465 struct isp_video *video = vfh->video; in isp_video_start_streaming() local
466 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_start_streaming()
480 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
481 omap3isp_video_return_buffers(video, VB2_BUF_STATE_QUEUED); in isp_video_start_streaming()
482 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
486 spin_lock_irqsave(&video->irqlock, flags); in isp_video_start_streaming()
487 if (list_empty(&video->dmaqueue)) in isp_video_start_streaming()
488 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in isp_video_start_streaming()
489 spin_unlock_irqrestore(&video->irqlock, flags); in isp_video_start_streaming()
503 * @video: ISP video object
505 * Remove the current video buffer from the DMA queue and fill its timestamp and
508 * For capture video nodes the buffer state is set to VB2_BUF_STATE_DONE if no
510 * For video output nodes the buffer state is always set to VB2_BUF_STATE_DONE.
517 struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video) in omap3isp_video_buffer_next() argument
519 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in omap3isp_video_buffer_next()
524 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
525 if (WARN_ON(list_empty(&video->dmaqueue))) { in omap3isp_video_buffer_next()
526 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
530 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
533 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
537 /* Do frame number propagation only if this is the output video node. in omap3isp_video_buffer_next()
543 if (video == pipe->output && !pipe->do_propagation) in omap3isp_video_buffer_next()
555 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { in omap3isp_video_buffer_next()
564 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
566 if (list_empty(&video->dmaqueue)) { in omap3isp_video_buffer_next()
569 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
571 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_buffer_next()
580 if (video->pipe.stream_state == ISP_PIPELINE_STREAM_CONTINUOUS) in omap3isp_video_buffer_next()
581 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_buffer_next()
586 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) { in omap3isp_video_buffer_next()
592 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
595 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
601 * omap3isp_video_cancel_stream - Cancel stream on a video node
602 * @video: ISP video object
604 * Cancelling a stream returns all buffers queued on the video node to videobuf2
607 void omap3isp_video_cancel_stream(struct isp_video *video) in omap3isp_video_cancel_stream() argument
611 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_cancel_stream()
612 omap3isp_video_return_buffers(video, VB2_BUF_STATE_ERROR); in omap3isp_video_cancel_stream()
613 video->error = true; in omap3isp_video_cancel_stream()
614 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_cancel_stream()
619 * @video: ISP video object
623 * requests video queue layer to discard buffers marked as DONE if it's in
627 void omap3isp_video_resume(struct isp_video *video, int continuous) in omap3isp_video_resume() argument
631 if (continuous && video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in omap3isp_video_resume()
632 mutex_lock(&video->queue_lock); in omap3isp_video_resume()
633 vb2_discard_done(video->queue); in omap3isp_video_resume()
634 mutex_unlock(&video->queue_lock); in omap3isp_video_resume()
637 if (!list_empty(&video->dmaqueue)) { in omap3isp_video_resume()
638 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_resume()
640 video->ops->queue(video, buf); in omap3isp_video_resume()
641 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in omap3isp_video_resume()
644 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_resume()
655 struct isp_video *video = video_drvdata(file); in isp_video_querycap() local
658 strlcpy(cap->card, video->video.name, sizeof(cap->card)); in isp_video_querycap()
664 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_querycap()
676 struct isp_video *video = video_drvdata(file); in isp_video_get_format() local
678 if (format->type != video->type) in isp_video_get_format()
681 mutex_lock(&video->mutex); in isp_video_get_format()
683 mutex_unlock(&video->mutex); in isp_video_get_format()
692 struct isp_video *video = video_drvdata(file); in isp_video_set_format() local
695 if (format->type != video->type) in isp_video_set_format()
705 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_format()
709 /* The ISP has no concept of video standard, select the in isp_video_set_format()
718 if (video != &video->isp->isp_ccdc.video_out) in isp_video_set_format()
737 isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix); in isp_video_set_format()
739 mutex_lock(&video->mutex); in isp_video_set_format()
741 mutex_unlock(&video->mutex); in isp_video_set_format()
749 struct isp_video *video = video_drvdata(file); in isp_video_try_format() local
755 if (format->type != video->type) in isp_video_try_format()
758 subdev = isp_video_remote_subdev(video, &pad); in isp_video_try_format()
770 isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in isp_video_try_format()
777 struct isp_video *video = video_drvdata(file); in isp_video_get_selection() local
791 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_get_selection()
797 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_get_selection()
803 subdev = isp_video_remote_subdev(video, &pad); in isp_video_get_selection()
834 struct isp_video *video = video_drvdata(file); in isp_video_set_selection() local
847 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_selection()
851 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_set_selection()
857 subdev = isp_video_remote_subdev(video, &pad); in isp_video_set_selection()
862 mutex_lock(&video->mutex); in isp_video_set_selection()
864 mutex_unlock(&video->mutex); in isp_video_set_selection()
875 struct isp_video *video = video_drvdata(file); in isp_video_get_param() local
877 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_get_param()
878 video->type != a->type) in isp_video_get_param()
893 struct isp_video *video = video_drvdata(file); in isp_video_set_param() local
895 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_set_param()
896 video->type != a->type) in isp_video_set_param()
911 struct isp_video *video = video_drvdata(file); in isp_video_reqbufs() local
914 mutex_lock(&video->queue_lock); in isp_video_reqbufs()
916 mutex_unlock(&video->queue_lock); in isp_video_reqbufs()
925 struct isp_video *video = video_drvdata(file); in isp_video_querybuf() local
928 mutex_lock(&video->queue_lock); in isp_video_querybuf()
930 mutex_unlock(&video->queue_lock); in isp_video_querybuf()
939 struct isp_video *video = video_drvdata(file); in isp_video_qbuf() local
942 mutex_lock(&video->queue_lock); in isp_video_qbuf()
944 mutex_unlock(&video->queue_lock); in isp_video_qbuf()
953 struct isp_video *video = video_drvdata(file); in isp_video_dqbuf() local
956 mutex_lock(&video->queue_lock); in isp_video_dqbuf()
958 mutex_unlock(&video->queue_lock); in isp_video_dqbuf()
963 static int isp_video_check_external_subdevs(struct isp_video *video, in isp_video_check_external_subdevs() argument
966 struct isp_device *isp = video->isp; in isp_video_check_external_subdevs()
1059 * either a sensor or a video node. The output is always a video node.
1061 * As every pipeline has an output video node, the ISP video objects at the
1090 struct isp_video *video = video_drvdata(file); in isp_video_streamon() local
1096 if (type != video->type) in isp_video_streamon()
1099 mutex_lock(&video->stream_lock); in isp_video_streamon()
1104 pipe = video->video.entity.pipe in isp_video_streamon()
1105 ? to_isp_pipeline(&video->video.entity) : &video->pipe; in isp_video_streamon()
1107 ret = media_entity_enum_init(&pipe->ent_enum, &video->isp->media_dev); in isp_video_streamon()
1112 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); in isp_video_streamon()
1115 ret = media_pipeline_start(&video->video.entity, &pipe->pipe); in isp_video_streamon()
1122 ret = isp_video_check_format(video, vfh); in isp_video_streamon()
1126 video->bpl_padding = ret; in isp_video_streamon()
1127 video->bpl_value = vfh->format.fmt.pix.bytesperline; in isp_video_streamon()
1129 ret = isp_video_get_graph_data(video, pipe); in isp_video_streamon()
1133 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamon()
1138 ret = isp_video_check_external_subdevs(video, pipe); in isp_video_streamon()
1153 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_streamon()
1156 video->queue = &vfh->queue; in isp_video_streamon()
1157 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1161 mutex_lock(&video->queue_lock); in isp_video_streamon()
1163 mutex_unlock(&video->queue_lock); in isp_video_streamon()
1167 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1172 media_pipeline_stop(&video->video.entity); in isp_video_streamon()
1182 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1183 video->queue = NULL; in isp_video_streamon()
1188 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1197 struct isp_video *video = video_drvdata(file); in isp_video_streamoff() local
1198 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_streamoff()
1203 if (type != video->type) in isp_video_streamoff()
1206 mutex_lock(&video->stream_lock); in isp_video_streamoff()
1209 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1211 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1217 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamoff()
1230 omap3isp_video_cancel_stream(video); in isp_video_streamoff()
1232 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1234 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1235 video->queue = NULL; in isp_video_streamoff()
1236 video->error = false; in isp_video_streamoff()
1239 media_pipeline_stop(&video->video.entity); in isp_video_streamoff()
1244 mutex_unlock(&video->stream_lock); in isp_video_streamoff()
1303 struct isp_video *video = video_drvdata(file); in isp_video_open() local
1312 v4l2_fh_init(&handle->vfh, &video->video); in isp_video_open()
1316 if (omap3isp_get(video->isp) == NULL) { in isp_video_open()
1321 ret = v4l2_pipeline_pm_use(&video->video.entity, 1); in isp_video_open()
1323 omap3isp_put(video->isp); in isp_video_open()
1328 queue->type = video->type; in isp_video_open()
1335 queue->dev = video->isp->dev; in isp_video_open()
1339 omap3isp_put(video->isp); in isp_video_open()
1344 handle->format.type = video->type; in isp_video_open()
1347 handle->video = video; in isp_video_open()
1362 struct isp_video *video = video_drvdata(file); in isp_video_release() local
1367 isp_video_streamoff(file, vfh, video->type); in isp_video_release()
1369 mutex_lock(&video->queue_lock); in isp_video_release()
1371 mutex_unlock(&video->queue_lock); in isp_video_release()
1373 v4l2_pipeline_pm_use(&video->video.entity, 0); in isp_video_release()
1381 omap3isp_put(video->isp); in isp_video_release()
1389 struct isp_video *video = video_drvdata(file); in isp_video_poll() local
1392 mutex_lock(&video->queue_lock); in isp_video_poll()
1394 mutex_unlock(&video->queue_lock); in isp_video_poll()
1416 * ISP video core
1422 int omap3isp_video_init(struct isp_video *video, const char *name) in omap3isp_video_init() argument
1427 switch (video->type) { in omap3isp_video_init()
1430 video->pad.flags = MEDIA_PAD_FL_SINK in omap3isp_video_init()
1435 video->pad.flags = MEDIA_PAD_FL_SOURCE in omap3isp_video_init()
1437 video->video.vfl_dir = VFL_DIR_TX; in omap3isp_video_init()
1444 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad); in omap3isp_video_init()
1448 mutex_init(&video->mutex); in omap3isp_video_init()
1449 atomic_set(&video->active, 0); in omap3isp_video_init()
1451 spin_lock_init(&video->pipe.lock); in omap3isp_video_init()
1452 mutex_init(&video->stream_lock); in omap3isp_video_init()
1453 mutex_init(&video->queue_lock); in omap3isp_video_init()
1454 spin_lock_init(&video->irqlock); in omap3isp_video_init()
1456 /* Initialize the video device. */ in omap3isp_video_init()
1457 if (video->ops == NULL) in omap3isp_video_init()
1458 video->ops = &isp_video_dummy_ops; in omap3isp_video_init()
1460 video->video.fops = &isp_video_fops; in omap3isp_video_init()
1461 snprintf(video->video.name, sizeof(video->video.name), in omap3isp_video_init()
1463 video->video.vfl_type = VFL_TYPE_GRABBER; in omap3isp_video_init()
1464 video->video.release = video_device_release_empty; in omap3isp_video_init()
1465 video->video.ioctl_ops = &isp_video_ioctl_ops; in omap3isp_video_init()
1466 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED; in omap3isp_video_init()
1468 video_set_drvdata(&video->video, video); in omap3isp_video_init()
1473 void omap3isp_video_cleanup(struct isp_video *video) in omap3isp_video_cleanup() argument
1475 media_entity_cleanup(&video->video.entity); in omap3isp_video_cleanup()
1476 mutex_destroy(&video->queue_lock); in omap3isp_video_cleanup()
1477 mutex_destroy(&video->stream_lock); in omap3isp_video_cleanup()
1478 mutex_destroy(&video->mutex); in omap3isp_video_cleanup()
1481 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) in omap3isp_video_register() argument
1485 video->video.v4l2_dev = vdev; in omap3isp_video_register()
1487 ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1); in omap3isp_video_register()
1489 dev_err(video->isp->dev, in omap3isp_video_register()
1490 "%s: could not register video device (%d)\n", in omap3isp_video_register()
1496 void omap3isp_video_unregister(struct isp_video *video) in omap3isp_video_unregister() argument
1498 if (video_is_registered(&video->video)) in omap3isp_video_unregister()
1499 video_unregister_device(&video->video); in omap3isp_video_unregister()