当前位置: 首页>>代码示例>>C++>>正文


C++ ctx_get_frame函数代码示例

本文整理汇总了C++中ctx_get_frame函数的典型用法代码示例。如果您正苦于以下问题:C++ ctx_get_frame函数的具体用法?C++ ctx_get_frame怎么用?C++ ctx_get_frame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ctx_get_frame函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: bdisp_queue_setup

static int bdisp_queue_setup(struct vb2_queue *vq,
			     const struct v4l2_format *fmt,
			     unsigned int *nb_buf, unsigned int *nb_planes,
			     unsigned int sizes[], void *allocators[])
{
	struct bdisp_ctx *ctx = vb2_get_drv_priv(vq);
	struct bdisp_frame *frame = ctx_get_frame(ctx, vq->type);

	if (IS_ERR(frame)) {
		dev_err(ctx->bdisp_dev->dev, "Invalid frame (%p)\n", frame);
		return PTR_ERR(frame);
	}

	if (!frame->fmt) {
		dev_err(ctx->bdisp_dev->dev, "Invalid format\n");
		return -EINVAL;
	}

	if (fmt && fmt->fmt.pix.sizeimage < frame->sizeimage)
		return -EINVAL;

	*nb_planes = 1;
	sizes[0] = fmt ? fmt->fmt.pix.sizeimage : frame->sizeimage;
	allocators[0] = ctx->bdisp_dev->alloc_ctx;

	return 0;
}
开发者ID:Kirill2013,项目名称:kasan,代码行数:27,代码来源:bdisp-v4l2.c

示例2: rot_v4l2_g_fmt_mplane

int rot_v4l2_g_fmt_mplane(struct file *file, void *priv,
			  struct v4l2_format *f)
{
	struct rot_ctx *ctx = priv;
	struct rot_fmt *rot_fmt;
	struct rot_frame *frame;
	struct v4l2_pix_format_mplane *pixm = &f->fmt.pix_mp;
	int i;

	frame = ctx_get_frame(ctx, f->type);
	if (IS_ERR(frame))
		return PTR_ERR(frame);

	rot_fmt = frame->rot_fmt;

	pixm->width		= frame->pix_mp.width;
	pixm->height		= frame->pix_mp.height;
	pixm->pixelformat	= frame->pix_mp.pixelformat;
	pixm->field		= V4L2_FIELD_NONE;
	pixm->num_planes	= frame->rot_fmt->num_planes;
	pixm->colorspace	= 0;

	for (i = 0; i < pixm->num_planes; ++i) {
		pixm->plane_fmt[i].bytesperline = (pixm->width *
				rot_fmt->bitperpixel[i]) >> 3;
		pixm->plane_fmt[i].sizeimage = pixm->plane_fmt[i].bytesperline
				* pixm->height;

		rot_dbg("[%d] plane: bytesperline %d, sizeimage %d\n", i,
				pixm->plane_fmt[i].bytesperline,
				pixm->plane_fmt[i].sizeimage);
	}

	return 0;
}
开发者ID:danielyuan2015,项目名称:Exynos4412,代码行数:35,代码来源:rotator-core.c

示例3: bdisp_queue_setup

static int bdisp_queue_setup(struct vb2_queue *vq,
			     unsigned int *nb_buf, unsigned int *nb_planes,
			     unsigned int sizes[], struct device *alloc_devs[])
{
	struct bdisp_ctx *ctx = vb2_get_drv_priv(vq);
	struct bdisp_frame *frame = ctx_get_frame(ctx, vq->type);

	if (IS_ERR(frame)) {
		dev_err(ctx->bdisp_dev->dev, "Invalid frame (%p)\n", frame);
		return PTR_ERR(frame);
	}

	if (!frame->fmt) {
		dev_err(ctx->bdisp_dev->dev, "Invalid format\n");
		return -EINVAL;
	}

	if (*nb_planes)
		return sizes[0] < frame->sizeimage ? -EINVAL : 0;

	*nb_planes = 1;
	sizes[0] = frame->sizeimage;

	return 0;
}
开发者ID:AK101111,项目名称:linux,代码行数:25,代码来源:bdisp-v4l2.c

示例4: gsc_m2m_reqbufs

static int gsc_m2m_reqbufs(struct file *file, void *fh,
			  struct v4l2_requestbuffers *reqbufs)
{
	struct gsc_ctx *ctx = fh_to_ctx(fh);
	struct gsc_dev *gsc = ctx->gsc_dev;
	struct gsc_frame *frame;
	u32 max_cnt;

	max_cnt = (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) ?
		gsc->variant->in_buf_cnt : gsc->variant->out_buf_cnt;

	if (reqbufs->count > max_cnt)
		return -EINVAL;
	else if (reqbufs->count == 0) {
		if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
			gsc_ctx_state_lock_clear(GSC_SRC_FMT, ctx);
		else
			gsc_ctx_state_lock_clear(GSC_DST_FMT, ctx);
	}

	gsc_set_protected_content(gsc, ctx->gsc_ctrls.drm_en->cur.val);

