• Home
  • Raw
  • Download

Lines Matching refs:video

173 static int vsp1_video_verify_format(struct vsp1_video *video)  in vsp1_video_verify_format()  argument
179 subdev = vsp1_video_remote_subdev(&video->pad, &fmt.pad); in vsp1_video_verify_format()
188 if (video->fmtinfo->mbus != fmt.format.code || in vsp1_video_verify_format()
189 video->format.height != fmt.format.height || in vsp1_video_verify_format()
190 video->format.width != fmt.format.width) in vsp1_video_verify_format()
196 static int __vsp1_video_try_format(struct vsp1_video *video, in __vsp1_video_try_format() argument
278 vsp1_video_format_adjust(struct vsp1_video *video, in vsp1_video_format_adjust() argument
285 __vsp1_video_try_format(video, adjust, NULL); in vsp1_video_format_adjust()
408 struct vsp1_video *video) in vsp1_pipeline_validate() argument
411 struct media_entity *entity = &video->video.entity; in vsp1_pipeline_validate()
438 rwpf->video.pipe_index = pipe->num_inputs; in vsp1_pipeline_validate()
442 rwpf->video.pipe_index = 0; in vsp1_pipeline_validate()
476 struct vsp1_video *video) in vsp1_pipeline_init() argument
484 ret = vsp1_pipeline_validate(pipe, video); in vsp1_pipeline_init()
549 v4l2_subdev_call(&entity->subdev, video, s_stream, 0); in vsp1_pipeline_stop()
581 vsp1_video_complete_buffer(struct vsp1_video *video) in vsp1_video_complete_buffer() argument
583 struct vsp1_pipeline *pipe = to_vsp1_pipeline(&video->video.entity); in vsp1_video_complete_buffer()
589 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_complete_buffer()
591 if (list_empty(&video->irqqueue)) { in vsp1_video_complete_buffer()
592 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_complete_buffer()
596 done = list_first_entry(&video->irqqueue, in vsp1_video_complete_buffer()
600 if (pipe->lif && list_is_singular(&video->irqqueue)) { in vsp1_video_complete_buffer()
601 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_complete_buffer()
607 if (!list_empty(&video->irqqueue)) in vsp1_video_complete_buffer()
608 next = list_first_entry(&video->irqqueue, in vsp1_video_complete_buffer()
611 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_complete_buffer()
613 done->buf.sequence = video->sequence++; in vsp1_video_complete_buffer()
623 struct vsp1_video *video) in vsp1_video_frame_end() argument
628 buf = vsp1_video_complete_buffer(video); in vsp1_video_frame_end()
634 video->ops->queue(video, buf); in vsp1_video_frame_end()
635 pipe->buffers_ready |= 1 << video->pipe_index; in vsp1_video_frame_end()
651 vsp1_video_frame_end(pipe, &pipe->inputs[i]->video); in vsp1_pipeline_frame_end()
654 vsp1_video_frame_end(pipe, &pipe->output->video); in vsp1_pipeline_frame_end()
795 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_queue_setup() local
804 if (!vsp1_video_format_adjust(video, &fmt->fmt.pix_mp, &pix_mp)) in vsp1_video_queue_setup()
809 format = &video->format; in vsp1_video_queue_setup()
816 alloc_ctxs[i] = video->alloc_ctx; in vsp1_video_queue_setup()
825 struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue); in vsp1_video_buffer_prepare() local
827 const struct v4l2_pix_format_mplane *format = &video->format; in vsp1_video_buffer_prepare()
847 struct vsp1_video *video = vb2_get_drv_priv(vb->vb2_queue); in vsp1_video_buffer_queue() local
848 struct vsp1_pipeline *pipe = to_vsp1_pipeline(&video->video.entity); in vsp1_video_buffer_queue()
853 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_buffer_queue()
854 empty = list_empty(&video->irqqueue); in vsp1_video_buffer_queue()
855 list_add_tail(&buf->queue, &video->irqqueue); in vsp1_video_buffer_queue()
856 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_buffer_queue()
863 video->ops->queue(video, buf); in vsp1_video_buffer_queue()
864 pipe->buffers_ready |= 1 << video->pipe_index; in vsp1_video_buffer_queue()
866 if (vb2_is_streaming(&video->queue) && in vsp1_video_buffer_queue()
887 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_start_streaming() local
888 struct vsp1_pipeline *pipe = to_vsp1_pipeline(&video->video.entity); in vsp1_video_start_streaming()
910 uds->scale_alpha = rpf->video.fmtinfo->alpha; in vsp1_video_start_streaming()
917 ret = v4l2_subdev_call(&entity->subdev, video, in vsp1_video_start_streaming()
939 struct vsp1_video *video = vb2_get_drv_priv(vq); in vsp1_video_stop_streaming() local
940 struct vsp1_pipeline *pipe = to_vsp1_pipeline(&video->video.entity); in vsp1_video_stop_streaming()
950 dev_err(video->vsp1->dev, "pipeline stop timeout\n"); in vsp1_video_stop_streaming()
955 media_entity_pipeline_stop(&video->video.entity); in vsp1_video_stop_streaming()
958 spin_lock_irqsave(&video->irqlock, flags); in vsp1_video_stop_streaming()
959 list_for_each_entry(buffer, &video->irqqueue, queue) in vsp1_video_stop_streaming()
961 INIT_LIST_HEAD(&video->irqqueue); in vsp1_video_stop_streaming()
962 spin_unlock_irqrestore(&video->irqlock, flags); in vsp1_video_stop_streaming()
983 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_querycap() local
989 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) in vsp1_video_querycap()
997 strlcpy(cap->card, video->video.name, sizeof(cap->card)); in vsp1_video_querycap()
999 dev_name(video->vsp1->dev)); in vsp1_video_querycap()
1008 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_get_format() local
1010 if (format->type != video->queue.type) in vsp1_video_get_format()
1013 mutex_lock(&video->lock); in vsp1_video_get_format()
1014 format->fmt.pix_mp = video->format; in vsp1_video_get_format()
1015 mutex_unlock(&video->lock); in vsp1_video_get_format()
1024 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_try_format() local
1026 if (format->type != video->queue.type) in vsp1_video_try_format()
1029 return __vsp1_video_try_format(video, &format->fmt.pix_mp, NULL); in vsp1_video_try_format()
1036 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_set_format() local
1040 if (format->type != video->queue.type) in vsp1_video_set_format()
1043 ret = __vsp1_video_try_format(video, &format->fmt.pix_mp, &info); in vsp1_video_set_format()
1047 mutex_lock(&video->lock); in vsp1_video_set_format()
1049 if (vb2_is_busy(&video->queue)) { in vsp1_video_set_format()
1054 video->format = format->fmt.pix_mp; in vsp1_video_set_format()
1055 video->fmtinfo = info; in vsp1_video_set_format()
1058 mutex_unlock(&video->lock); in vsp1_video_set_format()
1066 struct vsp1_video *video = to_vsp1_video(vfh->vdev); in vsp1_video_streamon() local
1070 if (video->queue.owner && video->queue.owner != file->private_data) in vsp1_video_streamon()
1073 video->sequence = 0; in vsp1_video_streamon()
1081 pipe = video->video.entity.pipe in vsp1_video_streamon()
1082 ? to_vsp1_pipeline(&video->video.entity) : &video->pipe; in vsp1_video_streamon()
1084 ret = media_entity_pipeline_start(&video->video.entity, &pipe->pipe); in vsp1_video_streamon()
1091 ret = vsp1_video_verify_format(video); in vsp1_video_streamon()
1095 ret = vsp1_pipeline_init(pipe, video); in vsp1_video_streamon()
1100 ret = vb2_streamon(&video->queue, type); in vsp1_video_streamon()
1109 media_entity_pipeline_stop(&video->video.entity); in vsp1_video_streamon()
1137 struct vsp1_video *video = video_drvdata(file); in vsp1_video_open() local
1145 v4l2_fh_init(vfh, &video->video); in vsp1_video_open()
1150 ret = vsp1_device_get(video->vsp1); in vsp1_video_open()
1161 struct vsp1_video *video = video_drvdata(file); in vsp1_video_release() local
1164 mutex_lock(&video->lock); in vsp1_video_release()
1165 if (video->queue.owner == vfh) { in vsp1_video_release()
1166 vb2_queue_release(&video->queue); in vsp1_video_release()
1167 video->queue.owner = NULL; in vsp1_video_release()
1169 mutex_unlock(&video->lock); in vsp1_video_release()
1171 vsp1_device_put(video->vsp1); in vsp1_video_release()
1193 int vsp1_video_init(struct vsp1_video *video, struct vsp1_entity *rwpf) in vsp1_video_init() argument
1198 switch (video->type) { in vsp1_video_init()
1201 video->pad.flags = MEDIA_PAD_FL_SINK; in vsp1_video_init()
1206 video->pad.flags = MEDIA_PAD_FL_SOURCE; in vsp1_video_init()
1207 video->video.vfl_dir = VFL_DIR_TX; in vsp1_video_init()
1214 video->rwpf = rwpf; in vsp1_video_init()
1216 mutex_init(&video->lock); in vsp1_video_init()
1217 spin_lock_init(&video->irqlock); in vsp1_video_init()
1218 INIT_LIST_HEAD(&video->irqqueue); in vsp1_video_init()
1220 mutex_init(&video->pipe.lock); in vsp1_video_init()
1221 spin_lock_init(&video->pipe.irqlock); in vsp1_video_init()
1222 INIT_LIST_HEAD(&video->pipe.entities); in vsp1_video_init()
1223 init_waitqueue_head(&video->pipe.wq); in vsp1_video_init()
1224 video->pipe.state = VSP1_PIPELINE_STOPPED; in vsp1_video_init()
1227 ret = media_entity_init(&video->video.entity, 1, &video->pad, 0); in vsp1_video_init()
1232 video->fmtinfo = vsp1_get_format_info(VSP1_VIDEO_DEF_FORMAT); in vsp1_video_init()
1233 video->format.pixelformat = video->fmtinfo->fourcc; in vsp1_video_init()
1234 video->format.colorspace = V4L2_COLORSPACE_SRGB; in vsp1_video_init()
1235 video->format.field = V4L2_FIELD_NONE; in vsp1_video_init()
1236 video->format.width = VSP1_VIDEO_DEF_WIDTH; in vsp1_video_init()
1237 video->format.height = VSP1_VIDEO_DEF_HEIGHT; in vsp1_video_init()
1238 video->format.num_planes = 1; in vsp1_video_init()
1239 video->format.plane_fmt[0].bytesperline = in vsp1_video_init()
1240 video->format.width * video->fmtinfo->bpp[0] / 8; in vsp1_video_init()
1241 video->format.plane_fmt[0].sizeimage = in vsp1_video_init()
1242 video->format.plane_fmt[0].bytesperline * video->format.height; in vsp1_video_init()
1245 video->video.v4l2_dev = &video->vsp1->v4l2_dev; in vsp1_video_init()
1246 video->video.fops = &vsp1_video_fops; in vsp1_video_init()
1247 snprintf(video->video.name, sizeof(video->video.name), "%s %s", in vsp1_video_init()
1249 video->video.vfl_type = VFL_TYPE_GRABBER; in vsp1_video_init()
1250 video->video.release = video_device_release_empty; in vsp1_video_init()
1251 video->video.ioctl_ops = &vsp1_video_ioctl_ops; in vsp1_video_init()
1253 video_set_drvdata(&video->video, video); in vsp1_video_init()
1256 video->alloc_ctx = vb2_dma_contig_init_ctx(video->vsp1->dev); in vsp1_video_init()
1257 if (IS_ERR(video->alloc_ctx)) { in vsp1_video_init()
1258 ret = PTR_ERR(video->alloc_ctx); in vsp1_video_init()
1262 video->queue.type = video->type; in vsp1_video_init()
1263 video->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; in vsp1_video_init()
1264 video->queue.lock = &video->lock; in vsp1_video_init()
1265 video->queue.drv_priv = video; in vsp1_video_init()
1266 video->queue.buf_struct_size = sizeof(struct vsp1_video_buffer); in vsp1_video_init()
1267 video->queue.ops = &vsp1_video_queue_qops; in vsp1_video_init()
1268 video->queue.mem_ops = &vb2_dma_contig_memops; in vsp1_video_init()
1269 video->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY; in vsp1_video_init()
1270 ret = vb2_queue_init(&video->queue); in vsp1_video_init()
1272 dev_err(video->vsp1->dev, "failed to initialize vb2 queue\n"); in vsp1_video_init()
1277 video->video.queue = &video->queue; in vsp1_video_init()
1278 ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1); in vsp1_video_init()
1280 dev_err(video->vsp1->dev, "failed to register video device\n"); in vsp1_video_init()
1287 vb2_dma_contig_cleanup_ctx(video->alloc_ctx); in vsp1_video_init()
1288 vsp1_video_cleanup(video); in vsp1_video_init()
1292 void vsp1_video_cleanup(struct vsp1_video *video) in vsp1_video_cleanup() argument
1294 if (video_is_registered(&video->video)) in vsp1_video_cleanup()
1295 video_unregister_device(&video->video); in vsp1_video_cleanup()
1297 vb2_dma_contig_cleanup_ctx(video->alloc_ctx); in vsp1_video_cleanup()
1298 media_entity_cleanup(&video->video.entity); in vsp1_video_cleanup()