Lines Matching refs: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,
165 if (video->bpl_max)
166 bpl = clamp(bpl, min_bpl, video->bpl_max);
170 if (!video->bpl_zero_padding || bpl != min_bpl)
171 bpl = ALIGN(bpl, video->bpl_alignment);
205 isp_video_remote_subdev(struct isp_video *video, u32 *pad)
209 remote = media_entity_remote_pad(&video->pad);
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,
225 struct media_entity *entity = &video->video.entity;
247 if (entity == &video->video.entity)
254 if (__video->type != video->type)
262 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
264 pipe->output = video;
269 pipe->input = video;
277 __isp_video_get_format(struct isp_video *video, struct v4l2_format *format)
284 subdev = isp_video_remote_subdev(video, &pad);
291 mutex_lock(&video->mutex);
293 mutex_unlock(&video->mutex);
298 format->type = video->type;
299 return isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
303 isp_video_check_format(struct isp_video *video, struct isp_video_fh *vfh)
309 ret = __isp_video_get_format(video, &format);
333 struct isp_video *video = vfh->video;
341 *count = min(*count, video->capture_mem / PAGE_ALIGN(sizes[0]));
351 struct isp_video *video = vfh->video;
354 /* Refuse to prepare the buffer is the video node has registered an
360 if (unlikely(video->error))
365 dev_dbg(video->isp->dev,
391 struct isp_video *video = vfh->video;
392 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
398 spin_lock_irqsave(&video->irqlock, flags);
400 if (unlikely(video->error)) {
402 spin_unlock_irqrestore(&video->irqlock, flags);
406 empty = list_empty(&video->dmaqueue);
407 list_add_tail(&buffer->irqlist, &video->dmaqueue);
409 spin_unlock_irqrestore(&video->irqlock, flags);
412 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
419 video->ops->queue(video, buffer);
420 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED;
435 * @video: ISP video object
438 * Return all buffers queued on the video node to videobuf2 in the given state.
442 * The function must be called with the video irqlock held.
444 static void omap3isp_video_return_buffers(struct isp_video *video,
447 while (!list_empty(&video->dmaqueue)) {
450 buf = list_first_entry(&video->dmaqueue,
461 struct isp_video *video = vfh->video;
462 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
476 spin_lock_irqsave(&video->irqlock, flags);
477 omap3isp_video_return_buffers(video, VB2_BUF_STATE_QUEUED);
478 spin_unlock_irqrestore(&video->irqlock, flags);
482 spin_lock_irqsave(&video->irqlock, flags);
483 if (list_empty(&video->dmaqueue))
484 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN;
485 spin_unlock_irqrestore(&video->irqlock, flags);
499 * @video: ISP video object
501 * Remove the current video buffer from the DMA queue and fill its timestamp and
504 * For capture video nodes the buffer state is set to VB2_BUF_STATE_DONE if no
506 * For video output nodes the buffer state is always set to VB2_BUF_STATE_DONE.
513 struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video)
515 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
520 spin_lock_irqsave(&video->irqlock, flags);
521 if (WARN_ON(list_empty(&video->dmaqueue))) {
522 spin_unlock_irqrestore(&video->irqlock, flags);
526 buf = list_first_entry(&video->dmaqueue, struct isp_buffer,
529 spin_unlock_irqrestore(&video->irqlock, flags);
533 /* Do frame number propagation only if this is the output video node.
539 if (video == pipe->output && !pipe->do_propagation)
551 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) {
560 spin_lock_irqsave(&video->irqlock, flags);
562 if (list_empty(&video->dmaqueue)) {
565 spin_unlock_irqrestore(&video->irqlock, flags);
567 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
576 if (video->pipe.stream_state == ISP_PIPELINE_STREAM_CONTINUOUS)
577 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN;
582 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->input != NULL) {
588 buf = list_first_entry(&video->dmaqueue, struct isp_buffer,
591 spin_unlock_irqrestore(&video->irqlock, flags);
597 * omap3isp_video_cancel_stream - Cancel stream on a video node
598 * @video: ISP video object
600 * Cancelling a stream returns all buffers queued on the video node to videobuf2
603 void omap3isp_video_cancel_stream(struct isp_video *video)
607 spin_lock_irqsave(&video->irqlock, flags);
608 omap3isp_video_return_buffers(video, VB2_BUF_STATE_ERROR);
609 video->error = true;
610 spin_unlock_irqrestore(&video->irqlock, flags);
615 * @video: ISP video object
619 * requests video queue layer to discard buffers marked as DONE if it's in
623 void omap3isp_video_resume(struct isp_video *video, int continuous)
627 if (continuous && video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
628 mutex_lock(&video->queue_lock);
629 vb2_discard_done(video->queue);
630 mutex_unlock(&video->queue_lock);
633 if (!list_empty(&video->dmaqueue)) {
634 buf = list_first_entry(&video->dmaqueue,
636 video->ops->queue(video, buf);
637 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_QUEUED;
640 video->dmaqueue_flags |= ISP_VIDEO_DMAQUEUE_UNDERRUN;
651 struct isp_video *video = video_drvdata(file);
654 strscpy(cap->card, video->video.name, sizeof(cap->card));
668 struct isp_video *video = video_drvdata(file);
670 if (format->type != video->type)
673 mutex_lock(&video->mutex);
675 mutex_unlock(&video->mutex);
684 struct isp_video *video = video_drvdata(file);
687 if (format->type != video->type)
697 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
701 /* The ISP has no concept of video standard, select the
710 if (video != &video->isp->isp_ccdc.video_out)
729 isp_video_mbus_to_pix(video, &fmt, &format->fmt.pix);
731 mutex_lock(&video->mutex);
733 mutex_unlock(&video->mutex);
741 struct isp_video *video = video_drvdata(file);
747 if (format->type != video->type)
750 subdev = isp_video_remote_subdev(video, &pad);
762 isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
769 struct isp_video *video = video_drvdata(file);
783 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
789 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
795 subdev = isp_video_remote_subdev(video, &pad);
826 struct isp_video *video = video_drvdata(file);
839 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
843 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
849 subdev = isp_video_remote_subdev(video, &pad);
854 mutex_lock(&video->mutex);
856 mutex_unlock(&video->mutex);
867 struct isp_video *video = video_drvdata(file);
869 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
870 video->type != a->type)
885 struct isp_video *video = video_drvdata(file);
887 if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
888 video->type != a->type)
903 struct isp_video *video = video_drvdata(file);
906 mutex_lock(&video->queue_lock);
908 mutex_unlock(&video->queue_lock);
917 struct isp_video *video = video_drvdata(file);
920 mutex_lock(&video->queue_lock);
922 mutex_unlock(&video->queue_lock);
931 struct isp_video *video = video_drvdata(file);
934 mutex_lock(&video->queue_lock);
935 ret = vb2_qbuf(&vfh->queue, video->video.v4l2_dev->mdev, b);
936 mutex_unlock(&video->queue_lock);
945 struct isp_video *video = video_drvdata(file);
948 mutex_lock(&video->queue_lock);
950 mutex_unlock(&video->queue_lock);
955 static int isp_video_check_external_subdevs(struct isp_video *video,
958 struct isp_device *isp = video->isp;
1022 ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &video->video,
1051 * either a sensor or a video node. The output is always a video node.
1053 * As every pipeline has an output video node, the ISP video objects at the
1082 struct isp_video *video = video_drvdata(file);
1088 if (type != video->type)
1091 mutex_lock(&video->stream_lock);
1096 pipe = video->video.entity.pipe
1097 ? to_isp_pipeline(&video->video.entity) : &video->pipe;
1099 ret = media_entity_enum_init(&pipe->ent_enum, &video->isp->media_dev);
1104 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]);
1107 ret = media_pipeline_start(&video->video.entity, &pipe->pipe);
1114 ret = isp_video_check_format(video, vfh);
1118 video->bpl_padding = ret;
1119 video->bpl_value = vfh->format.fmt.pix.bytesperline;
1121 ret = isp_video_get_graph_data(video, pipe);
1125 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
1130 ret = isp_video_check_external_subdevs(video, pipe);
1145 if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
1148 video->queue = &vfh->queue;
1149 INIT_LIST_HEAD(&video->dmaqueue);
1153 mutex_lock(&video->queue_lock);
1155 mutex_unlock(&video->queue_lock);
1159 mutex_unlock(&video->stream_lock);
1164 media_pipeline_stop(&video->video.entity);
1174 INIT_LIST_HEAD(&video->dmaqueue);
1175 video->queue = NULL;
1180 mutex_unlock(&video->stream_lock);
1189 struct isp_video *video = video_drvdata(file);
1190 struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
1195 if (type != video->type)
1198 mutex_lock(&video->stream_lock);
1201 mutex_lock(&video->queue_lock);
1203 mutex_unlock(&video->queue_lock);
1209 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
1222 omap3isp_video_cancel_stream(video);
1224 mutex_lock(&video->queue_lock);
1226 mutex_unlock(&video->queue_lock);
1227 video->queue = NULL;
1228 video->error = false;
1231 media_pipeline_stop(&video->video.entity);
1236 mutex_unlock(&video->stream_lock);
1295 struct isp_video *video = video_drvdata(file);
1304 v4l2_fh_init(&handle->vfh, &video->video);
1308 if (omap3isp_get(video->isp) == NULL) {
1313 ret = v4l2_pipeline_pm_get(&video->video.entity);
1315 omap3isp_put(video->isp);
1320 queue->type = video->type;
1327 queue->dev = video->isp->dev;
1331 omap3isp_put(video->isp);
1336 handle->format.type = video->type;
1339 handle->video = video;
1354 struct isp_video *video = video_drvdata(file);
1359 isp_video_streamoff(file, vfh, video->type);
1361 mutex_lock(&video->queue_lock);
1363 mutex_unlock(&video->queue_lock);
1365 v4l2_pipeline_pm_put(&video->video.entity);
1373 omap3isp_put(video->isp);
1381 struct isp_video *video = video_drvdata(file);
1384 mutex_lock(&video->queue_lock);
1386 mutex_unlock(&video->queue_lock);
1408 * ISP video core
1414 int omap3isp_video_init(struct isp_video *video, const char *name)
1419 switch (video->type) {
1422 video->pad.flags = MEDIA_PAD_FL_SINK
1427 video->pad.flags = MEDIA_PAD_FL_SOURCE
1429 video->video.vfl_dir = VFL_DIR_TX;
1436 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad);
1440 mutex_init(&video->mutex);
1441 atomic_set(&video->active, 0);
1443 spin_lock_init(&video->pipe.lock);
1444 mutex_init(&video->stream_lock);
1445 mutex_init(&video->queue_lock);
1446 spin_lock_init(&video->irqlock);
1448 /* Initialize the video device. */
1449 if (video->ops == NULL)
1450 video->ops = &isp_video_dummy_ops;
1452 video->video.fops = &isp_video_fops;
1453 snprintf(video->video.name, sizeof(video->video.name),
1455 video->video.vfl_type = VFL_TYPE_VIDEO;
1456 video->video.release = video_device_release_empty;
1457 video->video.ioctl_ops = &isp_video_ioctl_ops;
1458 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
1459 video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE
1462 video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT
1465 video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED;
1467 video_set_drvdata(&video->video, video);
1472 void omap3isp_video_cleanup(struct isp_video *video)
1474 media_entity_cleanup(&video->video.entity);
1475 mutex_destroy(&video->queue_lock);
1476 mutex_destroy(&video->stream_lock);
1477 mutex_destroy(&video->mutex);
1480 int omap3isp_video_register(struct isp_video *video, struct v4l2_device *vdev)
1484 video->video.v4l2_dev = vdev;
1486 ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1);
1488 dev_err(video->isp->dev,
1489 "%s: could not register video device (%d)\n",
1495 void omap3isp_video_unregister(struct isp_video *video)
1497 video_unregister_device(&video->video);