	frame = ctx_get_frame(ctx, reqbufs->type);
	frame->cacheable = ctx->gsc_ctrls.cacheable->val;
	gsc->vb2->set_cacheable(gsc->alloc_ctx, frame->cacheable);

	return v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
}
开发者ID:awehoky,项目名称:Googy-Max-N4-Kernel,代码行数:28,代码来源:gsc-m2m.c

示例5: fimc_queue_setup

static int fimc_queue_setup(struct vb2_queue *vq, const struct v4l2_format *fmt,
                            unsigned int *num_buffers, unsigned int *num_planes,
                            unsigned int sizes[], void *allocators[])
{
    struct fimc_ctx *ctx = vb2_get_drv_priv(vq);
    struct fimc_frame *f;
    int i;

    f = ctx_get_frame(ctx, vq->type);
    if (IS_ERR(f))
        return PTR_ERR(f);
    /*
     * Return number of non-contigous planes (plane buffers)
     * depending on the configured color format.
     */
    if (!f->fmt)
        return -EINVAL;

    *num_planes = f->fmt->memplanes;
    for (i = 0; i < f->fmt->memplanes; i++) {
        sizes[i] = (f->f_width * f->f_height * f->fmt->depth[i]) / 8;
        allocators[i] = ctx->fimc_dev->alloc_ctx;
    }
    return 0;
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:25,代码来源:fimc-m2m.c

示例6: gsc_g_fmt_mplane

int gsc_g_fmt_mplane(struct gsc_ctx *ctx, struct v4l2_format *f)
{
	struct gsc_frame *frame;
	struct v4l2_pix_format_mplane *pix_mp;
	int i;

	frame = ctx_get_frame(ctx, f->type);
	if (IS_ERR(frame))
		return PTR_ERR(frame);

	pix_mp = &f->fmt.pix_mp;

	pix_mp->width		= frame->f_width;
	pix_mp->height		= frame->f_height;
	pix_mp->field		= V4L2_FIELD_NONE;
	pix_mp->pixelformat	= frame->fmt->pixelformat;
	pix_mp->num_planes	= frame->fmt->num_planes;
	pix_mp->colorspace = ctx->out_colorspace;

	for (i = 0; i < pix_mp->num_planes; ++i) {
		pix_mp->plane_fmt[i].bytesperline = (frame->f_width *
			frame->fmt->depth[i]) / 8;
		pix_mp->plane_fmt[i].sizeimage =
			 pix_mp->plane_fmt[i].bytesperline * frame->f_height;
	}

	return 0;
}
开发者ID:ezequielgarcia,项目名称:linux,代码行数:28,代码来源:gsc-core.c

示例7: jpeg_enc_vidioc_s_fmt_out

static int jpeg_enc_vidioc_s_fmt_out(struct file *file, void *priv,
			struct v4l2_format *f)
{
	struct jpeg_ctx *ctx = priv;
	struct vb2_queue *vq;
	struct v4l2_pix_format_mplane *pix;
	struct jpeg_fmt *fmt;
	struct jpeg_frame *frame;
	int ret;
	int i;

	ret = jpeg_enc_vidioc_try_fmt(file, priv, f);
	if (ret)
		return ret;

	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
	if (!vq)
		return -EINVAL;

	if (vb2_is_busy(vq)) {
		v4l2_err(&ctx->jpeg_dev->v4l2_dev, "queue (%d) busy\n", f->type);
		return -EBUSY;
	}

	/* TODO: width & height has to be multiple of two */
	pix = &f->fmt.pix_mp;
	fmt = find_format(f);

	frame = ctx_get_frame(ctx, f->type);
	if (IS_ERR(frame))
		return PTR_ERR(frame);

	frame->jpeg_fmt = fmt;
	if (!frame->jpeg_fmt) {
		v4l2_err(&ctx->jpeg_dev->v4l2_dev,
				"not supported format values\n");
		return -EINVAL;
	}

	for (i = 0; i < fmt->memplanes; i++) {
		ctx->payload[i] =
			pix->plane_fmt[i].bytesperline * pix->height;
		ctx->param.enc_param.in_depth[i] = fmt->depth[i];
	}

	frame->width = pix->width;
	frame->height = pix->height;
	frame->pixelformat = pix->pixelformat;

	ctx->param.enc_param.in_width = pix->width;
	ctx->param.enc_param.in_height = pix->height;
	ctx->param.enc_param.in_plane = fmt->memplanes;
	ctx->param.enc_param.in_fmt = fmt->color;

	return 0;
}
开发者ID:cm-3470,项目名称:android_kernel_samsung_degaslte,代码行数:56,代码来源:jpeg_hx_enc.c

示例8: fimc_m2m_g_fmt_mplane

static int fimc_m2m_g_fmt_mplane(struct file *file, void *fh,
				 struct v4l2_format *f)
{
	struct fimc_ctx *ctx = fh_to_ctx(fh);
	struct fimc_frame *frame = ctx_get_frame(ctx, f->type);

	if (IS_ERR(frame))
		return PTR_ERR(frame);

	return fimc_fill_format(frame, f);
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:11,代码来源:fimc-m2m.c

示例9: gsc_g_crop

int gsc_g_crop(struct gsc_ctx *ctx, struct v4l2_crop *cr)
{
	struct gsc_frame *frame;

	frame = ctx_get_frame(ctx, cr->type);
	if (IS_ERR(frame))
		return PTR_ERR(frame);

	memcpy(&cr->c, &frame->crop, sizeof(struct v4l2_rect));

	return 0;
}
开发者ID:ArthySundaram,项目名称:chromeos-kvm,代码行数:12,代码来源:gsc-core.c

示例10: gsc_g_crop

int gsc_g_crop(struct gsc_ctx *ctx, struct v4l2_crop *cr)
{
	struct gsc_frame *frame;

	frame = ctx_get_frame(ctx, cr->type);
	if (IS_ERR(frame))
		return PTR_ERR(frame);

	cr->c = frame->crop;

	return 0;
}
开发者ID:ezequielgarcia,项目名称:linux,代码行数:12,代码来源:gsc-core.c

示例11: rot_v4l2_g_crop

static int rot_v4l2_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
{
	struct rot_ctx *ctx = fh;
	struct rot_frame *frame;

	frame = ctx_get_frame(ctx, cr->type);
	if (IS_ERR(frame))
		return PTR_ERR(frame);

	cr->c = frame->crop;

	return 0;
}
开发者ID:danielyuan2015,项目名称:Exynos4412,代码行数:13,代码来源:rotator-core.c

示例12: rot_v4l2_s_fmt_mplane

static int rot_v4l2_s_fmt_mplane(struct file *file, void *priv,
				 struct v4l2_format *f)
{
	struct rot_ctx *ctx = priv;
	struct vb2_queue *vq;
	struct rot_frame *frame;
	struct v4l2_pix_format_mplane *pixm = &f->fmt.pix_mp;
	int i, ret = 0;

	vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);

	if (vb2_is_streaming(vq)) {
		rot_err("device is busy\n");
		return -EBUSY;
	}

	ret = rot_v4l2_try_fmt_mplane(file, priv, f);
	if (ret < 0)
		return ret;

	frame = ctx_get_frame(ctx, f->type);
	if (IS_ERR(frame))
		return PTR_ERR(frame);

	set_bit(CTX_PARAMS, &ctx->flags);

	frame->rot_fmt = rot_find_format(f);
	if (!frame->rot_fmt) {
		rot_err("not supported format values\n");
		return -EINVAL;
	}

	rot_adjust_pixminfo(ctx, frame, pixm);

	frame->pix_mp.pixelformat = pixm->pixelformat;
	frame->pix_mp.width	= pixm->width;
	frame->pix_mp.height	= pixm->height;

	/*
	 * Shouldn't call s_crop or g_crop before called g_fmt or s_fmt.
	 * Let's assume that we can keep the order.
	 */
	frame->crop.width	= pixm->width;
	frame->crop.height	= pixm->height;

	for (i = 0; i < frame->rot_fmt->num_planes; ++i)
		frame->bytesused[i] = (pixm->width * pixm->height *
				frame->rot_fmt->bitperpixel[i]) >> 3;

	return 0;
}
开发者ID:danielyuan2015,项目名称:Exynos4412,代码行数:51,代码来源:rotator-core.c

示例13: bdisp_buf_prepare

static int bdisp_buf_prepare(struct vb2_buffer *vb)
{
	struct bdisp_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
	struct bdisp_frame *frame = ctx_get_frame(ctx, vb->vb2_queue->type);

	if (IS_ERR(frame)) {
		dev_err(ctx->bdisp_dev->dev, "Invalid frame (%p)\n", frame);
		return PTR_ERR(frame);
	}

	if (vb->vb2_queue->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
		vb2_set_plane_payload(vb, 0, frame->sizeimage);

	return 0;
}
开发者ID:AK101111,项目名称:linux,代码行数:15,代码来源:bdisp-v4l2.c

示例14: fimc_buf_prepare

static int fimc_buf_prepare(struct vb2_buffer *vb)
{
    struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
    struct fimc_frame *frame;
    int i;

    frame = ctx_get_frame(ctx, vb->vb2_queue->type);
    if (IS_ERR(frame))
        return PTR_ERR(frame);

    for (i = 0; i < frame->fmt->memplanes; i++)
        vb2_set_plane_payload(vb, i, frame->payload[i]);

    return 0;
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:15,代码来源:fimc-m2m.c

示例15: fimc_m2m_g_crop

static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
{
    struct fimc_ctx *ctx = fh_to_ctx(fh);
    struct fimc_frame *frame;

    frame = ctx_get_frame(ctx, cr->type);
    if (IS_ERR(frame))
        return PTR_ERR(frame);

    cr->c.left = frame->offs_h;
    cr->c.top = frame->offs_v;
    cr->c.width = frame->width;
    cr->c.height = frame->height;

    return 0;
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:16,代码来源:fimc-m2m.c


注:本文中的ctx_get_frame函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。