media: hantro: Add helpers to prepare/finish a run
[linux-2.6-microblaze.git] / drivers / staging / media / hantro / hantro_g1_mpeg2_dec.c
index e592c1b..80f0e94 100644 (file)
@@ -167,12 +167,11 @@ void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx)
        const struct v4l2_mpeg2_picture *picture;
        u32 reg;
 
-       src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
-       dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
+       src_buf = hantro_get_src_buf(ctx);
+       dst_buf = hantro_get_dst_buf(ctx);
 
        /* Apply request controls if any */
-       v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req,
-                               &ctx->ctrl_handler);
+       hantro_prepare_run(ctx);
 
        slice_params = hantro_get_ctrl(ctx,
                                       V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS);
@@ -248,12 +247,7 @@ void hantro_g1_mpeg2_dec_run(struct hantro_ctx *ctx)
                                        &dst_buf->vb2_buf,
                                        sequence, picture, slice_params);
 
-       /* Controls no longer in-use, we can complete them */
-       v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req,
-                                  &ctx->ctrl_handler);
-
-       /* Kick the watchdog and start decoding */
-       schedule_delayed_work(&vpu->watchdog_work, msecs_to_jiffies(2000));
+       hantro_finish_run(ctx);
 
        reg = G1_REG_DEC_E(1);
        vdpu_write(vpu, reg, G1_SWREG(1));