From 302797713d3095516e7bed68bdf8fc1d43a310b7 Mon Sep 17 00:00:00 2001 From: Kamil Debski Date: Thu, 26 Jun 2014 12:32:55 +0200 Subject: [PATCH] s5p-mfc: Change buffer allocation per LSI suggestions When using IOMMU page fault were observed. This patches increases the DPB size for interlaced streams. In addition the reported size of the DPB is also increased for all tpes of stream. Change-Id: I5597abe8f9a4a5194a017631d004dcf1e5101237 Signed-off-by: Kamil Debski --- drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 2 ++ drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 6e4f27d..41474aa 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h @@ -563,6 +563,8 @@ struct s5p_mfc_ctx { int luma_size; int chroma_size; + int luma_size_to_report; + int chroma_size_to_report; int mv_size; unsigned long consumed_stream; diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c index 4c4a902..5d5dde0 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c @@ -295,6 +295,8 @@ static void s5p_mfc_dec_calc_dpb_size_v5(struct s5p_mfc_ctx *ctx) ALIGN((ctx->buf_height >> 2), S5P_FIMV_NV12MT_VALIGN), S5P_FIMV_DEC_BUF_ALIGN); + ctx->luma_size_to_report = ctx->luma_size; + ctx->chroma_size_to_report = ctx->chroma_size; } else { guard_width = ALIGN(ctx->buf_width + 24, S5P_FIMV_NV12MT_HALIGN); @@ -313,6 +315,13 @@ static void s5p_mfc_dec_calc_dpb_size_v5(struct s5p_mfc_ctx *ctx) ctx->mv_size = 0; + ctx->luma_size_to_report = ctx->luma_size; + ctx->chroma_size_to_report = ctx->chroma_size; + if (mfc_is_iommu_used(ctx)) { + ctx->luma_size_to_report *= 2; + ctx->chroma_size_to_report *= 2; + } + /* If interlace is deteced for MPEG2 decoding the size of the * luma an chroma buffers should be doubled */ if (mfc_is_iommu_used(ctx) && ctx->interlace && ctx->codec_mode @@ -505,8 +514,8 @@ static int s5p_mfc_set_dec_frame_buffer_v5(struct s5p_mfc_ctx *ctx) mfc_debug(2, "Not enough memory has been allocated\n"); return -ENOMEM; } - s5p_mfc_write_info_v5(ctx, frame_size, ALLOC_LUMA_DPB_SIZE); - s5p_mfc_write_info_v5(ctx, frame_size_ch, ALLOC_CHROMA_DPB_SIZE); + s5p_mfc_write_info_v5(ctx, ctx->luma_size_to_report, ALLOC_LUMA_DPB_SIZE); + s5p_mfc_write_info_v5(ctx, ctx->chroma_size_to_report, ALLOC_CHROMA_DPB_SIZE); if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC) s5p_mfc_write_info_v5(ctx, frame_size_mv, ALLOC_MV_SIZE); mfc_write(dev, ((S5P_FIMV_CH_INIT_BUFS & S5P_FIMV_CH_MASK) -- 2.7.4