Lines Matching refs:video

63 static int vsp1_video_verify_format(struct vsp1_video *video)  in vsp1_video_verify_format()  argument
69 subdev = vsp1_video_remote_subdev(&video->pad, &fmt.pad); in vsp1_video_verify_format()
78 if (video->rwpf->fmtinfo->mbus != fmt.format.code || in vsp1_video_verify_format()
79 video->rwpf->format.height != fmt.format.height || in vsp1_video_verify_format()
80 video->rwpf->format.width != fmt.format.width) in vsp1_video_verify_format()
86 static int __vsp1_video_try_format(struct vsp1_video *video, in __vsp1_video_try_format() argument
118 info = vsp1_get_format_info(video->vsp1, pix->pixelformat); in __vsp1_video_try_format()
120 info = vsp1_get_format_info(video->vsp1, VSP1_VIDEO_DEF_FORMAT); in __vsp1_video_try_format()
313 vsp1_video_complete_buffer(struct vsp1_video *video) in vsp1_video_complete_buffer() argument
315 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_complete_buffer()
321 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_complete_buffer()
323 if (list_empty(&video->irqqueue)) { in vsp1_video_complete_buffer()
324 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_complete_buffer()
328 done = list_first_entry(&video->irqqueue, in vsp1_video_complete_buffer()
333 if (!list_empty(&video->irqqueue)) in vsp1_video_complete_buffer()
334 next = list_first_entry(&video->irqqueue, in vsp1_video_complete_buffer()
337 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_complete_buffer()
352 struct vsp1_video *video = rwpf->video; in vsp1_video_frame_end() local
355 buf = vsp1_video_complete_buffer(video); in vsp1_video_frame_end()
359 video->rwpf->mem = buf->mem; in vsp1_video_frame_end()
360 pipe->buffers_ready |= 1 << video->pipe_index; in vsp1_video_frame_end()
559 struct vsp1_video *video) in vsp1_video_pipeline_build() argument
562 struct media_entity *entity = &video->video.entity; in vsp1_video_pipeline_build()
591 rwpf->video->pipe_index = ++pipe->num_inputs; in vsp1_video_pipeline_build()
597 rwpf->video->pipe_index = 0; in vsp1_video_pipeline_build()
632 for (i = 0; i < video->vsp1->info->rpf_count; ++i) { in vsp1_video_pipeline_build()
646 struct vsp1_video *video) in vsp1_video_pipeline_init() argument
652 return vsp1_video_pipeline_build(pipe, video); in vsp1_video_pipeline_init()
655 static struct vsp1_pipeline *vsp1_video_pipeline_get(struct vsp1_video *video) in vsp1_video_pipeline_get() argument
666 if (!video->rwpf->entity.pipe) { in vsp1_video_pipeline_get()
671 ret = vsp1_video_pipeline_init(pipe, video); in vsp1_video_pipeline_get()
678 pipe = video->rwpf->entity.pipe; in vsp1_video_pipeline_get()
711 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_queue_setup() local
712 const struct v4l2_pix_format_mplane *format = &video->rwpf->format; in vsp1_video_queue_setup()
736 struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue); in vsp1_video_buffer_prepare() local
738 const struct v4l2_pix_format_mplane *format = &video->rwpf->format; in vsp1_video_buffer_prepare()
760 struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue); in vsp1_video_buffer_queue() local
761 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_buffer_queue()
766 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_buffer_queue()
767 empty = list_empty(&video->irqqueue); in vsp1_video_buffer_queue()
768 list_add_tail(&buf->queue, &video->irqqueue); in vsp1_video_buffer_queue()
769 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_buffer_queue()
776 video->rwpf->mem = buf->mem; in vsp1_video_buffer_queue()
777 pipe->buffers_ready |= 1 << video->pipe_index; in vsp1_video_buffer_queue()
779 if (vb2_is_streaming(&video->queue) && in vsp1_video_buffer_queue()
835 static void vsp1_video_release_buffers(struct vsp1_video *video) in vsp1_video_release_buffers() argument
841 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_release_buffers()
842 list_for_each_entry(buffer, &video->irqqueue, queue) in vsp1_video_release_buffers()
844 INIT_LIST_HEAD(&video->irqqueue); in vsp1_video_release_buffers()
845 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_release_buffers()
864 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_start_streaming() local
865 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_start_streaming()
874 vsp1_video_release_buffers(video); in vsp1_video_start_streaming()
906 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_stop_streaming() local
907 struct vsp1_pipeline *pipe = video->rwpf->entity.pipe; in vsp1_video_stop_streaming()
915 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_stop_streaming()
916 pipe->buffers_ready &= ~(1 << video->pipe_index); in vsp1_video_stop_streaming()
917 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_stop_streaming()
924 dev_err(video->vsp1->dev, "pipeline stop timeout\n"); in vsp1_video_stop_streaming()
930 media_pipeline_stop(&video->video.entity); in vsp1_video_stop_streaming()
931 vsp1_video_release_buffers(video); in vsp1_video_stop_streaming()
953 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_querycap() local
961 strscpy(cap->card, video->video.name, sizeof(cap->card)); in vsp1_video_querycap()
963 dev_name(video->vsp1->dev)); in vsp1_video_querycap()
972 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_get_format() local
974 if (format->type != video->queue.type) in vsp1_video_get_format()
977 mutex_lock(&video->lock); in vsp1_video_get_format()
978 format->fmt.pix_mp = video->rwpf->format; in vsp1_video_get_format()
979 mutex_unlock(&video->lock); in vsp1_video_get_format()
988 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_try_format() local
990 if (format->type != video->queue.type) in vsp1_video_try_format()
993 return __vsp1_video_try_format(video, &format->fmt.pix_mp, NULL); in vsp1_video_try_format()
1000 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_set_format() local
1004 if (format->type != video->queue.type) in vsp1_video_set_format()
1007 ret = __vsp1_video_try_format(video, &format->fmt.pix_mp, &info); in vsp1_video_set_format()
1011 mutex_lock(&video->lock); in vsp1_video_set_format()
1013 if (vb2_is_busy(&video->queue)) { in vsp1_video_set_format()
1018 video->rwpf->format = format->fmt.pix_mp; in vsp1_video_set_format()
1019 video->rwpf->fmtinfo = info; in vsp1_video_set_format()
1022 mutex_unlock(&video->lock); in vsp1_video_set_format()
1030 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_streamon() local
1031 struct media_device *mdev = &video->vsp1->media_dev; in vsp1_video_streamon()
1035 if (video->queue.owner && video->queue.owner != file->private_data) in vsp1_video_streamon()
1045 pipe = vsp1_video_pipeline_get(video); in vsp1_video_streamon()
1051 ret = __media_pipeline_start(&video->video.entity, &pipe->pipe); in vsp1_video_streamon()
1063 ret = vsp1_video_verify_format(video); in vsp1_video_streamon()
1068 ret = vb2_streamon(&video->queue, type); in vsp1_video_streamon()
1075 media_pipeline_stop(&video->video.entity); in vsp1_video_streamon()
1106 struct vsp1_video *video = video_drvdata(file); in vsp1_video_open() local
1114 v4l2_fh_init(vfh, &video->video); in vsp1_video_open()
1119 ret = vsp1_device_get(video->vsp1); in vsp1_video_open()
1131 struct vsp1_video *video = video_drvdata(file); in vsp1_video_release() local
1134 mutex_lock(&video->lock); in vsp1_video_release()
1135 if (video->queue.owner == vfh) { in vsp1_video_release()
1136 vb2_queue_release(&video->queue); in vsp1_video_release()
1137 video->queue.owner = NULL; in vsp1_video_release()
1139 mutex_unlock(&video->lock); in vsp1_video_release()
1141 vsp1_device_put(video->vsp1); in vsp1_video_release()
1247 struct vsp1_video *video; in vsp1_video_create() local
1251 video = devm_kzalloc(vsp1->dev, sizeof(*video), GFP_KERNEL); in vsp1_video_create()
1252 if (!video) in vsp1_video_create()
1255 rwpf->video = video; in vsp1_video_create()
1257 video->vsp1 = vsp1; in vsp1_video_create()
1258 video->rwpf = rwpf; in vsp1_video_create()
1262 video->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; in vsp1_video_create()
1263 video->pad.flags = MEDIA_PAD_FL_SOURCE; in vsp1_video_create()
1264 video->video.vfl_dir = VFL_DIR_TX; in vsp1_video_create()
1265 video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT_MPLANE | in vsp1_video_create()
1269 video->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; in vsp1_video_create()
1270 video->pad.flags = MEDIA_PAD_FL_SINK; in vsp1_video_create()
1271 video->video.vfl_dir = VFL_DIR_RX; in vsp1_video_create()
1272 video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | in vsp1_video_create()
1276 mutex_init(&video->lock); in vsp1_video_create()
1277 spin_lock_init(&video->irqlock); in vsp1_video_create()
1278 INIT_LIST_HEAD(&video->irqqueue); in vsp1_video_create()
1281 ret = media_entity_pads_init(&video->video.entity, 1, &video->pad); in vsp1_video_create()
1289 __vsp1_video_try_format(video, &rwpf->format, &rwpf->fmtinfo); in vsp1_video_create()
1292 video->video.v4l2_dev = &video->vsp1->v4l2_dev; in vsp1_video_create()
1293 video->video.fops = &vsp1_video_fops; in vsp1_video_create()
1294 snprintf(video->video.name, sizeof(video->video.name), "%s %s", in vsp1_video_create()
1296 video->video.vfl_type = VFL_TYPE_VIDEO; in vsp1_video_create()
1297 video->video.release = video_device_release_empty; in vsp1_video_create()
1298 video->video.ioctl_ops = &vsp1_video_ioctl_ops; in vsp1_video_create()
1300 video_set_drvdata(&video->video, video); in vsp1_video_create()
1302 video->queue.type = video->type; in vsp1_video_create()
1303 video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; in vsp1_video_create()
1304 video->queue.lock = &video->lock; in vsp1_video_create()
1305 video->queue.drv_priv = video; in vsp1_video_create()
1306 video->queue.buf_struct_size = sizeof(struct vsp1_vb2_buffer); in vsp1_video_create()
1307 video->queue.ops = &vsp1_video_queue_qops; in vsp1_video_create()
1308 video->queue.mem_ops = &vb2_dma_contig_memops; in vsp1_video_create()
1309 video->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; in vsp1_video_create()
1310 video->queue.dev = video->vsp1->bus_master; in vsp1_video_create()
1311 ret = vb2_queue_init(&video->queue); in vsp1_video_create()
1313 dev_err(video->vsp1->dev, "failed to initialize vb2 queue\n"); in vsp1_video_create()
1318 video->video.queue = &video->queue; in vsp1_video_create()
1319 ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1); in vsp1_video_create()
1321 dev_err(video->vsp1->dev, "failed to register video device\n"); in vsp1_video_create()
1325 return video; in vsp1_video_create()
1328 vsp1_video_cleanup(video); in vsp1_video_create()
1332 void vsp1_video_cleanup(struct vsp1_video *video) in vsp1_video_cleanup() argument
1334 if (video_is_registered(&video->video)) in vsp1_video_cleanup()
1335 video_unregister_device(&video->video); in vsp1_video_cleanup()
1337 media_entity_cleanup(&video->video.entity); in vsp1_video_cleanup()