Lines Matching defs:vcapture
69 struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device,
72 *fmt = vcapture->format;
78 struct vimc_capture_device *vcapture = video_drvdata(file);
80 f->fmt.pix = vcapture->format;
120 struct vimc_capture_device *vcapture = video_drvdata(file);
124 if (vb2_is_busy(&vcapture->queue))
131 dev_dbg(vcapture->ved.dev, "%s: format update: "
133 "new:%dx%d (0x%x, %d, %d, %d, %d)\n", vcapture->vdev.name,
135 vcapture->format.width, vcapture->format.height,
136 vcapture->format.pixelformat, vcapture->format.colorspace,
137 vcapture->format.quantization, vcapture->format.xfer_func,
138 vcapture->format.ycbcr_enc,
145 vcapture->format = f->fmt.pix;
226 static void vimc_capture_return_all_buffers(struct vimc_capture_device *vcapture,
231 spin_lock(&vcapture->qlock);
233 list_for_each_entry_safe(vbuf, node, &vcapture->buf_list, list) {
238 spin_unlock(&vcapture->qlock);
243 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq);
246 vcapture->sequence = 0;
249 ret = video_device_pipeline_start(&vcapture->vdev, &vcapture->stream.pipe);
251 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED);
255 ret = vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 1);
257 video_device_pipeline_stop(&vcapture->vdev);
258 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_QUEUED);
271 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq);
273 vimc_streamer_s_stream(&vcapture->stream, &vcapture->ved, 0);
276 video_device_pipeline_stop(&vcapture->vdev);
279 vimc_capture_return_all_buffers(vcapture, VB2_BUF_STATE_ERROR);
284 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb2_buf->vb2_queue);
289 spin_lock(&vcapture->qlock);
290 list_add_tail(&buf->list, &vcapture->buf_list);
291 spin_unlock(&vcapture->qlock);
298 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vq);
301 return sizes[0] < vcapture->format.sizeimage ? -EINVAL : 0;
304 sizes[0] = vcapture->format.sizeimage;
311 struct vimc_capture_device *vcapture = vb2_get_drv_priv(vb->vb2_queue);
312 unsigned long size = vcapture->format.sizeimage;
315 dev_err(vcapture->ved.dev, "%s: buffer too small (%lu < %lu)\n",
316 vcapture->vdev.name, vb2_plane_size(vb, 0), size);
342 struct vimc_capture_device *vcapture =
345 media_entity_cleanup(vcapture->ved.ent);
346 kfree(vcapture);
351 struct vimc_capture_device *vcapture =
354 vb2_video_unregister_device(&vcapture->vdev);
360 struct vimc_capture_device *vcapture = container_of(ved, struct vimc_capture_device,
365 spin_lock(&vcapture->qlock);
368 vimc_buf = list_first_entry_or_null(&vcapture->buf_list,
371 spin_unlock(&vcapture->qlock);
378 spin_unlock(&vcapture->qlock);
382 vimc_buf->vb2.sequence = vcapture->sequence++;
383 vimc_buf->vb2.field = vcapture->format.field;
387 memcpy(vbuf, frame, vcapture->format.sizeimage);
391 vcapture->format.sizeimage);
401 struct vimc_capture_device *vcapture;
407 vcapture = kzalloc(sizeof(*vcapture), GFP_KERNEL);
408 if (!vcapture)
412 vcapture->vdev.entity.name = vcfg_name;
413 vcapture->vdev.entity.function = MEDIA_ENT_F_IO_V4L;
414 vcapture->pad.flags = MEDIA_PAD_FL_SINK;
415 ret = media_entity_pads_init(&vcapture->vdev.entity,
416 1, &vcapture->pad);
421 mutex_init(&vcapture->lock);
424 q = &vcapture->queue;
429 q->drv_priv = vcapture;
436 q->lock = &vcapture->lock;
447 INIT_LIST_HEAD(&vcapture->buf_list);
448 spin_lock_init(&vcapture->qlock);
451 vcapture->format = fmt_default;
452 vpix = vimc_pix_map_by_pixelformat(vcapture->format.pixelformat);
453 vcapture->format.bytesperline = vcapture->format.width * vpix->bpp;
454 vcapture->format.sizeimage = vcapture->format.bytesperline *
455 vcapture->format.height;
458 vcapture->ved.ent = &vcapture->vdev.entity;
459 vcapture->ved.process_frame = vimc_capture_process_frame;
460 vcapture->ved.vdev_get_format = vimc_capture_get_format;
461 vcapture->ved.dev = vimc->mdev.dev;
464 vdev = &vcapture->vdev;
471 vdev->lock = &vcapture->lock;
476 video_set_drvdata(vdev, &vcapture->ved);
482 vcapture->vdev.name, ret);
486 return &vcapture->ved;
489 media_entity_cleanup(&vcapture->vdev.entity);
491 kfree(vcapture);