Lines Matching refs:ctx

82 mxc_isi_m2m_ctx_qdata(struct mxc_isi_m2m_ctx *ctx, enum v4l2_buf_type type)
85 return &ctx->queues.out;
87 return &ctx->queues.cap;
98 struct mxc_isi_m2m_ctx *ctx;
100 ctx = v4l2_m2m_get_curr_priv(m2m->m2m_dev);
101 if (!ctx) {
107 src_vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
108 dst_vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
112 src_vbuf->sequence = ctx->queues.out.sequence++;
113 dst_vbuf->sequence = ctx->queues.cap.sequence++;
118 v4l2_m2m_job_finish(m2m->m2m_dev, ctx->fh.m2m_ctx);
123 struct mxc_isi_m2m_ctx *ctx = priv;
124 struct mxc_isi_m2m *m2m = ctx->m2m;
133 if (m2m->last_ctx != ctx) {
135 .width = ctx->queues.out.format.width,
136 .height = ctx->queues.out.format.height,
139 .width = ctx->queues.cap.format.width,
140 .height = ctx->queues.cap.format.height,
143 .width = ctx->queues.cap.format.width,
144 .height = ctx->queues.cap.format.height,
149 ctx->queues.out.info->encoding,
150 ctx->queues.cap.info->encoding);
152 ctx->queues.out.info,
153 &ctx->queues.out.format);
155 ctx->queues.cap.info,
156 &ctx->queues.cap.format);
158 m2m->last_ctx = ctx;
163 mutex_lock(ctx->ctrls.handler.lock);
164 mxc_isi_channel_set_alpha(m2m->pipe, ctx->ctrls.alpha);
165 mxc_isi_channel_set_flip(m2m->pipe, ctx->ctrls.hflip, ctx->ctrls.vflip);
166 mutex_unlock(ctx->ctrls.handler.lock);
168 src_vbuf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
169 dst_vbuf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
197 struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(q);
199 mxc_isi_m2m_ctx_qdata(ctx, q->type);
209 struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(vb2->vb2_queue);
211 mxc_isi_m2m_ctx_qdata(ctx, vq->type);
222 struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(vq);
224 mxc_isi_m2m_ctx_qdata(ctx, vq->type);
226 return mxc_isi_video_buffer_prepare(ctx->m2m->isi, vb2, qdata->info,
233 struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(vb2->vb2_queue);
235 v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
241 struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(q);
243 mxc_isi_m2m_ctx_qdata(ctx, q->type);
252 struct mxc_isi_m2m_ctx *ctx = vb2_get_drv_priv(q);
257 vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
259 vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
281 struct mxc_isi_m2m_ctx *ctx = priv;
282 struct mxc_isi_m2m *m2m = ctx->m2m;
287 src_vq->drv_priv = ctx;
292 src_vq->lock = &ctx->vb2_lock;
301 dst_vq->drv_priv = ctx;
306 dst_vq->lock = &ctx->vb2_lock;
324 struct mxc_isi_m2m_ctx *ctx = ctrl_to_mxc_isi_m2m_ctx(ctrl);
328 ctx->ctrls.hflip = ctrl->val;
332 ctx->ctrls.vflip = ctrl->val;
336 ctx->ctrls.alpha = ctrl->val;
347 static int mxc_isi_m2m_ctx_ctrls_create(struct mxc_isi_m2m_ctx *ctx)
349 struct v4l2_ctrl_handler *handler = &ctx->ctrls.handler;
367 ctx->fh.ctrl_handler = handler;
372 static void mxc_isi_m2m_ctx_ctrls_delete(struct mxc_isi_m2m_ctx *ctx)
374 v4l2_ctrl_handler_free(&ctx->ctrls.handler);
412 __mxc_isi_m2m_try_fmt_vid(struct mxc_isi_m2m_ctx *ctx,
418 pix->width = min(pix->width, ctx->queues.out.format.width);
419 pix->height = min(pix->height, ctx->queues.out.format.height);
422 return mxc_isi_format_try(ctx->m2m->pipe, pix, type);
431 struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
433 __mxc_isi_m2m_try_fmt_vid(ctx, &f->fmt.pix_mp, type);
441 struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
443 mxc_isi_m2m_ctx_qdata(ctx, f->type);
456 struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
461 vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, f->type);
468 info = __mxc_isi_m2m_try_fmt_vid(ctx, pix, type);
471 ctx->queues.out.format = *pix;
472 ctx->queues.out.info = info;
479 ctx->queues.cap.format = *pix;
480 ctx->queues.cap.info = info;
488 struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
489 const struct v4l2_pix_format_mplane *out_pix = &ctx->queues.out.format;
490 const struct v4l2_pix_format_mplane *cap_pix = &ctx->queues.cap.format;
491 const struct mxc_isi_format_info *cap_info = ctx->queues.cap.info;
492 const struct mxc_isi_format_info *out_info = ctx->queues.out.info;
493 struct mxc_isi_m2m *m2m = ctx->m2m;
529 if (!ctx->chained && out_pix->width > MXC_ISI_MAX_WIDTH_UNCHAINED) {
535 ctx->chained = true;
553 if (ctx->chained && --m2m->chained_count == 0)
555 ctx->chained = false;
571 struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
572 struct mxc_isi_m2m *m2m = ctx->m2m;
582 if (m2m->last_ctx == ctx)
586 if (ctx->chained && --m2m->chained_count == 0)
588 ctx->chained = false;
635 static void mxc_isi_m2m_init_format(struct mxc_isi_m2m_ctx *ctx,
643 qdata->info = mxc_isi_format_try(ctx->m2m->pipe, &qdata->format, type);
650 struct mxc_isi_m2m_ctx *ctx;
653 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
654 if (!ctx)
657 ctx->m2m = m2m;
658 mutex_init(&ctx->vb2_lock);
660 v4l2_fh_init(&ctx->fh, vdev);
661 file->private_data = &ctx->fh;
663 ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(m2m->m2m_dev, ctx,
665 if (IS_ERR(ctx->fh.m2m_ctx)) {
666 ret = PTR_ERR(ctx->fh.m2m_ctx);
667 ctx->fh.m2m_ctx = NULL;
671 mxc_isi_m2m_init_format(ctx, &ctx->queues.out, MXC_ISI_VIDEO_M2M_OUT);
672 mxc_isi_m2m_init_format(ctx, &ctx->queues.cap, MXC_ISI_VIDEO_M2M_CAP);
674 ret = mxc_isi_m2m_ctx_ctrls_create(ctx);
682 v4l2_fh_add(&ctx->fh);
687 mxc_isi_m2m_ctx_ctrls_delete(ctx);
689 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
691 v4l2_fh_exit(&ctx->fh);
692 mutex_destroy(&ctx->vb2_lock);
693 kfree(ctx);
700 struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(file->private_data);
702 v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
703 mxc_isi_m2m_ctx_ctrls_delete(ctx);
705 v4l2_fh_del(&ctx->fh);
706 v4l2_fh_exit(&ctx->fh);
708 mutex_destroy(&ctx->vb2_lock);
709 kfree(ctx);