From 66bb02ef3ec594a573a21d0c138e87fae4396e7a Mon Sep 17 00:00:00 2001 From: Shijie Qin Date: Fri, 19 Jul 2019 19:22:52 +0800 Subject: [PATCH] MMFMWK-8572-2 VPU Decoder: not add frm_total_num if input data not including frame data +MPEG4/MPEG2, the first input data also not including frame data Signed-off-by: Shijie Qin --- drivers/mxc/vpu_malone/insert_startcode.c | 28 ++++++++++++++++------- drivers/mxc/vpu_malone/insert_startcode.h | 3 ++- drivers/mxc/vpu_malone/vpu_b0.c | 17 ++++++-------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/drivers/mxc/vpu_malone/insert_startcode.c b/drivers/mxc/vpu_malone/insert_startcode.c index eaae946521d6..4c545088fd49 100644 --- a/drivers/mxc/vpu_malone/insert_startcode.c +++ b/drivers/mxc/vpu_malone/insert_startcode.c @@ -437,7 +437,26 @@ void insert_payload_header_arv(u_int8 *dst, u_int32 uScodeType, dst[15] = 0x50; } -u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int32 vdec_std, u_int32 uPayloadSize, u_int32 *sin_seq) +u_int32 single_seq_info_format(struct queue_data *q_data) +{ + u_int32 ret = 0; + + switch (q_data->fourcc) { + case V4L2_PIX_FMT_VC1_ANNEX_G: + case V4L2_PIX_FMT_VC1_ANNEX_L: + case VPU_PIX_FMT_RV: + case V4L2_PIX_FMT_MPEG4: + case V4L2_PIX_FMT_MPEG2: + ret = 1; + break; + default: + break; + } + + return ret; +} + +u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int32 vdec_std, u_int32 uPayloadSize) { struct queue_data *q_data = &ctx->q_data[V4L2_SRC]; u_int32 length = 0; @@ -458,7 +477,6 @@ u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int3 HeaderLen = RCV_HEADER_LEN - 4; memcpy(dst + 16, Header, HeaderLen); length += HeaderLen; - *sin_seq = 1; } else { u_int8 Header[VC1_MAX_SEQ_HEADER_SIZE]; u_int32 HeaderLen; @@ -469,7 +487,6 @@ u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int3 HeaderLen -= 4; memcpy(dst, Header, HeaderLen); length += HeaderLen; - *sin_seq = 1; } } @@ -477,7 +494,6 @@ u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int3 case VPU_VIDEO_VP6: { vp6_scd_sequence_header(dst, q_data->width, q_data->height); length = 16; - *sin_seq = 1; } break; case VPU_VIDEO_VP8: { @@ -496,7 +512,6 @@ u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int3 length += 8; memcpy(dst+length, src, uPayloadSize); length += uPayloadSize; - *sin_seq = 0; } break; case VPU_VIDEO_ASP: { @@ -505,7 +520,6 @@ u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int3 length = 16; memcpy(dst+length, src, uPayloadSize); length += uPayloadSize; - *sin_seq = 0; } } break; @@ -518,7 +532,6 @@ u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int3 length += 16; memcpy(dst+length, src, uPayloadSize); length += uPayloadSize; - *sin_seq = 0; } break; case VPU_VIDEO_RV: { @@ -531,7 +544,6 @@ u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int3 length = 16; memcpy(dst+length, src, uPayloadSize); length += uPayloadSize; - *sin_seq = 1; } break; default: diff --git a/drivers/mxc/vpu_malone/insert_startcode.h b/drivers/mxc/vpu_malone/insert_startcode.h index f560b2636b55..80c096c520bb 100644 --- a/drivers/mxc/vpu_malone/insert_startcode.h +++ b/drivers/mxc/vpu_malone/insert_startcode.h @@ -33,11 +33,12 @@ #define VC1_MAX_SEQ_HEADER_SIZE 256 u_int32 insert_scode_4_pic(struct vpu_ctx *ctx, u_int8 *dst, u_int8 *src, u_int32 vdec_std, u_int32 uPayloadSize); -u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int32 vdec_std, u_int32 uPayloadSize, u_int32 *sin_seq); +u_int32 insert_scode_4_seq(struct vpu_ctx *ctx, u_int8 *src, u_int8 *dst, u_int32 vdec_std, u_int32 uPayloadSize); u_int32 insert_scode_4_arv_slice(struct vpu_ctx *ctx, u_int8 *dst, struct VPU_FMT_INFO_ARV *arv_frame, u_int32 uPayloadSize); struct VPU_FMT_INFO_ARV *get_arv_info(struct vpu_ctx *ctx, u_int8 *src, u_int32 size); void put_arv_info(struct VPU_FMT_INFO_ARV *arv_frame); void insert_payload_header_arv(u_int8 *dst, u_int32 uScodeType, enum ARV_FRAME_TYPE type, u_int32 uPayloadSize, u_int32 uWidth, u_int32 uHeight); +u_int32 single_seq_info_format(struct queue_data *q_data); #endif diff --git a/drivers/mxc/vpu_malone/vpu_b0.c b/drivers/mxc/vpu_malone/vpu_b0.c index c5f3803acb89..1d57d36cead5 100644 --- a/drivers/mxc/vpu_malone/vpu_b0.c +++ b/drivers/mxc/vpu_malone/vpu_b0.c @@ -2810,7 +2810,7 @@ static u32 transfer_buffer_to_firmware(struct vpu_ctx *ctx, unsigned int *CurrStrfg = &pSharedInterface->StreamConfig[ctx->str_index]; u_int32 length; MediaIPFW_Video_CodecParams *pCodecPara; - u_int32 sin_seq = 0; + struct queue_data *q_data = &ctx->q_data[V4L2_SRC]; vpu_dbg(LVL_BIT_FUNC, "enter %s, start_flag %d, index=%d, firmware_started=%d\n", __func__, ctx->start_flag, ctx->str_index, ctx->dev->firmware_started); @@ -2825,7 +2825,7 @@ static u32 transfer_buffer_to_firmware(struct vpu_ctx *ctx, return 0; } if (!ctx->start_code_bypass) - length = insert_scode_4_seq(ctx, input_buffer, ctx->stream_buffer.dma_virt, vdec_std, buffer_size, &sin_seq); + length = insert_scode_4_seq(ctx, input_buffer, ctx->stream_buffer.dma_virt, vdec_std, buffer_size); else length = 0; if (length == 0) { @@ -2875,7 +2875,7 @@ static u32 transfer_buffer_to_firmware(struct vpu_ctx *ctx, ctx->dev->shared_mem.pSharedInterface->DbgLogDesc.uDecStatusLogLevel = vpu_frmdbg_level; /*initialize frame count*/ - if (sin_seq == 1) { + if (single_seq_info_format(q_data)) { ctx->frm_dis_delay = 0; ctx->frm_dec_delay = 0; ctx->frm_total_num = 0; @@ -3350,14 +3350,11 @@ static uint32_t insert_scode_4_seq_4_arv(struct vpu_ctx *ctx, u_int8 *input_buff return length; } -static bool check_single_seq_info(struct vb2_v4l2_buffer *vbuf, unsigned int vdec_std) +static u_int32 check_single_seq_info(struct vb2_v4l2_buffer *vbuf, struct queue_data *q_data) { if (!(vbuf->flags & V4L2_NXP_BUF_FLAG_CODECCONFIG)) - return false; - if (vdec_std == VPU_VIDEO_VC1 || vdec_std == VPU_VIDEO_VP6 || VPU_VIDEO_RV) - return true; - - return false; + return 0; + return single_seq_info_format(q_data); } static bool verify_decoded_frames(struct vpu_ctx *ctx) @@ -3426,7 +3423,7 @@ static void enqueue_stream_data(struct vpu_ctx *ctx, uint32_t uStrBufIdx) record_log_info(ctx, LOG_PADDING, 0, 0); } - if (!check_single_seq_info(vbuf, This->vdec_std)) { + if (!check_single_seq_info(vbuf, This)) { ctx->frm_dec_delay++; ctx->frm_dis_delay++; ctx->frm_total_num++; -- 2.17.1