这篇教程C++ vb2_plane_size函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vb2_plane_size函数的典型用法代码示例。如果您正苦于以下问题:C++ vb2_plane_size函数的具体用法?C++ vb2_plane_size怎么用?C++ vb2_plane_size使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vb2_plane_size函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: gsc_capture_buf_preparestatic int gsc_capture_buf_prepare(struct vb2_buffer *vb){ struct vb2_queue *vq = vb->vb2_queue; struct gsc_ctx *ctx = vq->drv_priv; struct gsc_frame *frame = &ctx->d_frame; int i; if (frame->fmt == NULL) return -EINVAL; for (i = 0; i < frame->fmt->num_planes; i++) { unsigned long size = frame->payload[i]; if (vb2_plane_size(vb, i) < size) { v4l2_err(ctx->gsc_dev->cap.vfd, "User buffer too small (%ld < %ld)/n", vb2_plane_size(vb, i), size); return -EINVAL; } vb2_set_plane_payload(vb, i, size); } vb2_ion_buf_prepare(vb); return 0;}
开发者ID:hedongjie,项目名称:m35x,代码行数:26,
示例2: isp_video_capture_buffer_preparestatic int isp_video_capture_buffer_prepare(struct vb2_buffer *vb){ struct fimc_isp *isp = vb2_get_drv_priv(vb->vb2_queue); struct fimc_is_video *video = &isp->video_capture; int i; if (video->format == NULL) return -EINVAL; for (i = 0; i < video->format->memplanes; i++) { unsigned long size = video->pixfmt.plane_fmt[i].sizeimage; if (vb2_plane_size(vb, i) < size) { v4l2_err(&video->ve.vdev, "User buffer too small (%ld < %ld)/n", vb2_plane_size(vb, i), size); return -EINVAL; } vb2_set_plane_payload(vb, i, size); } /* Check if we get one of the already known buffers. */ if (test_bit(ST_ISP_VID_CAP_BUF_PREP, &isp->state)) { dma_addr_t dma_addr = vb2_dma_contig_plane_dma_addr(vb, 0); int i; for (i = 0; i < video->buf_count; i++) if (video->buffers[i]->dma_addr[0] == dma_addr) return 0; return -ENXIO; } return 0;}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:34,
示例3: uvc_buffer_preparestatic int uvc_buffer_prepare(struct vb2_buffer *vb){ struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct uvc_buffer *buf = container_of(vbuf, struct uvc_buffer, buf); if (vb->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && vb2_get_plane_payload(vb, 0) > vb2_plane_size(vb, 0)) { uvc_trace(UVC_TRACE_CAPTURE, "[E] Bytes used out of bounds./n"); return -EINVAL; } if (unlikely(queue->flags & UVC_QUEUE_DISCONNECTED)) return -ENODEV; buf->state = UVC_BUF_STATE_QUEUED; buf->mem = vb2_plane_vaddr(vb, 0); buf->length = vb2_plane_size(vb, 0); if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) buf->bytesused = 0; else buf->bytesused = vb2_get_plane_payload(vb, 0); return 0;}
开发者ID:Lyude,项目名称:linux,代码行数:25,
示例4: unicam_videobuf_preparestatic int unicam_videobuf_prepare(struct vb2_buffer *vb){ struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, icd-> current_fmt->host_fmt); unsigned long size; pr_debug("-enter"); if (bytes_per_line < 0) return bytes_per_line; pr_debug("vb=0x%p buf=0x%p, size=%lu", vb, (void *)vb2_plane_dma_addr(vb, 0), vb2_get_plane_payload(vb, 0)); size = icd->user_height * bytes_per_line; if (vb2_plane_size(vb, 0) < size) { dev_err(icd->dev.parent, "Buffer too small (%lu < %lu)/n", vb2_plane_size(vb, 0), size); return -ENOBUFS; } vb2_set_plane_payload(vb, 0, size); pr_debug("-exit"); return 0;}
开发者ID:birey,项目名称:android_kernel_samsung_kyleproxx,代码行数:28,
示例5: buffer_queuestatic void buffer_queue(struct vb2_buffer *vb){ unsigned long flags; struct smi2021 *smi2021 = vb2_get_drv_priv(vb->vb2_queue); struct smi2021_buf *buf = container_of(vb, struct smi2021_buf, vb); if (smi2021->udev == NULL) { vb2_buffer_done(vb, VB2_BUF_STATE_ERROR); return; } buf->mem = vb2_plane_vaddr(vb, 0); buf->length = vb2_plane_size(vb, 0); buf->pos = 0; buf->trc_av = 0; buf->in_blank = true; buf->second_field = false; spin_lock_irqsave(&smi2021->buf_lock, flags); if (buf->length < smi2021->cur_height * SMI2021_BYTES_PER_LINE) vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); else list_add_tail(&buf->list, &smi2021->bufs); spin_unlock_irqrestore(&smi2021->buf_lock, flags);}
开发者ID:binkybear,项目名称:kangaroo,代码行数:26,
示例6: buffer_queuestatic void buffer_queue(struct vb2_buffer *vb){ unsigned long flags; struct stk1160 *dev = vb2_get_drv_priv(vb->vb2_queue); struct stk1160_buffer *buf = container_of(vb, struct stk1160_buffer, vb); spin_lock_irqsave(&dev->buf_lock, flags); if (!dev->udev) { /* * If the device is disconnected return the buffer to userspace * directly. The next QBUF call will fail with -ENODEV. */ vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); } else { buf->mem = vb2_plane_vaddr(vb, 0); buf->length = vb2_plane_size(vb, 0); buf->bytesused = 0; buf->pos = 0; /* * If buffer length is less from expected then we return * the buffer to userspace directly. */ if (buf->length < dev->width * dev->height * 2) vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); else list_add_tail(&buf->list, &dev->avail_bufs); } spin_unlock_irqrestore(&dev->buf_lock, flags);}
开发者ID:cyberphox,项目名称:monoev3kernel,代码行数:33,
示例7: _buffer_preparestatic int _buffer_prepare(struct vb2_buffer *vb){ struct dvb_vb2_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); unsigned long size = ctx->buf_siz; if (vb2_plane_size(vb, 0) < size) { dprintk(1, "[%s] data will not fit into plane (%lu < %lu)/n", ctx->name, vb2_plane_size(vb, 0), size); return -EINVAL; } vb2_set_plane_payload(vb, 0, size); dprintk(3, "[%s]/n", ctx->name); return 0;}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:16,
示例8: buffer_preparestatic int buffer_prepare(struct vb2_buffer *vb){ struct cx23885_dev *dev = vb->vb2_queue->drv_priv; struct cx23885_buffer *buf = container_of(vb, struct cx23885_buffer, vb); struct sg_table *sgt = vb2_dma_sg_plane_desc(vb, 0); unsigned lines = VBI_PAL_LINE_COUNT; int ret; if (dev->tvnorm & V4L2_STD_525_60) lines = VBI_NTSC_LINE_COUNT; if (vb2_plane_size(vb, 0) < lines * VBI_LINE_LENGTH * 2) return -EINVAL; vb2_set_plane_payload(vb, 0, lines * VBI_LINE_LENGTH * 2); ret = dma_map_sg(&dev->pci->dev, sgt->sgl, sgt->nents, DMA_FROM_DEVICE); if (!ret) return -EIO; cx23885_risc_vbibuffer(dev->pci, &buf->risc, sgt->sgl, 0, VBI_LINE_LENGTH * lines, VBI_LINE_LENGTH, 0, lines); return 0;}
开发者ID:3null,项目名称:linux,代码行数:27,
示例9: buf_preparestatic int buf_prepare(struct vb2_buffer *vb){ struct css2600_isys_queue *aq = vb2_queue_to_css2600_isys_queue(vb->vb2_queue); struct css2600_isys_video *av = css2600_isys_queue_to_video(aq); dev_dbg(&av->isys->adev->dev, "configured size %u, buffer size %lu/n", av->pix.sizeimage, vb2_plane_size(vb, 0)); if (av->pix.sizeimage > vb2_plane_size(vb, 0)) return -EINVAL; vb2_set_plane_payload(vb, 0, av->pix.sizeimage); return 0;}
开发者ID:Druboo666,项目名称:android_kernel_asus_moorefield,代码行数:16,
示例10: iss_video_buf_preparestatic int iss_video_buf_prepare(struct vb2_buffer *vb){ struct iss_video_fh *vfh = vb2_get_drv_priv(vb->vb2_queue); struct iss_buffer *buffer = container_of(vb, struct iss_buffer, vb); struct iss_video *video = vfh->video; unsigned long size = vfh->format.fmt.pix.sizeimage; dma_addr_t addr; if (vb2_plane_size(vb, 0) < size) return -ENOBUFS; /* Refuse to prepare the buffer is the video node has registered an * error. We don't need to take any lock here as the operation is * inherently racy. The authoritative check will be performed in the * queue handler, which can't return an error, this check is just a best * effort to notify userspace as early as possible. */ if (unlikely(video->error)) return -EIO; addr = vb2_dma_contig_plane_dma_addr(vb, 0); if (!IS_ALIGNED(addr, 32)) { dev_dbg(video->iss->dev, "Buffer address must be aligned to 32 bytes boundary./n"); return -EINVAL; } vb2_set_plane_payload(vb, 0, size); buffer->iss_addr = addr; return 0;}
开发者ID:Astralix,项目名称:mainline-dss11,代码行数:31,
示例11: rcar_vin_videobuf_queuestatic void rcar_vin_videobuf_queue(struct vb2_buffer *vb){ struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); struct soc_camera_host *ici = to_soc_camera_host(icd->parent); struct rcar_vin_priv *priv = ici->priv; unsigned long size; size = icd->sizeimage; if (vb2_plane_size(vb, 0) < size) { dev_err(icd->parent, "Buffer #%d too small (%lu < %lu)/n", vb->v4l2_buf.index, vb2_plane_size(vb, 0), size); goto error; } vb2_set_plane_payload(vb, 0, size); dev_dbg(icd->parent, "%s (vb=0x%p) 0x%p %lu/n", __func__, vb, vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); spin_lock_irq(&priv->lock); list_add_tail(to_buf_list(vb), &priv->capture); rcar_vin_fill_hw_slot(priv); /* If we weren't running, and have enough buffers, start capturing! */ if (priv->state != RUNNING && rcar_vin_hw_ready(priv)) { if (rcar_vin_setup(priv)) { /* Submit error */ list_del_init(to_buf_list(vb)); spin_unlock_irq(&priv->lock); goto error; } priv->request_to_stop = false; init_completion(&priv->capture_stop); priv->state = RUNNING; rcar_vin_capture(priv); } spin_unlock_irq(&priv->lock); return;error: vb2_buffer_done(vb, VB2_BUF_STATE_ERROR);}
开发者ID:BozkurTR,项目名称:kernel,代码行数:46,
示例12: mx3_videobuf_preparestatic int mx3_videobuf_prepare(struct vb2_buffer *vb){ struct soc_camera_device *icd = soc_camera_from_vb2q(vb->vb2_queue); struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct mx3_camera_dev *mx3_cam = ici->priv; struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; struct scatterlist *sg; struct mx3_camera_buffer *buf; size_t new_size; int bytes_per_line = soc_mbus_bytes_per_line(icd->user_width, icd->current_fmt->host_fmt); if (bytes_per_line < 0) return bytes_per_line; buf = to_mx3_vb(vb); sg = &buf->sg; new_size = bytes_per_line * icd->user_height; if (vb2_plane_size(vb, 0) < new_size) { dev_err(icd->dev.parent, "Buffer too small (%lu < %zu)/n", vb2_plane_size(vb, 0), new_size); return -ENOBUFS; } if (buf->state == CSI_BUF_NEEDS_INIT) { sg_dma_address(sg) = vb2_dma_contig_plane_paddr(vb, 0); sg_dma_len(sg) = new_size; buf->txd = ichan->dma_chan.device->device_prep_slave_sg( &ichan->dma_chan, sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT); if (!buf->txd) return -EIO; buf->txd->callback_param = buf->txd; buf->txd->callback = mx3_cam_dma_done; buf->state = CSI_BUF_PREPARED; } vb2_set_plane_payload(vb, 0, new_size); return 0;}
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:46,
示例13: vbi_buffer_preparestatic int vbi_buffer_prepare(struct vb2_buffer *vb){ struct em28xx *dev = vb2_get_drv_priv(vb->vb2_queue); struct em28xx_v4l2 *v4l2 = dev->v4l2; unsigned long size; size = v4l2->vbi_width * v4l2->vbi_height * 2; if (vb2_plane_size(vb, 0) < size) { printk(KERN_INFO "%s data will not fit into plane (%lu < %lu)/n", __func__, vb2_plane_size(vb, 0), size); return -EINVAL; } vb2_set_plane_payload(vb, 0, size); return 0;}
开发者ID:020gzh,项目名称:linux,代码行数:17,
示例14: vb2ops_venc_buf_preparestatic int vb2ops_venc_buf_prepare(struct vb2_buffer *vb){ struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); struct mtk_q_data *q_data; int i; q_data = mtk_venc_get_q_data(ctx, vb->vb2_queue->type); for (i = 0; i < q_data->fmt->num_planes; i++) { if (vb2_plane_size(vb, i) < q_data->sizeimage[i]) { mtk_v4l2_err("data will not fit into plane %d (%lu < %d)", i, vb2_plane_size(vb, i), q_data->sizeimage[i]); return -EINVAL; } } return 0;}
开发者ID:avagin,项目名称:linux,代码行数:19,
示例15: fimc_is_isp_buf_preparestatic int fimc_is_isp_buf_prepare(struct vb2_buffer *vb){ struct fimc_is_video_dev *video = vb->vb2_queue->drv_priv; struct fimc_is_dev *is_dev = video->dev; unsigned long size; int i; for (i = 0; i < is_dev->video[FIMC_IS_VIDEO_NUM_BAYER].num_plane; i++) { size = is_dev->video[FIMC_IS_VIDEO_NUM_BAYER].plane_size[i]; if (vb2_plane_size(vb, i) < size) { err("User buffer too small(%ld < %ld)/n", vb2_plane_size(vb, i), size); return -EINVAL; } vb2_set_plane_payload(vb, i, size); } return 0;}
开发者ID:danielyuan2015,项目名称:Exynos4412,代码行数:21,
示例16: xvip_dma_buffer_preparestatic int xvip_dma_buffer_prepare(struct vb2_buffer *vb){ struct xvip_dma *dma = vb2_get_drv_priv(vb->vb2_queue); struct xvip_dma_buffer *buf = to_xvip_dma_buffer(vb); buf->dma = dma; buf->addr = vb2_dma_contig_plane_dma_addr(vb, 0); buf->length = vb2_plane_size(vb, 0); buf->bytesused = 0; return 0;}
开发者ID:bmouring,项目名称:linux-xlnx,代码行数:12,
示例17: hva_buf_preparestatic int hva_buf_prepare(struct vb2_buffer *vb){ struct hva_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); struct device *dev = ctx_to_dev(ctx); struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); if (vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) { struct hva_frame *frame = to_hva_frame(vbuf); if (vbuf->field == V4L2_FIELD_ANY) vbuf->field = V4L2_FIELD_NONE; if (vbuf->field != V4L2_FIELD_NONE) { dev_dbg(dev, "%s frame[%d] prepare: %d field not supported/n", ctx->name, vb->index, vbuf->field); return -EINVAL; } if (!frame->prepared) { /* get memory addresses */ frame->vaddr = vb2_plane_vaddr(&vbuf->vb2_buf, 0); frame->paddr = vb2_dma_contig_plane_dma_addr( &vbuf->vb2_buf, 0); frame->info = ctx->frameinfo; frame->prepared = true; dev_dbg(dev, "%s frame[%d] prepared; virt=%p, phy=%pad/n", ctx->name, vb->index, frame->vaddr, &frame->paddr); } } else { struct hva_stream *stream = to_hva_stream(vbuf); if (!stream->prepared) { /* get memory addresses */ stream->vaddr = vb2_plane_vaddr(&vbuf->vb2_buf, 0); stream->paddr = vb2_dma_contig_plane_dma_addr( &vbuf->vb2_buf, 0); stream->size = vb2_plane_size(&vbuf->vb2_buf, 0); stream->prepared = true; dev_dbg(dev, "%s stream[%d] prepared; virt=%p, phy=%pad/n", ctx->name, vb->index, stream->vaddr, &stream->paddr); } } return 0;}
开发者ID:acton393,项目名称:linux,代码行数:51,
示例18: rockchip_vpu_job_finishstatic void rockchip_vpu_job_finish(struct rockchip_vpu_dev *vpu, struct rockchip_vpu_ctx *ctx, unsigned int bytesused, enum vb2_buffer_state result){ struct vb2_v4l2_buffer *src, *dst; size_t avail_size; pm_runtime_mark_last_busy(vpu->dev); pm_runtime_put_autosuspend(vpu->dev); clk_bulk_disable(vpu->variant->num_clocks, vpu->clocks); src = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); dst = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); if (WARN_ON(!src)) return; if (WARN_ON(!dst)) return; src->sequence = ctx->sequence_out++; dst->sequence = ctx->sequence_cap++; dst->field = src->field; if (src->flags & V4L2_BUF_FLAG_TIMECODE) dst->timecode = src->timecode; dst->vb2_buf.timestamp = src->vb2_buf.timestamp; dst->flags &= ~(V4L2_BUF_FLAG_TSTAMP_SRC_MASK | V4L2_BUF_FLAG_TIMECODE); dst->flags |= src->flags & (V4L2_BUF_FLAG_TSTAMP_SRC_MASK | V4L2_BUF_FLAG_TIMECODE); avail_size = vb2_plane_size(&dst->vb2_buf, 0) - ctx->vpu_dst_fmt->header_size; if (bytesused <= avail_size) { if (ctx->bounce_buf) { memcpy(vb2_plane_vaddr(&dst->vb2_buf, 0) + ctx->vpu_dst_fmt->header_size, ctx->bounce_buf, bytesused); } dst->vb2_buf.planes[0].bytesused = ctx->vpu_dst_fmt->header_size + bytesused; } else { result = VB2_BUF_STATE_ERROR; } v4l2_m2m_buf_done(src, result); v4l2_m2m_buf_done(dst, result); v4l2_m2m_job_finish(vpu->m2m_dev, ctx->fh.m2m_ctx);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:51,
示例19: buffer_preparestatic int buffer_prepare(struct vb2_buffer *vb){ struct vb2_queue *vq = vb->vb2_queue; struct fimc_ctx *ctx = vq->drv_priv; int i; if (ctx->d_frame.fmt == NULL) return -EINVAL; for (i = 0; i < ctx->d_frame.fmt->memplanes; i++) { unsigned long size = ctx->d_frame.payload[i]; if (vb2_plane_size(vb, i) < size) { v4l2_err(ctx->fimc_dev->vid_cap.vfd, "User buffer too small (%ld < %ld)/n", vb2_plane_size(vb, i), size); return -EINVAL; } vb2_set_plane_payload(vb, i, size); } return 0;}
开发者ID:artynet,项目名称:linux-3.3.8,代码行数:23,
示例20: vbi_buffer_queuestatic voidvbi_buffer_queue(struct vb2_buffer *vb){ struct em28xx *dev = vb2_get_drv_priv(vb->vb2_queue); struct em28xx_buffer *buf = container_of(vb, struct em28xx_buffer, vb); struct em28xx_dmaqueue *vbiq = &dev->vbiq; unsigned long flags = 0; buf->mem = vb2_plane_vaddr(vb, 0); buf->length = vb2_plane_size(vb, 0); spin_lock_irqsave(&dev->slock, flags); list_add_tail(&buf->list, &vbiq->active); spin_unlock_irqrestore(&dev->slock, flags);}
开发者ID:19Dan01,项目名称:linux,代码行数:15,
示例21: buffer_preparestatic int buffer_prepare(struct vb2_buffer *vb){ struct vb2_queue *vq = vb->vb2_queue; struct fimc_ctx *ctx = vq->drv_priv; struct v4l2_device *v4l2_dev = &ctx->fimc_dev->m2m.v4l2_dev; int i; if (!ctx->d_frame.fmt || vq->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) return -EINVAL; for (i = 0; i < ctx->d_frame.fmt->memplanes; i++) { unsigned long size = get_plane_size(&ctx->d_frame, i); if (vb2_plane_size(vb, i) < size) { v4l2_err(v4l2_dev, "User buffer too small (%ld < %ld)/n", vb2_plane_size(vb, i), size); return -EINVAL; } vb2_set_plane_payload(vb, i, size); } return 0;}
开发者ID:jerem,项目名称:hi35xx-buildroot,代码行数:24,
示例22: enc_pre_seq_startstatic int enc_pre_seq_start(struct s5p_mfc_ctx *ctx){ struct s5p_mfc_dev *dev = ctx->dev; struct s5p_mfc_buf *dst_mb; unsigned long dst_addr; unsigned int dst_size; unsigned long flags; spin_lock_irqsave(&dev->irqlock, flags); dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); dst_addr = vb2_dma_contig_plane_dma_addr(dst_mb->b, 0); dst_size = vb2_plane_size(dst_mb->b, 0); s5p_mfc_set_enc_stream_buffer(ctx, dst_addr, dst_size); spin_unlock_irqrestore(&dev->irqlock, flags); return 0;}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:16,
示例23: histo_buffer_preparestatic int histo_buffer_prepare(struct vb2_buffer *vb){ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct vsp1_histogram *histo = vb2_get_drv_priv(vb->vb2_queue); struct vsp1_histogram_buffer *buf = to_vsp1_histogram_buffer(vbuf); if (vb->num_planes != 1) return -EINVAL; if (vb2_plane_size(vb, 0) < histo->data_size) return -EINVAL; buf->addr = vb2_plane_vaddr(vb, 0); return 0;}
开发者ID:Lyude,项目名称:linux,代码行数:16,
示例24: vc_out_buffer_prepareint vc_out_buffer_prepare( struct vb2_buffer * vb ){ unsigned long size; struct vc_device * dev; dev = vb2_get_drv_priv( vb->vb2_queue ); size = dev->output_format.sizeimage; if( vb2_plane_size(vb,0) < size ){ PRINT_ERROR( KERN_ERR "data will not fit into buffer/n" ); return -EINVAL; } vb2_set_plane_payload(vb,0,size); return 0;}
开发者ID:jsebechlebsky,项目名称:vcdev,代码行数:16,
示例25: video_buf_preparestatic int video_buf_prepare(struct vb2_buffer *vb){ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); struct camss_video *video = vb2_get_drv_priv(vb->vb2_queue); const struct v4l2_pix_format_mplane *format = &video->active_fmt.fmt.pix_mp; unsigned int i; for (i = 0; i < format->num_planes; i++) { if (format->plane_fmt[i].sizeimage > vb2_plane_size(vb, i)) return -EINVAL; vb2_set_plane_payload(vb, i, format->plane_fmt[i].sizeimage); } vbuf->field = V4L2_FIELD_NONE; return 0;}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:19,
示例26: buffer_queuestatic void buffer_queue(struct vb2_buffer *vb){ unsigned long flags; struct smi2021 *smi2021 = vb2_get_drv_priv(vb->vb2_queue);#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) struct smi2021_buf *buf = container_of(vb, struct smi2021_buf, vb);#else struct smi2021_buf *buf = container_of(vb, struct smi2021_buf, vb.vb2_buf);#endif spin_lock_irqsave(&smi2021->buf_lock, flags); if (!smi2021->udev) { /* * If the device is disconnected return the buffer to userspace * directly. The next QBUF call will fail with -ENODEV. */#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);#else vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);#endif } else { buf->mem = vb2_plane_vaddr(vb, 0); buf->length = vb2_plane_size(vb, 0); buf->pos = 0; buf->in_blank = true; buf->odd = false; /* * If the buffer length is less than expected, * we return the buffer back to userspace */ if (buf->length < SMI2021_BYTES_PER_LINE * smi2021->cur_height)#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);#else vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);#endif else list_add_tail(&buf->list, &smi2021->avail_bufs); }
开发者ID:kylemanna,项目名称:smi2021,代码行数:41,
示例27: iss_video_buf_preparestatic int iss_video_buf_prepare(struct vb2_buffer *vb){ struct iss_video_fh *vfh = vb2_get_drv_priv(vb->vb2_queue); struct iss_buffer *buffer = container_of(vb, struct iss_buffer, vb); struct iss_video *video = vfh->video; unsigned long size = vfh->format.fmt.pix.sizeimage; dma_addr_t addr; if (vb2_plane_size(vb, 0) < size) return -ENOBUFS; addr = vb2_dma_contig_plane_dma_addr(vb, 0); if (!IS_ALIGNED(addr, 32)) { dev_dbg(video->iss->dev, "Buffer address must be aligned to 32 bytes boundary./n"); return -EINVAL; } vb2_set_plane_payload(vb, 0, size); buffer->iss_addr = addr; return 0;}
开发者ID:AkyZero,项目名称:wrapfs-latest,代码行数:22,
注:本文中的vb2_plane_size函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vb2_queue_init函数代码示例 C++ vb2_is_busy函数代码示例 |