MLK-22647: VPU Decoder: make sure clear b_firstseq before send source
authorming_qian <ming.qian@nxp.com>
Fri, 20 Sep 2019 02:22:42 +0000 (10:22 +0800)
committerShijie Qin <shijie.qin@nxp.com>
Thu, 24 Oct 2019 10:55:38 +0000 (18:55 +0800)
change event

If b_firstseq is cleared after sending source change event,
user may get invalid frame size.

Signed-off-by: ming_qian <ming.qian@nxp.com>
Reviewed-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
(cherry picked from commit 6794c08937d4b9b1f8509935ebaeb1072af0b4aa)

drivers/mxc/vpu_malone/vpu_b0.c

index 0766ad7..a66dfbc 100644 (file)
@@ -4294,9 +4294,9 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
                if (check_res_is_changed(ctx, &info))
                        ctx->res_change_occu_count++;
                memcpy(&ctx->seqinfo, &info, sizeof(MediaIPFW_Video_SeqInfo));
+               calculate_frame_size(ctx);
                up(&ctx->q_data[V4L2_DST].drv_q_lock);
 
-               calculate_frame_size(ctx);
                parse_frame_interval_from_seqinfo(ctx, &ctx->seqinfo);
                vpu_dbg(LVL_BIT_FLOW,
                        "ctx[%d] SEQINFO GET: uHorRes:%d uVerRes:%d uHorDecodeRes:%d uVerDecodeRes:%d\n",
@@ -4322,6 +4322,7 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
                        ctx->seqinfo.uVUIPresent);
                if (ctx->b_firstseq) {
                        down(&ctx->q_data[V4L2_DST].drv_q_lock);
+                       ctx->b_firstseq = false;
                        reset_mbi_dcp_count(ctx);
                        ctx->mbi_size = get_mbi_size(&ctx->q_data[V4L2_DST]);
                        reset_frame_buffer(ctx);
@@ -4330,7 +4331,6 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
                        ctx->wait_res_change_done = true;
                        send_source_change_event(ctx);
                        pStreamPitchInfo->uFramePitch = 0x4000;
-                       ctx->b_firstseq = false;
                        vpu_calculate_performance(ctx, uEvent, "seq_hdr_found");
                }
                }
@@ -5399,7 +5399,7 @@ static ssize_t show_instance_buffer_info(struct device *dev,
                        stream_length,
                        ctx->stream_buffer.dma_size);
        num += scnprintf(buf + num, PAGE_SIZE - num,
-                       "\t%40s:%16d\n", "decode dealy frame",
+                       "\t%40s:%16d\n", "decode delay frame",
                        ctx->frm_dec_delay);
        num += scnprintf(buf + num, PAGE_SIZE - num,
                        "\t%40s:%16d\n", "display delay frame",