Lines Matching refs:vcapture
69 struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device, in vimc_capture_get_format() local
72 *fmt = vcapture->format; in vimc_capture_get_format()
78 struct vimc_capture_device *vcapture = video_drvdata(file); in vimc_capture_g_fmt_vid_cap() local
80 f->fmt.pix = vcapture->format; in vimc_capture_g_fmt_vid_cap()
120 struct vimc_capture_device *vcapture = video_drvdata(file); in vimc_capture_s_fmt_vid_cap() local
124 if (vb2_is_busy(&vcapture->queue)) in vimc_capture_s_fmt_vid_cap()
131 dev_dbg(vcapture->ved.dev, "%s: format update: " in vimc_capture_s_fmt_vid_cap()
133 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcapture->vdev.name, in vimc_capture_s_fmt_vid_cap()
135 vcapture->format.width, vcapture->format.height, in vimc_capture_s_fmt_vid_cap()
136 vcapture->format.pixelformat, vcapture->format.colorspace, in vimc_capture_s_fmt_vid_cap()
137 vcapture->format.quantization, vcapture->format.xfer_func, in vimc_capture_s_fmt_vid_cap()
138 vcapture->format.ycbcr_enc, in vimc_capture_s_fmt_vid_cap()
145 vcapture->format = f->fmt.pix; in vimc_capture_s_fmt_vid_cap()
227 static void vimc_capture_return_all_buffers(struct vimc_capture_device *vcapture, in vimc_capture_return_all_buffers() argument
232 spin_lock(&vcapture->qlock); in vimc_capture_return_all_buffers()
234 list_for_each_entry_safe(vbuf, node, &vcapture->buf_list, list) { in vimc_capture_return_all_buffers()
239 spin_unlock(&vcapture->qlock); in vimc_capture_return_all_buffers()
244 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_start_streaming() local
247 vcapture->sequence = 0; in vimc_capture_start_streaming()
250 ret = video_device_pipeline_start(&vcapture->vdev, &vcapture->stream.pipe); in vimc_capture_start_streaming()
252 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); in vimc_capture_start_streaming()
256 ret = vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 1); in vimc_capture_start_streaming()
258 video_device_pipeline_stop(&vcapture->vdev); in vimc_capture_start_streaming()
259 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED); in vimc_capture_start_streaming()
272 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_stop_streaming() local
274 vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 0); in vimc_capture_stop_streaming()
277 video_device_pipeline_stop(&vcapture->vdev); in vimc_capture_stop_streaming()
280 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_ERROR); in vimc_capture_stop_streaming()
285 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb2_buf->vb2_queue); in vimc_capture_buf_queue() local
290 spin_lock(&vcapture->qlock); in vimc_capture_buf_queue()
291 list_add_tail(&buf->list, &vcapture->buf_list); in vimc_capture_buf_queue()
292 spin_unlock(&vcapture->qlock); in vimc_capture_buf_queue()
299 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq); in vimc_capture_queue_setup() local
302 return sizes[0] < vcapture->format.sizeimage ? -EINVAL : 0; in vimc_capture_queue_setup()
305 sizes[0] = vcapture->format.sizeimage; in vimc_capture_queue_setup()
312 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb->vb2_queue); in vimc_capture_buffer_prepare() local
313 unsigned long size = vcapture->format.sizeimage; in vimc_capture_buffer_prepare()
316 dev_err(vcapture->ved.dev, "%s: buffer too small (%lu < %lu)\n", in vimc_capture_buffer_prepare()
317 vcapture->vdev.name, vb2_plane_size(vb, 0), size); in vimc_capture_buffer_prepare()
337 struct vimc_capture_device *vcapture = in vimc_capture_release() local
340 media_entity_cleanup(vcapture->ved.ent); in vimc_capture_release()
341 kfree(vcapture); in vimc_capture_release()
346 struct vimc_capture_device *vcapture = in vimc_capture_unregister() local
349 vb2_video_unregister_device(&vcapture->vdev); in vimc_capture_unregister()
355 struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device, in vimc_capture_process_frame() local
360 spin_lock(&vcapture->qlock); in vimc_capture_process_frame()
363 vimc_buf = list_first_entry_or_null(&vcapture->buf_list, in vimc_capture_process_frame()
366 spin_unlock(&vcapture->qlock); in vimc_capture_process_frame()
373 spin_unlock(&vcapture->qlock); in vimc_capture_process_frame()
377 vimc_buf->vb2.sequence = vcapture->sequence++; in vimc_capture_process_frame()
378 vimc_buf->vb2.field = vcapture->format.field; in vimc_capture_process_frame()
382 memcpy(vbuf, frame, vcapture->format.sizeimage); in vimc_capture_process_frame()
386 vcapture->format.sizeimage); in vimc_capture_process_frame()
396 struct vimc_capture_device *vcapture; in vimc_capture_add() local
402 vcapture = kzalloc(sizeof(*vcapture), GFP_KERNEL); in vimc_capture_add()
403 if (!vcapture) in vimc_capture_add()
407 vcapture->vdev.entity.name = vcfg_name; in vimc_capture_add()
408 vcapture->vdev.entity.function = MEDIA_ENT_F_IO_V4L; in vimc_capture_add()
409 vcapture->pad.flags = MEDIA_PAD_FL_SINK; in vimc_capture_add()
410 ret = media_entity_pads_init(&vcapture->vdev.entity, in vimc_capture_add()
411 1, &vcapture->pad); in vimc_capture_add()
416 mutex_init(&vcapture->lock); in vimc_capture_add()
419 q = &vcapture->queue; in vimc_capture_add()
424 q->drv_priv = vcapture; in vimc_capture_add()
431 q->lock = &vcapture->lock; in vimc_capture_add()
442 INIT_LIST_HEAD(&vcapture->buf_list); in vimc_capture_add()
443 spin_lock_init(&vcapture->qlock); in vimc_capture_add()
446 vcapture->format = fmt_default; in vimc_capture_add()
447 vpix = vimc_pix_map_by_pixelformat(vcapture->format.pixelformat); in vimc_capture_add()
448 vcapture->format.bytesperline = vcapture->format.width * vpix->bpp; in vimc_capture_add()
449 vcapture->format.sizeimage = vcapture->format.bytesperline * in vimc_capture_add()
450 vcapture->format.height; in vimc_capture_add()
453 vcapture->ved.ent = &vcapture->vdev.entity; in vimc_capture_add()
454 vcapture->ved.process_frame = vimc_capture_process_frame; in vimc_capture_add()
455 vcapture->ved.vdev_get_format = vimc_capture_get_format; in vimc_capture_add()
456 vcapture->ved.dev = vimc->mdev.dev; in vimc_capture_add()
459 vdev = &vcapture->vdev; in vimc_capture_add()
466 vdev->lock = &vcapture->lock; in vimc_capture_add()
471 video_set_drvdata(vdev, &vcapture->ved); in vimc_capture_add()
477 vcapture->vdev.name, ret); in vimc_capture_add()
481 return &vcapture->ved; in vimc_capture_add()
484 media_entity_cleanup(&vcapture->vdev.entity); in vimc_capture_add()
486 kfree(vcapture); in vimc_capture_add()