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()
486 struct isp_video *video = vfh->video; in omap3isp_wait_prepare() local
488 mutex_unlock(&video->queue_lock); in omap3isp_wait_prepare()
494 struct isp_video *video = vfh->video; in omap3isp_wait_finish() local
496 mutex_lock(&video->queue_lock); in omap3isp_wait_finish()
510 * @video: ISP video object
512 * Remove the current video buffer from the DMA queue and fill its timestamp and
515 * For capture video nodes the buffer state is set to VB2_BUF_STATE_DONE if no
517 * For video output nodes the buffer state is always set to VB2_BUF_STATE_DONE.
524 struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video) in omap3isp_video_buffer_next() argument
526 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in omap3isp_video_buffer_next()
531 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
532 if (WARN_ON(list_empty(&video->dmaqueue))) { in omap3isp_video_buffer_next()
533 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
537 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
540 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
544 /* Do frame number propagation only if this is the output video node. in omap3isp_video_buffer_next()
550 if (video == pipe->output && !pipe->do_propagation) in omap3isp_video_buffer_next()
562 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) { in omap3isp_video_buffer_next()
571 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_buffer_next()
573 if (list_empty(&video->dmaqueue)) { in omap3isp_video_buffer_next()
576 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
578 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_buffer_next()
587 if (video->pipe.stream_state == ISP_PIPELINE_STREAM_CONTINUOUS) in omap3isp_video_buffer_next()
588 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_buffer_next()
593 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) { in omap3isp_video_buffer_next()
599 buf = list_first_entry(&video->dmaqueue, struct isp_buffer, in omap3isp_video_buffer_next()
602 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_buffer_next()
608 * omap3isp_video_cancel_stream - Cancel stream on a video node
609 * @video: ISP video object
611 * Cancelling a stream returns all buffers queued on the video node to videobuf2
614 void omap3isp_video_cancel_stream(struct isp_video *video) in omap3isp_video_cancel_stream() argument
618 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_video_cancel_stream()
619 omap3isp_video_return_buffers(video, VB2_BUF_STATE_ERROR); in omap3isp_video_cancel_stream()
620 video->error = true; in omap3isp_video_cancel_stream()
621 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_video_cancel_stream()
626 * @video: ISP video object
630 * requests video queue layer to discard buffers marked as DONE if it's in
634 void omap3isp_video_resume(struct isp_video *video, int continuous) in omap3isp_video_resume() argument
638 if (continuous && video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { in omap3isp_video_resume()
639 mutex_lock(&video->queue_lock); in omap3isp_video_resume()
640 vb2_discard_done(video->queue); in omap3isp_video_resume()
641 mutex_unlock(&video->queue_lock); in omap3isp_video_resume()
644 if (!list_empty(&video->dmaqueue)) { in omap3isp_video_resume()
645 buf = list_first_entry(&video->dmaqueue, in omap3isp_video_resume()
647 video->ops->queue(video, buf); in omap3isp_video_resume()
648 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED; in omap3isp_video_resume()
651 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN; in omap3isp_video_resume()
662 struct isp_video *video = video_drvdata(file); in isp_video_querycap() local
665 strscpy(cap->card, video->video.name, sizeof(cap->card)); in isp_video_querycap()
679 struct isp_video *video = video_drvdata(file); in isp_video_get_format() local
681 if (format->type != video->type) in isp_video_get_format()
684 mutex_lock(&video->mutex); in isp_video_get_format()
686 mutex_unlock(&video->mutex); in isp_video_get_format()
695 struct isp_video *video = video_drvdata(file); in isp_video_set_format() local
698 if (format->type != video->type) in isp_video_set_format()
708 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_format()
712 /* The ISP has no concept of video standard, select the in isp_video_set_format()
721 if (video != &video->isp->isp_ccdc.video_out) in isp_video_set_format()
740 isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix); in isp_video_set_format()
742 mutex_lock(&video->mutex); in isp_video_set_format()
744 mutex_unlock(&video->mutex); in isp_video_set_format()
752 struct isp_video *video = video_drvdata(file); in isp_video_try_format() local
760 if (format->type != video->type) in isp_video_try_format()
763 subdev = isp_video_remote_subdev(video, &pad); in isp_video_try_format()
774 isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix); in isp_video_try_format()
781 struct isp_video *video = video_drvdata(file); in isp_video_get_selection() local
797 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_get_selection()
803 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_get_selection()
809 subdev = isp_video_remote_subdev(video, &pad); in isp_video_get_selection()
839 struct isp_video *video = video_drvdata(file); in isp_video_set_selection() local
852 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_set_selection()
856 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_set_selection()
862 subdev = isp_video_remote_subdev(video, &pad); in isp_video_set_selection()
867 mutex_lock(&video->mutex); in isp_video_set_selection()
869 mutex_unlock(&video->mutex); in isp_video_set_selection()
880 struct isp_video *video = video_drvdata(file); in isp_video_get_param() local
882 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_get_param()
883 video->type != a->type) in isp_video_get_param()
898 struct isp_video *video = video_drvdata(file); in isp_video_set_param() local
900 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT || in isp_video_set_param()
901 video->type != a->type) in isp_video_set_param()
916 struct isp_video *video = video_drvdata(file); in isp_video_reqbufs() local
919 mutex_lock(&video->queue_lock); in isp_video_reqbufs()
921 mutex_unlock(&video->queue_lock); in isp_video_reqbufs()
930 struct isp_video *video = video_drvdata(file); in isp_video_querybuf() local
933 mutex_lock(&video->queue_lock); in isp_video_querybuf()
935 mutex_unlock(&video->queue_lock); in isp_video_querybuf()
944 struct isp_video *video = video_drvdata(file); in isp_video_qbuf() local
947 mutex_lock(&video->queue_lock); in isp_video_qbuf()
948 ret = vb2_qbuf(&vfh->queue, video->video.v4l2_dev->mdev, b); in isp_video_qbuf()
949 mutex_unlock(&video->queue_lock); in isp_video_qbuf()
958 struct isp_video *video = video_drvdata(file); in isp_video_dqbuf() local
961 mutex_lock(&video->queue_lock); in isp_video_dqbuf()
963 mutex_unlock(&video->queue_lock); in isp_video_dqbuf()
968 static int isp_video_check_external_subdevs(struct isp_video *video, in isp_video_check_external_subdevs() argument
971 struct isp_device *isp = video->isp; in isp_video_check_external_subdevs()
1036 ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &video->video, in isp_video_check_external_subdevs()
1065 * either a sensor or a video node. The output is always a video node.
1067 * As every pipeline has an output video node, the ISP video objects at the
1096 struct isp_video *video = video_drvdata(file); in isp_video_streamon() local
1102 if (type != video->type) in isp_video_streamon()
1105 mutex_lock(&video->stream_lock); in isp_video_streamon()
1110 pipe = to_isp_pipeline(&video->video.entity) ? : &video->pipe; in isp_video_streamon()
1112 ret = media_entity_enum_init(&pipe->ent_enum, &video->isp->media_dev); in isp_video_streamon()
1117 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); in isp_video_streamon()
1120 ret = video_device_pipeline_start(&video->video, &pipe->pipe); in isp_video_streamon()
1127 ret = isp_video_check_format(video, vfh); in isp_video_streamon()
1131 video->bpl_padding = ret; in isp_video_streamon()
1132 video->bpl_value = vfh->format.fmt.pix.bytesperline; in isp_video_streamon()
1134 ret = isp_video_get_graph_data(video, pipe); in isp_video_streamon()
1138 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamon()
1143 ret = isp_video_check_external_subdevs(video, pipe); in isp_video_streamon()
1158 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) in isp_video_streamon()
1161 video->queue = &vfh->queue; in isp_video_streamon()
1162 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1166 mutex_lock(&video->queue_lock); in isp_video_streamon()
1168 mutex_unlock(&video->queue_lock); in isp_video_streamon()
1172 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1177 video_device_pipeline_stop(&video->video); in isp_video_streamon()
1187 INIT_LIST_HEAD(&video->dmaqueue); in isp_video_streamon()
1188 video->queue = NULL; in isp_video_streamon()
1193 mutex_unlock(&video->stream_lock); in isp_video_streamon()
1202 struct isp_video *video = video_drvdata(file); in isp_video_streamoff() local
1203 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity); in isp_video_streamoff()
1208 if (type != video->type) in isp_video_streamoff()
1211 mutex_lock(&video->stream_lock); in isp_video_streamoff()
1214 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1216 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1222 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in isp_video_streamoff()
1235 omap3isp_video_cancel_stream(video); in isp_video_streamoff()
1237 mutex_lock(&video->queue_lock); in isp_video_streamoff()
1239 mutex_unlock(&video->queue_lock); in isp_video_streamoff()
1240 video->queue = NULL; in isp_video_streamoff()
1241 video->error = false; in isp_video_streamoff()
1244 video_device_pipeline_stop(&video->video); in isp_video_streamoff()
1249 mutex_unlock(&video->stream_lock); in isp_video_streamoff()
1308 struct isp_video *video = video_drvdata(file); in isp_video_open() local
1317 v4l2_fh_init(&handle->vfh, &video->video); in isp_video_open()
1321 if (omap3isp_get(video->isp) == NULL) { in isp_video_open()
1326 ret = v4l2_pipeline_pm_get(&video->video.entity); in isp_video_open()
1328 omap3isp_put(video->isp); in isp_video_open()
1333 queue->type = video->type; in isp_video_open()
1340 queue->dev = video->isp->dev; in isp_video_open()
1344 omap3isp_put(video->isp); in isp_video_open()
1349 handle->format.type = video->type; in isp_video_open()
1352 handle->video = video; in isp_video_open()
1367 struct isp_video *video = video_drvdata(file); in isp_video_release() local
1372 isp_video_streamoff(file, vfh, video->type); in isp_video_release()
1374 mutex_lock(&video->queue_lock); in isp_video_release()
1376 mutex_unlock(&video->queue_lock); in isp_video_release()
1378 v4l2_pipeline_pm_put(&video->video.entity); in isp_video_release()
1386 omap3isp_put(video->isp); in isp_video_release()
1394 struct isp_video *video = video_drvdata(file); in isp_video_poll() local
1397 mutex_lock(&video->queue_lock); in isp_video_poll()
1399 mutex_unlock(&video->queue_lock); in isp_video_poll()
1421 * ISP video core
1427 int omap3isp_video_init(struct isp_video *video, const char *name) in omap3isp_video_init() argument
1432 switch (video->type) { in omap3isp_video_init()
1435 video->pad.flags = MEDIA_PAD_FL_SINK in omap3isp_video_init()
1440 video->pad.flags = MEDIA_PAD_FL_SOURCE in omap3isp_video_init()
1442 video->video.vfl_dir = VFL_DIR_TX; in omap3isp_video_init()
1449 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad); in omap3isp_video_init()
1453 mutex_init(&video->mutex); in omap3isp_video_init()
1454 atomic_set(&video->active, 0); in omap3isp_video_init()
1456 spin_lock_init(&video->pipe.lock); in omap3isp_video_init()
1457 mutex_init(&video->stream_lock); in omap3isp_video_init()
1458 mutex_init(&video->queue_lock); in omap3isp_video_init()
1459 spin_lock_init(&video->irqlock); in omap3isp_video_init()
1461 /* Initialize the video device. */ in omap3isp_video_init()
1462 if (video->ops == NULL) in omap3isp_video_init()
1463 video->ops = &isp_video_dummy_ops; in omap3isp_video_init()
1465 video->video.fops = &isp_video_fops; in omap3isp_video_init()
1466 snprintf(video->video.name, sizeof(video->video.name), in omap3isp_video_init()
1468 video->video.vfl_type = VFL_TYPE_VIDEO; in omap3isp_video_init()
1469 video->video.release = video_device_release_empty; in omap3isp_video_init()
1470 video->video.ioctl_ops = &isp_video_ioctl_ops; in omap3isp_video_init()
1471 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in omap3isp_video_init()
1472 video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE in omap3isp_video_init()
1475 video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT in omap3isp_video_init()
1478 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED; in omap3isp_video_init()
1480 video_set_drvdata(&video->video, video); in omap3isp_video_init()
1485 void omap3isp_video_cleanup(struct isp_video *video) in omap3isp_video_cleanup() argument
1487 media_entity_cleanup(&video->video.entity); in omap3isp_video_cleanup()
1488 mutex_destroy(&video->queue_lock); in omap3isp_video_cleanup()
1489 mutex_destroy(&video->stream_lock); in omap3isp_video_cleanup()
1490 mutex_destroy(&video->mutex); in omap3isp_video_cleanup()
1493 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev) in omap3isp_video_register() argument
1497 video->video.v4l2_dev = vdev; in omap3isp_video_register()
1499 ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1); in omap3isp_video_register()
1501 dev_err(video->isp->dev, in omap3isp_video_register()
1502 "%s: could not register video device (%d)\n", in omap3isp_video_register()
1508 void omap3isp_video_unregister(struct isp_video *video) in omap3isp_video_unregister() argument
1510 video_unregister_device(&video->video); in omap3isp_video_unregister()