Lines Matching refs:vcapture
67 struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device, in vimc_capture_get_format() local
70 *fmt = vcapture->format; in vimc_capture_get_format()
76 struct vimc_capture_device *vcapture = video_drvdata(file); in vimc_capture_g_fmt_vid_cap() local
78 f->fmt.pix = vcapture->format; in vimc_capture_g_fmt_vid_cap()
118 struct vimc_capture_device *vcapture = video_drvdata(file); in vimc_capture_s_fmt_vid_cap() local
122 if (vb2_is_busy(&vcapture->queue)) in vimc_capture_s_fmt_vid_cap()
129 dev_dbg(vcapture->ved.dev, "%s: format update: " in vimc_capture_s_fmt_vid_cap()
131 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcapture->vdev.name, in vimc_capture_s_fmt_vid_cap()
133 vcapture->format.width, vcapture->format.height, in vimc_capture_s_fmt_vid_cap()
134 vcapture->format.pixelformat, vcapture->format.colorspace, in vimc_capture_s_fmt_vid_cap()
135 vcapture->format.quantization, vcapture->format.xfer_func, in vimc_capture_s_fmt_vid_cap()
136 vcapture->format.ycbcr_enc, in vimc_capture_s_fmt_vid_cap()
143 vcapture->format = f->fmt.pix; in vimc_capture_s_fmt_vid_cap()
225 static void vimc_capture_return_all_buffers(struct vimc_capture_device *vcapture, in vimc_capture_return_all_buffers() argument
230 spin_lock(&vcapture->qlock); in vimc_capture_return_all_buffers()
232 list_for_each_entry_safe(vbuf, node, &vcapture->buf_list, list) { in vimc_capture_return_all_buffers()
237 spin_unlock(&vcapture->qlock); in vimc_capture_return_all_buffers()
242 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_start_streaming() local
245 vcapture->sequence = 0; in vimc_capture_start_streaming()
248 ret = video_device_pipeline_start(&vcapture->vdev, &vcapture->stream.pipe); in vimc_capture_start_streaming()
250 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); in vimc_capture_start_streaming()
254 ret = vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 1); in vimc_capture_start_streaming()
256 video_device_pipeline_stop(&vcapture->vdev); in vimc_capture_start_streaming()
257 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); in vimc_capture_start_streaming()
270 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_stop_streaming() local
272 vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 0); in vimc_capture_stop_streaming()
275 video_device_pipeline_stop(&vcapture->vdev); in vimc_capture_stop_streaming()
278 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_ERROR); in vimc_capture_stop_streaming()
283 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb2_buf->vb2_queue); in vimc_capture_buf_queue() local
288 spin_lock(&vcapture->qlock); in vimc_capture_buf_queue()
289 list_add_tail(&buf->list, &vcapture->buf_list); in vimc_capture_buf_queue()
290 spin_unlock(&vcapture->qlock); in vimc_capture_buf_queue()
297 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_queue_setup() local
300 return sizes[0] < vcapture->format.sizeimage ? -EINVAL : 0; in vimc_capture_queue_setup()
303 sizes[0] = vcapture->format.sizeimage; in vimc_capture_queue_setup()
310 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb->vb2_queue); in vimc_capture_buffer_prepare() local
311 unsigned long size = vcapture->format.sizeimage; in vimc_capture_buffer_prepare()
314 dev_err(vcapture->ved.dev, "%s: buffer too small (%lu < %lu)\n", in vimc_capture_buffer_prepare()
315 vcapture->vdev.name, vb2_plane_size(vb, 0), size); in vimc_capture_buffer_prepare()
335 struct vimc_capture_device *vcapture = in vimc_capture_release() local
338 media_entity_cleanup(vcapture->ved.ent); in vimc_capture_release()
339 kfree(vcapture); in vimc_capture_release()
344 struct vimc_capture_device *vcapture = in vimc_capture_unregister() local
347 vb2_video_unregister_device(&vcapture->vdev); in vimc_capture_unregister()
353 struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device, in vimc_capture_process_frame() local
358 spin_lock(&vcapture->qlock); in vimc_capture_process_frame()
361 vimc_buf = list_first_entry_or_null(&vcapture->buf_list, in vimc_capture_process_frame()
364 spin_unlock(&vcapture->qlock); in vimc_capture_process_frame()
371 spin_unlock(&vcapture->qlock); in vimc_capture_process_frame()
375 vimc_buf->vb2.sequence = vcapture->sequence++; in vimc_capture_process_frame()
376 vimc_buf->vb2.field = vcapture->format.field; in vimc_capture_process_frame()
380 memcpy(vbuf, frame, vcapture->format.sizeimage); in vimc_capture_process_frame()
384 vcapture->format.sizeimage); in vimc_capture_process_frame()
394 struct vimc_capture_device *vcapture; in vimc_capture_add() local
400 vcapture = kzalloc_obj(*vcapture); in vimc_capture_add()
401 if (!vcapture) in vimc_capture_add()
405 vcapture->vdev.entity.name = vcfg_name; in vimc_capture_add()
406 vcapture->vdev.entity.function = MEDIA_ENT_F_IO_V4L; in vimc_capture_add()
407 vcapture->pad.flags = MEDIA_PAD_FL_SINK; in vimc_capture_add()
408 ret = media_entity_pads_init(&vcapture->vdev.entity, in vimc_capture_add()
409 1, &vcapture->pad); in vimc_capture_add()
414 mutex_init(&vcapture->lock); in vimc_capture_add()
417 q = &vcapture->queue; in vimc_capture_add()
422 q->drv_priv = vcapture; in vimc_capture_add()
429 q->lock = &vcapture->lock; in vimc_capture_add()
440 INIT_LIST_HEAD(&vcapture->buf_list); in vimc_capture_add()
441 spin_lock_init(&vcapture->qlock); in vimc_capture_add()
444 vcapture->format = fmt_default; in vimc_capture_add()
445 vpix = vimc_pix_map_by_pixelformat(vcapture->format.pixelformat); in vimc_capture_add()
446 vcapture->format.bytesperline = vcapture->format.width * vpix->bpp; in vimc_capture_add()
447 vcapture->format.sizeimage = vcapture->format.bytesperline * in vimc_capture_add()
448 vcapture->format.height; in vimc_capture_add()
451 vcapture->ved.ent = &vcapture->vdev.entity; in vimc_capture_add()
452 vcapture->ved.process_frame = vimc_capture_process_frame; in vimc_capture_add()
453 vcapture->ved.vdev_get_format = vimc_capture_get_format; in vimc_capture_add()
454 vcapture->ved.dev = vimc->mdev.dev; in vimc_capture_add()
457 vdev = &vcapture->vdev; in vimc_capture_add()
464 vdev->lock = &vcapture->lock; in vimc_capture_add()
469 video_set_drvdata(vdev, &vcapture->ved); in vimc_capture_add()
475 vcapture->vdev.name, ret); in vimc_capture_add()
479 return &vcapture->ved; in vimc_capture_add()
482 media_entity_cleanup(&vcapture->vdev.entity); in vimc_capture_add()
484 kfree(vcapture); in vimc_capture_add()