s5p-mfc: Change buffer allocation per LSI suggestions
authorKamil Debski <k.debski@samsung.com>
Thu, 26 Jun 2014 10:32:55 +0000 (12:32 +0200)
committerChanho Park <chanho61.park@samsung.com>
Tue, 18 Nov 2014 02:59:58 +0000 (11:59 +0900)
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 <k.debski@samsung.com>
drivers/media/platform/s5p-mfc/s5p_mfc_common.h
drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c

index 6e4f27d..41474aa 100644 (file)
@@ -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;
index 4c4a902..5d5dde0 100644 (file)
@@ -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)