Lines Matching refs:video
63 static int vsp1_video_verify_format(struct vsp1_video *video) in vsp1_video_verify_format() argument
71 subdev = vsp1_video_remote_subdev(&video->pad, &fmt.pad); in vsp1_video_verify_format()
79 if (video->rwpf->fmtinfo->mbus != fmt.format.code || in vsp1_video_verify_format()
80 video->rwpf->format.height != fmt.format.height || in vsp1_video_verify_format()
81 video->rwpf->format.width != fmt.format.width) in vsp1_video_verify_format()
87 static int __vsp1_video_try_format(struct vsp1_video *video, in __vsp1_video_try_format() argument
119 info = vsp1_get_format_info(video->vsp1, pix->pixelformat); in __vsp1_video_try_format()
121 info = vsp1_get_format_info(video->vsp1, VSP1_VIDEO_DEF_FORMAT); in __vsp1_video_try_format()
314 vsp1_video_complete_buffer(struct vsp1_video *video) in vsp1_video_complete_buffer() argument
316 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_complete_buffer()
322 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_complete_buffer()
324 if (list_empty(&video->irqqueue)) { in vsp1_video_complete_buffer()
325 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_complete_buffer()
329 done = list_first_entry(&video->irqqueue, in vsp1_video_complete_buffer()
334 if (!list_empty(&video->irqqueue)) in vsp1_video_complete_buffer()
335 next = list_first_entry(&video->irqqueue, in vsp1_video_complete_buffer()
338 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_complete_buffer()
353 struct vsp1_video *video = rwpf->video; in vsp1_video_frame_end() local
356 buf = vsp1_video_complete_buffer(video); in vsp1_video_frame_end()
360 video->rwpf->mem = buf->mem; in vsp1_video_frame_end()
361 pipe->buffers_ready |= 1 << video->pipe_index; in vsp1_video_frame_end()
560 struct vsp1_video *video) in vsp1_video_pipeline_build() argument
563 struct media_entity *entity = &video->video.entity; in vsp1_video_pipeline_build()
592 rwpf->video->pipe_index = ++pipe->num_inputs; in vsp1_video_pipeline_build()
598 rwpf->video->pipe_index = 0; in vsp1_video_pipeline_build()
633 for (i = 0; i < video->vsp1->info->rpf_count; ++i) { in vsp1_video_pipeline_build()
647 struct vsp1_video *video) in vsp1_video_pipeline_init() argument
653 return vsp1_video_pipeline_build(pipe, video); in vsp1_video_pipeline_init()
656 static struct vsp1_pipeline *vsp1_video_pipeline_get(struct vsp1_video *video) in vsp1_video_pipeline_get() argument
667 if (!video->rwpf->entity.pipe) { in vsp1_video_pipeline_get()
672 ret = vsp1_video_pipeline_init(pipe, video); in vsp1_video_pipeline_get()
679 pipe = video->rwpf->entity.pipe; in vsp1_video_pipeline_get()
712 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_queue_setup() local
713 const struct v4l2_pix_format_mplane *format = &video->rwpf->format; in vsp1_video_queue_setup()
737 struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue); in vsp1_video_buffer_prepare() local
739 const struct v4l2_pix_format_mplane *format = &video->rwpf->format; in vsp1_video_buffer_prepare()
761 struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue); in vsp1_video_buffer_queue() local
762 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_buffer_queue()
767 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_buffer_queue()
768 empty = list_empty(&video->irqqueue); in vsp1_video_buffer_queue()
769 list_add_tail(&buf->queue, &video->irqqueue); in vsp1_video_buffer_queue()
770 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_buffer_queue()
777 video->rwpf->mem = buf->mem; in vsp1_video_buffer_queue()
778 pipe->buffers_ready |= 1 << video->pipe_index; in vsp1_video_buffer_queue()
780 if (vb2_start_streaming_called(&video->queue) && in vsp1_video_buffer_queue()
836 static void vsp1_video_release_buffers(struct vsp1_video *video) in vsp1_video_release_buffers() argument
842 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_release_buffers()
843 list_for_each_entry(buffer, &video->irqqueue, queue) in vsp1_video_release_buffers()
845 INIT_LIST_HEAD(&video->irqqueue); in vsp1_video_release_buffers()
846 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_release_buffers()
865 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_start_streaming() local
866 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_start_streaming()
875 vsp1_video_release_buffers(video); in vsp1_video_start_streaming()
907 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_stop_streaming() local
908 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_stop_streaming()
916 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_stop_streaming()
917 pipe->buffers_ready &= ~(1 << video->pipe_index); in vsp1_video_stop_streaming()
918 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_stop_streaming()
925 dev_err(video->vsp1->dev, "pipeline stop timeout\n"); in vsp1_video_stop_streaming()
931 video_device_pipeline_stop(&video->video); in vsp1_video_stop_streaming()
932 vsp1_video_release_buffers(video); in vsp1_video_stop_streaming()
954 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_querycap() local
962 strscpy(cap->card, video->video.name, sizeof(cap->card)); in vsp1_video_querycap()
971 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_get_format() local
973 if (format->type != video->queue.type) in vsp1_video_get_format()
976 mutex_lock(&video->lock); in vsp1_video_get_format()
977 format->fmt.pix_mp = video->rwpf->format; in vsp1_video_get_format()
978 mutex_unlock(&video->lock); in vsp1_video_get_format()
987 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_try_format() local
989 if (format->type != video->queue.type) in vsp1_video_try_format()
992 return __vsp1_video_try_format(video, &format->fmt.pix_mp, NULL); in vsp1_video_try_format()
999 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_set_format() local
1003 if (format->type != video->queue.type) in vsp1_video_set_format()
1006 ret = __vsp1_video_try_format(video, &format->fmt.pix_mp, &info); in vsp1_video_set_format()
1010 mutex_lock(&video->lock); in vsp1_video_set_format()
1012 if (vb2_is_busy(&video->queue)) { in vsp1_video_set_format()
1017 video->rwpf->format = format->fmt.pix_mp; in vsp1_video_set_format()
1018 video->rwpf->fmtinfo = info; in vsp1_video_set_format()
1021 mutex_unlock(&video->lock); in vsp1_video_set_format()
1029 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_streamon() local
1030 struct media_device *mdev = &video->vsp1->media_dev; in vsp1_video_streamon()
1034 if (vb2_queue_is_busy(&video->queue, file)) in vsp1_video_streamon()
1044 pipe = vsp1_video_pipeline_get(video); in vsp1_video_streamon()
1050 ret = __video_device_pipeline_start(&video->video, &pipe->pipe); in vsp1_video_streamon()
1062 ret = vsp1_video_verify_format(video); in vsp1_video_streamon()
1067 ret = vb2_streamon(&video->queue, type); in vsp1_video_streamon()
1074 video_device_pipeline_stop(&video->video); in vsp1_video_streamon()
1105 struct vsp1_video *video = video_drvdata(file); in vsp1_video_open() local
1113 v4l2_fh_init(vfh, &video->video); in vsp1_video_open()
1118 ret = vsp1_device_get(video->vsp1); in vsp1_video_open()
1130 struct vsp1_video *video = video_drvdata(file); in vsp1_video_release() local
1134 vsp1_device_put(video->vsp1); in vsp1_video_release()
1236 struct vsp1_video *video; in vsp1_video_create() local
1240 video = devm_kzalloc(vsp1->dev, sizeof(*video), GFP_KERNEL); in vsp1_video_create()
1241 if (!video) in vsp1_video_create()
1244 rwpf->video = video; in vsp1_video_create()
1246 video->vsp1 = vsp1; in vsp1_video_create()
1247 video->rwpf = rwpf; in vsp1_video_create()
1251 video->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; in vsp1_video_create()
1252 video->pad.flags = MEDIA_PAD_FL_SOURCE; in vsp1_video_create()
1253 video->video.vfl_dir = VFL_DIR_TX; in vsp1_video_create()
1254 video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT_MPLANE | in vsp1_video_create()
1258 video->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; in vsp1_video_create()
1259 video->pad.flags = MEDIA_PAD_FL_SINK; in vsp1_video_create()
1260 video->video.vfl_dir = VFL_DIR_RX; in vsp1_video_create()
1261 video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | in vsp1_video_create()
1265 mutex_init(&video->lock); in vsp1_video_create()
1266 spin_lock_init(&video->irqlock); in vsp1_video_create()
1267 INIT_LIST_HEAD(&video->irqqueue); in vsp1_video_create()
1270 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad); in vsp1_video_create()
1278 __vsp1_video_try_format(video, &rwpf->format, &rwpf->fmtinfo); in vsp1_video_create()
1281 video->video.v4l2_dev = &video->vsp1->v4l2_dev; in vsp1_video_create()
1282 video->video.fops = &vsp1_video_fops; in vsp1_video_create()
1283 snprintf(video->video.name, sizeof(video->video.name), "%s %s", in vsp1_video_create()
1285 video->video.vfl_type = VFL_TYPE_VIDEO; in vsp1_video_create()
1286 video->video.release = video_device_release_empty; in vsp1_video_create()
1287 video->video.ioctl_ops = &vsp1_video_ioctl_ops; in vsp1_video_create()
1289 video_set_drvdata(&video->video, video); in vsp1_video_create()
1291 video->queue.type = video->type; in vsp1_video_create()
1292 video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; in vsp1_video_create()
1293 video->queue.lock = &video->lock; in vsp1_video_create()
1294 video->queue.drv_priv = video; in vsp1_video_create()
1295 video->queue.buf_struct_size = sizeof(struct vsp1_vb2_buffer); in vsp1_video_create()
1296 video->queue.ops = &vsp1_video_queue_qops; in vsp1_video_create()
1297 video->queue.mem_ops = &vb2_dma_contig_memops; in vsp1_video_create()
1298 video->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; in vsp1_video_create()
1299 video->queue.dev = video->vsp1->bus_master; in vsp1_video_create()
1300 ret = vb2_queue_init(&video->queue); in vsp1_video_create()
1302 dev_err(video->vsp1->dev, "failed to initialize vb2 queue\n"); in vsp1_video_create()
1307 video->video.queue = &video->queue; in vsp1_video_create()
1308 ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1); in vsp1_video_create()
1310 dev_err(video->vsp1->dev, "failed to register video device\n"); in vsp1_video_create()
1314 return video; in vsp1_video_create()
1317 vsp1_video_cleanup(video); in vsp1_video_create()
1321 void vsp1_video_cleanup(struct vsp1_video *video) in vsp1_video_cleanup() argument
1323 if (video_is_registered(&video->video)) in vsp1_video_cleanup()
1324 video_unregister_device(&video->video); in vsp1_video_cleanup()
1326 media_entity_cleanup(&video->video.entity); in vsp1_video_cleanup()