#include "hantro_hw.h"
 #include "hantro_g1_regs.h"
 #include "hantro_g2_regs.h"
+#include "hantro_v4l2.h"
 
 #define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
 { \
        struct v4l2_m2m_ctx *m2m_ctx = ctx->fh.m2m_ctx;
        struct vb2_queue *cap_queue = &m2m_ctx->cap_q_ctx.q;
        unsigned int num_buffers = cap_queue->num_buffers;
+       struct v4l2_pix_format_mplane pix_mp;
+       const struct hantro_fmt *fmt;
        unsigned int i, buf_size;
 
-       buf_size = ctx->dst_fmt.plane_fmt[0].sizeimage;
+       /* this should always pick native format */
+       fmt = hantro_get_default_fmt(ctx, false);
+       if (!fmt)
+               return -EINVAL;
+       v4l2_fill_pixfmt_mp(&pix_mp, fmt->fourcc, ctx->src_fmt.width,
+                           ctx->src_fmt.height);
+
+       buf_size = pix_mp.plane_fmt[0].sizeimage;
        if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE)
-               buf_size += hantro_h264_mv_size(ctx->dst_fmt.width,
-                                               ctx->dst_fmt.height);
+               buf_size += hantro_h264_mv_size(pix_mp.width,
+                                               pix_mp.height);
        else if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_VP9_FRAME)
-               buf_size += hantro_vp9_mv_size(ctx->dst_fmt.width,
-                                              ctx->dst_fmt.height);
+               buf_size += hantro_vp9_mv_size(pix_mp.width,
+                                              pix_mp.height);
        else if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_HEVC_SLICE)
-               buf_size += hantro_hevc_mv_size(ctx->dst_fmt.width,
-                                               ctx->dst_fmt.height);
+               buf_size += hantro_hevc_mv_size(pix_mp.width,
+                                               pix_mp.height);
 
        for (i = 0; i < num_buffers; ++i) {
                struct hantro_aux_buf *priv = &ctx->postproc.dec_q[i];