From 73cc86305676ce34d0850db83d8079ac240c093c Mon Sep 17 00:00:00 2001 From: Shijie Qin Date: Mon, 12 Aug 2019 09:59:42 +0800 Subject: [PATCH] MLK-22420 VPU Decoder: change AVS eos padding data, correct chroma size 1. Change AVS format EOS_PADDING_TYPE to EOS_GENERIC_MPEG to align with firmware 2. chroma size shall also be 1/2 luma size for interlaced clips Signed-off-by: Shijie Qin --- drivers/mxc/vpu_malone/vpu_b0.c | 14 +++++--------- drivers/mxc/vpu_malone/vpu_b0.h | 3 +++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/mxc/vpu_malone/vpu_b0.c b/drivers/mxc/vpu_malone/vpu_b0.c index 8bcb04cddd27..5f98f857b5dc 100644 --- a/drivers/mxc/vpu_malone/vpu_b0.c +++ b/drivers/mxc/vpu_malone/vpu_b0.c @@ -787,22 +787,18 @@ static void calculate_frame_size(struct vpu_ctx *ctx) u_int32 luma_size; u_int32 chroma_size; u_int32 chroma_height; - u_int32 uVertAlign = 512-1; bool b10BitFormat = is_10bit_format(ctx); - struct queue_data *q_data; q_data = &ctx->q_data[V4L2_DST]; width = b10BitFormat?(width + ((width + 3) >> 2)):width; - width = ((width + uVertAlign) & ~uVertAlign); + width = ALIGN(width, V4L2_NXP_FRAME_HORIZONTAL_ALIGN); q_data->stride = width; - height = ((height + uVertAlign) & ~uVertAlign); - if (ctx->seqinfo.uProgressive) - chroma_height = height >> 1; - else - chroma_height = height; + height = ALIGN(height, V4L2_NXP_FRAME_VERTICAL_ALIGN); + chroma_height = height >> 1; + luma_size = width * height; chroma_size = width * chroma_height; ctx->q_data[V4L2_DST].sizeimage[0] = luma_size; @@ -2472,10 +2468,10 @@ static int add_scode_vpu(struct vpu_ctx *ctx, u_int32 uStrBufIdx, VPU_PADDING_SC last = 0x0a010000; break; case VPU_VIDEO_MPEG2: + case VPU_VIDEO_AVS: last = EOS_GENERIC_MPEG; break; case VPU_VIDEO_ASP: - case VPU_VIDEO_AVS: last = 0xb1010000; break; case VPU_VIDEO_SPK: diff --git a/drivers/mxc/vpu_malone/vpu_b0.h b/drivers/mxc/vpu_malone/vpu_b0.h index 4804ddac9215..1e472408d63a 100644 --- a/drivers/mxc/vpu_malone/vpu_b0.h +++ b/drivers/mxc/vpu_malone/vpu_b0.h @@ -440,6 +440,9 @@ struct vpu_ctx { #define VPU_DECODED_EVENT_PERF_MASK (1 << 0) #define VPU_READY_EVENT_PERF_MASK (1 << 1) +#define V4L2_NXP_FRAME_VERTICAL_ALIGN 512 +#define V4L2_NXP_FRAME_HORIZONTAL_ALIGN 512 + pSTREAM_BUFFER_DESCRIPTOR_TYPE get_str_buffer_desc(struct vpu_ctx *ctx); u_int32 got_free_space(u_int32 wptr, u_int32 rptr, u_int32 start, u_int32 end); int copy_buffer_to_stream(struct vpu_ctx *ctx, void *buffer, uint32_t length); -- 2.17.1