1 // SPDX-License-Identifier: GPL-2.0
3 #include <media/v4l2-event.h>
4 #include <media/v4l2-mem2mem.h>
5 #include <media/videobuf2-dma-contig.h>
7 #include "mtk_vcodec_drv.h"
8 #include "mtk_vcodec_dec.h"
9 #include "mtk_vcodec_intr.h"
10 #include "mtk_vcodec_util.h"
11 #include "mtk_vcodec_dec_pm.h"
12 #include "vdec_drv_if.h"
14 static const struct mtk_video_fmt mtk_video_formats[] = {
16 .fourcc = V4L2_PIX_FMT_H264,
19 .flags = V4L2_FMT_FLAG_DYN_RESOLUTION,
22 .fourcc = V4L2_PIX_FMT_VP8,
25 .flags = V4L2_FMT_FLAG_DYN_RESOLUTION,
28 .fourcc = V4L2_PIX_FMT_VP9,
31 .flags = V4L2_FMT_FLAG_DYN_RESOLUTION,
34 .fourcc = V4L2_PIX_FMT_MT21C,
35 .type = MTK_FMT_FRAME,
40 static const unsigned int num_supported_formats =
41 ARRAY_SIZE(mtk_video_formats);
43 #define DEFAULT_OUT_FMT_IDX 0
44 #define DEFAULT_CAP_FMT_IDX 3
46 static const struct mtk_codec_framesizes mtk_vdec_framesizes[] = {
48 .fourcc = V4L2_PIX_FMT_H264,
49 .stepwise = { MTK_VDEC_MIN_W, MTK_VDEC_MAX_W, 16,
50 MTK_VDEC_MIN_H, MTK_VDEC_MAX_H, 16 },
53 .fourcc = V4L2_PIX_FMT_VP8,
54 .stepwise = { MTK_VDEC_MIN_W, MTK_VDEC_MAX_W, 16,
55 MTK_VDEC_MIN_H, MTK_VDEC_MAX_H, 16 },
58 .fourcc = V4L2_PIX_FMT_VP9,
59 .stepwise = { MTK_VDEC_MIN_W, MTK_VDEC_MAX_W, 16,
60 MTK_VDEC_MIN_H, MTK_VDEC_MAX_H, 16 },
64 static const unsigned int num_supported_framesize =
65 ARRAY_SIZE(mtk_vdec_framesizes);
68 * This function tries to clean all display buffers, the buffers will return
70 * Note the buffers returned from codec driver may still be in driver's
73 static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx)
75 struct vdec_fb *disp_frame_buffer = NULL;
76 struct mtk_video_dec_buf *dstbuf;
77 struct vb2_v4l2_buffer *vb;
79 mtk_v4l2_debug(3, "[%d]", ctx->id);
80 if (vdec_if_get_param(ctx, GET_PARAM_DISP_FRAME_BUFFER,
81 &disp_frame_buffer)) {
82 mtk_v4l2_err("[%d]Cannot get param : GET_PARAM_DISP_FRAME_BUFFER", ctx->id);
86 if (!disp_frame_buffer) {
87 mtk_v4l2_debug(3, "No display frame buffer");
91 dstbuf = container_of(disp_frame_buffer, struct mtk_video_dec_buf,
93 vb = &dstbuf->m2m_buf.vb;
94 mutex_lock(&ctx->lock);
96 mtk_v4l2_debug(2, "[%d]status=%x queue id=%d to done_list %d",
97 ctx->id, disp_frame_buffer->status,
98 vb->vb2_buf.index, dstbuf->queued_in_vb2);
100 v4l2_m2m_buf_done(vb, VB2_BUF_STATE_DONE);
101 ctx->decoded_frame_cnt++;
103 mutex_unlock(&ctx->lock);
108 * This function tries to clean all capture buffers that are not used as
109 * reference buffers by codec driver any more
110 * In this case, we need re-queue buffer to vb2 buffer if user space
111 * already returns this buffer to v4l2 or this buffer is just the output of
112 * previous sps/pps/resolution change decode, or do nothing if user
113 * space still owns this buffer
115 static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx)
117 struct mtk_video_dec_buf *dstbuf;
118 struct vdec_fb *free_frame_buffer = NULL;
119 struct vb2_v4l2_buffer *vb;
121 if (vdec_if_get_param(ctx, GET_PARAM_FREE_FRAME_BUFFER,
122 &free_frame_buffer)) {
123 mtk_v4l2_err("[%d] Error!! Cannot get param", ctx->id);
126 if (!free_frame_buffer) {
127 mtk_v4l2_debug(3, " No free frame buffer");
131 mtk_v4l2_debug(3, "[%d] tmp_frame_addr = 0x%p", ctx->id,
134 dstbuf = container_of(free_frame_buffer, struct mtk_video_dec_buf,
136 vb = &dstbuf->m2m_buf.vb;
138 mutex_lock(&ctx->lock);
140 if (dstbuf->queued_in_vb2 && dstbuf->queued_in_v4l2 &&
141 free_frame_buffer->status == FB_ST_FREE) {
143 * After decode sps/pps or non-display buffer, we don't
144 * need to return capture buffer to user space, but
145 * just re-queue this capture buffer to vb2 queue.
146 * This reduce overheads that dq/q unused capture
147 * buffer. In this case, queued_in_vb2 = true.
149 mtk_v4l2_debug(2, "[%d]status=%x queue id=%d to rdy_queue %d",
150 ctx->id, free_frame_buffer->status,
151 vb->vb2_buf.index, dstbuf->queued_in_vb2);
152 v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
153 } else if (!dstbuf->queued_in_vb2 && dstbuf->queued_in_v4l2) {
155 * If buffer in v4l2 driver but not in vb2 queue yet,
156 * and we get this buffer from free_list, it means
157 * that codec driver do not use this buffer as
158 * reference buffer anymore. We should q buffer to vb2
159 * queue, so later work thread could get this buffer
160 * for decode. In this case, queued_in_vb2 = false
161 * means this buffer is not from previous decode
165 "[%d]status=%x queue id=%d to rdy_queue",
166 ctx->id, free_frame_buffer->status,
168 v4l2_m2m_buf_queue(ctx->m2m_ctx, vb);
169 dstbuf->queued_in_vb2 = true;
172 * Codec driver do not need to reference this capture
173 * buffer and this buffer is not in v4l2 driver.
174 * Then we don't need to do any thing, just add log when
175 * we need to debug buffer flow.
176 * When this buffer q from user space, it could
177 * directly q to vb2 buffer
179 mtk_v4l2_debug(3, "[%d]status=%x err queue id=%d %d %d",
180 ctx->id, free_frame_buffer->status,
181 vb->vb2_buf.index, dstbuf->queued_in_vb2,
182 dstbuf->queued_in_v4l2);
184 dstbuf->used = false;
186 mutex_unlock(&ctx->lock);
190 static void clean_display_buffer(struct mtk_vcodec_ctx *ctx)
192 while (get_display_buffer(ctx))
196 static void clean_free_buffer(struct mtk_vcodec_ctx *ctx)
198 while (get_free_buffer(ctx))
202 static void mtk_vdec_queue_res_chg_event(struct mtk_vcodec_ctx *ctx)
204 static const struct v4l2_event ev_src_ch = {
205 .type = V4L2_EVENT_SOURCE_CHANGE,
206 .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION,
209 mtk_v4l2_debug(1, "[%d]", ctx->id);
210 v4l2_event_queue_fh(&ctx->fh, &ev_src_ch);
213 static int mtk_vdec_flush_decoder(struct mtk_vcodec_ctx *ctx)
218 ret = vdec_if_decode(ctx, NULL, NULL, &res_chg);
220 mtk_v4l2_err("DecodeFinal failed, ret=%d", ret);
222 clean_display_buffer(ctx);
223 clean_free_buffer(ctx);
228 static void mtk_vdec_update_fmt(struct mtk_vcodec_ctx *ctx,
229 unsigned int pixelformat)
231 const struct mtk_video_fmt *fmt;
232 struct mtk_q_data *dst_q_data;
235 dst_q_data = &ctx->q_data[MTK_Q_DATA_DST];
236 for (k = 0; k < num_supported_formats; k++) {
237 fmt = &mtk_video_formats[k];
238 if (fmt->fourcc == pixelformat) {
239 mtk_v4l2_debug(1, "Update cap fourcc(%d -> %d)",
240 dst_q_data->fmt->fourcc, pixelformat);
241 dst_q_data->fmt = fmt;
246 mtk_v4l2_err("Cannot get fourcc(%d), using init value", pixelformat);
249 static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx)
251 unsigned int dpbsize = 0;
254 if (vdec_if_get_param(ctx, GET_PARAM_PIC_INFO,
255 &ctx->last_decoded_picinfo)) {
256 mtk_v4l2_err("[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR", ctx->id);
260 if (ctx->last_decoded_picinfo.pic_w == 0 ||
261 ctx->last_decoded_picinfo.pic_h == 0 ||
262 ctx->last_decoded_picinfo.buf_w == 0 ||
263 ctx->last_decoded_picinfo.buf_h == 0) {
264 mtk_v4l2_err("Cannot get correct pic info");
268 if (ctx->last_decoded_picinfo.cap_fourcc != ctx->picinfo.cap_fourcc &&
269 ctx->picinfo.cap_fourcc != 0)
270 mtk_vdec_update_fmt(ctx, ctx->picinfo.cap_fourcc);
272 if (ctx->last_decoded_picinfo.pic_w == ctx->picinfo.pic_w ||
273 ctx->last_decoded_picinfo.pic_h == ctx->picinfo.pic_h)
276 mtk_v4l2_debug(1, "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)", ctx->id,
277 ctx->last_decoded_picinfo.pic_w,
278 ctx->last_decoded_picinfo.pic_h, ctx->picinfo.pic_w,
279 ctx->picinfo.pic_h, ctx->last_decoded_picinfo.buf_w,
280 ctx->last_decoded_picinfo.buf_h);
282 ret = vdec_if_get_param(ctx, GET_PARAM_DPB_SIZE, &dpbsize);
284 mtk_v4l2_err("Incorrect dpb size, ret=%d", ret);
286 ctx->dpb_size = dpbsize;
291 static void mtk_vdec_worker(struct work_struct *work)
293 struct mtk_vcodec_ctx *ctx =
294 container_of(work, struct mtk_vcodec_ctx, decode_work);
295 struct mtk_vcodec_dev *dev = ctx->dev;
296 struct vb2_v4l2_buffer *src_buf, *dst_buf;
297 struct mtk_vcodec_mem buf;
299 bool res_chg = false;
301 struct mtk_video_dec_buf *dst_buf_info, *src_buf_info;
303 src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
305 v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx);
306 mtk_v4l2_debug(1, "[%d] src_buf empty!!", ctx->id);
310 dst_buf = v4l2_m2m_next_dst_buf(ctx->m2m_ctx);
312 v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx);
313 mtk_v4l2_debug(1, "[%d] dst_buf empty!!", ctx->id);
318 container_of(dst_buf, struct mtk_video_dec_buf, m2m_buf.vb);
320 pfb = &dst_buf_info->frame_buffer;
321 pfb->base_y.va = vb2_plane_vaddr(&dst_buf->vb2_buf, 0);
322 pfb->base_y.dma_addr =
323 vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
324 pfb->base_y.size = ctx->picinfo.fb_sz[0];
326 pfb->base_c.va = vb2_plane_vaddr(&dst_buf->vb2_buf, 1);
327 pfb->base_c.dma_addr =
328 vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 1);
329 pfb->base_c.size = ctx->picinfo.fb_sz[1];
331 mtk_v4l2_debug(3, "===>[%d] vdec_if_decode() ===>", ctx->id);
334 "id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx",
335 dst_buf->vb2_buf.index, pfb, pfb->base_y.va,
336 &pfb->base_y.dma_addr, &pfb->base_c.dma_addr, pfb->base_y.size);
338 if (src_buf == &ctx->empty_flush_buf.vb) {
339 mtk_v4l2_debug(1, "Got empty flush input buffer.");
340 src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
342 /* update dst buf status */
343 dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
344 mutex_lock(&ctx->lock);
345 dst_buf_info->used = false;
346 mutex_unlock(&ctx->lock);
348 vdec_if_decode(ctx, NULL, NULL, &res_chg);
349 clean_display_buffer(ctx);
350 vb2_set_plane_payload(&dst_buf->vb2_buf, 0, 0);
351 if (ctx->q_data[MTK_Q_DATA_DST].fmt->num_planes == 2)
352 vb2_set_plane_payload(&dst_buf->vb2_buf, 1, 0);
353 dst_buf->flags |= V4L2_BUF_FLAG_LAST;
354 v4l2_m2m_buf_done(dst_buf, VB2_BUF_STATE_DONE);
355 clean_free_buffer(ctx);
356 v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx);
361 container_of(src_buf, struct mtk_video_dec_buf, m2m_buf.vb);
363 buf.va = vb2_plane_vaddr(&src_buf->vb2_buf, 0);
364 buf.dma_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
365 buf.size = (size_t)src_buf->vb2_buf.planes[0].bytesused;
367 v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx);
368 mtk_v4l2_err("[%d] id=%d src_addr is NULL!!", ctx->id,
369 src_buf->vb2_buf.index);
372 mtk_v4l2_debug(3, "[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p",
373 ctx->id, buf.va, &buf.dma_addr, buf.size, src_buf);
374 dst_buf->vb2_buf.timestamp = src_buf->vb2_buf.timestamp;
375 dst_buf->timecode = src_buf->timecode;
376 mutex_lock(&ctx->lock);
377 dst_buf_info->used = true;
378 mutex_unlock(&ctx->lock);
379 src_buf_info->used = true;
381 ret = vdec_if_decode(ctx, &buf, pfb, &res_chg);
384 mtk_v4l2_err(" <===[%d], src_buf[%d] sz=0x%zx pts=%llu dst_buf[%d] vdec_if_decode() ret=%d res_chg=%d===>",
385 ctx->id, src_buf->vb2_buf.index, buf.size,
386 src_buf->vb2_buf.timestamp, dst_buf->vb2_buf.index, ret, res_chg);
387 src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
389 mutex_lock(&ctx->lock);
390 src_buf_info->error = true;
391 mutex_unlock(&ctx->lock);
393 v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR);
394 } else if (!res_chg) {
396 * we only return src buffer with VB2_BUF_STATE_DONE
397 * when decode success without resolution change
399 src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
400 v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
403 dst_buf = v4l2_m2m_dst_buf_remove(ctx->m2m_ctx);
404 clean_display_buffer(ctx);
405 clean_free_buffer(ctx);
407 if (!ret && res_chg) {
408 mtk_vdec_pic_info_update(ctx);
410 * On encountering a resolution change in the stream.
411 * The driver must first process and decode all
412 * remaining buffers from before the resolution change
413 * point, so call flush decode here
415 mtk_vdec_flush_decoder(ctx);
417 * After all buffers containing decoded frames from
418 * before the resolution change point ready to be
419 * dequeued on the CAPTURE queue, the driver sends a
420 * V4L2_EVENT_SOURCE_CHANGE event for source change
421 * type V4L2_EVENT_SRC_CH_RESOLUTION
423 mtk_vdec_queue_res_chg_event(ctx);
425 v4l2_m2m_job_finish(dev->m2m_dev_dec, ctx->m2m_ctx);
428 static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)
430 struct vb2_v4l2_buffer *src_buf;
431 struct mtk_vcodec_mem src_mem;
432 bool res_chg = false;
434 unsigned int dpbsize = 1, i;
435 struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
436 struct vb2_v4l2_buffer *vb2_v4l2;
437 struct mtk_q_data *dst_q_data;
439 mtk_v4l2_debug(3, "[%d] (%d) id=%d, vb=%p", ctx->id,
440 vb->vb2_queue->type, vb->index, vb);
442 * check if this buffer is ready to be used after decode
444 if (vb->vb2_queue->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
445 struct mtk_video_dec_buf *buf;
447 vb2_v4l2 = to_vb2_v4l2_buffer(vb);
448 buf = container_of(vb2_v4l2, struct mtk_video_dec_buf,
450 mutex_lock(&ctx->lock);
452 v4l2_m2m_buf_queue(ctx->m2m_ctx, vb2_v4l2);
453 buf->queued_in_vb2 = true;
454 buf->queued_in_v4l2 = true;
456 buf->queued_in_vb2 = false;
457 buf->queued_in_v4l2 = true;
459 mutex_unlock(&ctx->lock);
463 v4l2_m2m_buf_queue(ctx->m2m_ctx, to_vb2_v4l2_buffer(vb));
465 if (ctx->state != MTK_STATE_INIT) {
466 mtk_v4l2_debug(3, "[%d] already init driver %d", ctx->id,
471 src_buf = v4l2_m2m_next_src_buf(ctx->m2m_ctx);
473 mtk_v4l2_err("No src buffer");
477 if (src_buf == &ctx->empty_flush_buf.vb) {
478 /* This shouldn't happen. Just in case. */
479 mtk_v4l2_err("Invalid flush buffer.");
480 v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
484 src_mem.va = vb2_plane_vaddr(&src_buf->vb2_buf, 0);
485 src_mem.dma_addr = vb2_dma_contig_plane_dma_addr(&src_buf->vb2_buf, 0);
486 src_mem.size = (size_t)src_buf->vb2_buf.planes[0].bytesused;
487 mtk_v4l2_debug(2, "[%d] buf id=%d va=%p dma=%pad size=%zx", ctx->id,
488 src_buf->vb2_buf.index, src_mem.va, &src_mem.dma_addr,
491 ret = vdec_if_decode(ctx, &src_mem, NULL, &res_chg);
492 if (ret || !res_chg) {
494 * fb == NULL means to parse SPS/PPS header or
495 * resolution info in src_mem. Decode can fail
496 * if there is no SPS header or picture info
500 src_buf = v4l2_m2m_src_buf_remove(ctx->m2m_ctx);
502 mtk_v4l2_err("[%d] Unrecoverable error in vdec_if_decode.", ctx->id);
503 ctx->state = MTK_STATE_ABORT;
504 v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR);
506 v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
508 mtk_v4l2_debug(ret ? 0 : 1,
509 "[%d] vdec_if_decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d",
510 ctx->id, src_buf->vb2_buf.index, src_mem.size, ret, res_chg);
514 if (vdec_if_get_param(ctx, GET_PARAM_PIC_INFO, &ctx->picinfo)) {
515 mtk_v4l2_err("[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR", ctx->id);
519 ctx->last_decoded_picinfo = ctx->picinfo;
520 dst_q_data = &ctx->q_data[MTK_Q_DATA_DST];
521 for (i = 0; i < dst_q_data->fmt->num_planes; i++) {
522 dst_q_data->sizeimage[i] = ctx->picinfo.fb_sz[i];
523 dst_q_data->bytesperline[i] = ctx->picinfo.buf_w;
526 mtk_v4l2_debug(2, "[%d] vdec_if_init() OK wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x",
527 ctx->id, ctx->picinfo.buf_w, ctx->picinfo.buf_h, ctx->picinfo.pic_w,
528 ctx->picinfo.pic_h, dst_q_data->sizeimage[0], dst_q_data->sizeimage[1]);
530 ret = vdec_if_get_param(ctx, GET_PARAM_DPB_SIZE, &dpbsize);
532 mtk_v4l2_err("[%d] GET_PARAM_DPB_SIZE fail=%d", ctx->id, ret);
534 ctx->dpb_size = dpbsize;
535 ctx->state = MTK_STATE_HEADER;
536 mtk_v4l2_debug(1, "[%d] dpbsize=%d", ctx->id, ctx->dpb_size);
538 mtk_vdec_queue_res_chg_event(ctx);
541 static int mtk_vdec_g_v_ctrl(struct v4l2_ctrl *ctrl)
543 struct mtk_vcodec_ctx *ctx = ctrl_to_ctx(ctrl);
547 case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
548 if (ctx->state >= MTK_STATE_HEADER) {
549 ctrl->val = ctx->dpb_size;
551 mtk_v4l2_debug(0, "Seqinfo not ready");
561 static const struct v4l2_ctrl_ops mtk_vcodec_dec_ctrl_ops = {
562 .g_volatile_ctrl = mtk_vdec_g_v_ctrl,
565 static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx)
567 struct v4l2_ctrl *ctrl;
569 v4l2_ctrl_handler_init(&ctx->ctrl_hdl, 1);
571 ctrl = v4l2_ctrl_new_std(&ctx->ctrl_hdl, &mtk_vcodec_dec_ctrl_ops,
572 V4L2_CID_MIN_BUFFERS_FOR_CAPTURE, 0, 32, 1, 1);
573 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE;
574 v4l2_ctrl_new_std_menu(&ctx->ctrl_hdl, &mtk_vcodec_dec_ctrl_ops,
575 V4L2_CID_MPEG_VIDEO_VP9_PROFILE,
576 V4L2_MPEG_VIDEO_VP9_PROFILE_0, 0,
577 V4L2_MPEG_VIDEO_VP9_PROFILE_0);
579 * H264. Baseline / Extended decoding is not supported.
581 v4l2_ctrl_new_std_menu(&ctx->ctrl_hdl, &mtk_vcodec_dec_ctrl_ops,
582 V4L2_CID_MPEG_VIDEO_H264_PROFILE, V4L2_MPEG_VIDEO_H264_PROFILE_HIGH,
583 BIT(V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE) |
584 BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED),
585 V4L2_MPEG_VIDEO_H264_PROFILE_MAIN);
587 if (ctx->ctrl_hdl.error) {
588 mtk_v4l2_err("Adding control failed %d", ctx->ctrl_hdl.error);
589 return ctx->ctrl_hdl.error;
592 v4l2_ctrl_handler_setup(&ctx->ctrl_hdl);
596 static void mtk_init_vdec_params(struct mtk_vcodec_ctx *ctx)
600 static struct vb2_ops mtk_vdec_frame_vb2_ops = {
601 .queue_setup = vb2ops_vdec_queue_setup,
602 .buf_prepare = vb2ops_vdec_buf_prepare,
603 .wait_prepare = vb2_ops_wait_prepare,
604 .wait_finish = vb2_ops_wait_finish,
605 .start_streaming = vb2ops_vdec_start_streaming,
607 .buf_queue = vb2ops_vdec_stateful_buf_queue,
608 .buf_init = vb2ops_vdec_buf_init,
609 .buf_finish = vb2ops_vdec_buf_finish,
610 .stop_streaming = vb2ops_vdec_stop_streaming,
613 const struct mtk_vcodec_dec_pdata mtk_vdec_8173_pdata = {
614 .init_vdec_params = mtk_init_vdec_params,
615 .ctrls_setup = mtk_vcodec_dec_ctrls_setup,
616 .vdec_vb2_ops = &mtk_vdec_frame_vb2_ops,
617 .vdec_formats = mtk_video_formats,
618 .num_formats = &num_supported_formats,
619 .default_out_fmt = &mtk_video_formats[DEFAULT_OUT_FMT_IDX],
620 .default_cap_fmt = &mtk_video_formats[DEFAULT_CAP_FMT_IDX],
621 .vdec_framesizes = mtk_vdec_framesizes,
622 .num_framesizes = &num_supported_framesize,
623 .worker = mtk_vdec_worker,
624 .flush_decoder = mtk_vdec_flush_decoder,
625 .is_subdev_supported = false,
626 .hw_arch = MTK_VDEC_PURE_SINGLE_CORE,