diff options
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 | ||||
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_common.h | 3 | ||||
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 20 | ||||
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 64 | ||||
-rw-r--r-- | drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | 29 |
5 files changed, 67 insertions, 53 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index 01f9ae0dadb0..3b2345e16096 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c | |||
@@ -397,7 +397,7 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx, | |||
397 | leave_handle_frame: | 397 | leave_handle_frame: |
398 | spin_unlock_irqrestore(&dev->irqlock, flags); | 398 | spin_unlock_irqrestore(&dev->irqlock, flags); |
399 | if ((ctx->src_queue_cnt == 0 && ctx->state != MFCINST_FINISHING) | 399 | if ((ctx->src_queue_cnt == 0 && ctx->state != MFCINST_FINISHING) |
400 | || ctx->dst_queue_cnt < ctx->dpb_count) | 400 | || ctx->dst_queue_cnt < ctx->pb_count) |
401 | clear_work_bit(ctx); | 401 | clear_work_bit(ctx); |
402 | s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); | 402 | s5p_mfc_hw_call(dev->mfc_ops, clear_int_flags, dev); |
403 | wake_up_ctx(ctx, reason, err); | 403 | wake_up_ctx(ctx, reason, err); |
@@ -473,7 +473,7 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx, | |||
473 | 473 | ||
474 | s5p_mfc_hw_call(dev->mfc_ops, dec_calc_dpb_size, ctx); | 474 | s5p_mfc_hw_call(dev->mfc_ops, dec_calc_dpb_size, ctx); |
475 | 475 | ||
476 | ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count, | 476 | ctx->pb_count = s5p_mfc_hw_call(dev->mfc_ops, get_dpb_count, |
477 | dev); | 477 | dev); |
478 | ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count, | 478 | ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count, |
479 | dev); | 479 | dev); |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h index 202d1d7a37a8..975d1b2a764d 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h | |||
@@ -138,6 +138,7 @@ enum s5p_mfc_inst_state { | |||
138 | MFCINST_INIT = 100, | 138 | MFCINST_INIT = 100, |
139 | MFCINST_GOT_INST, | 139 | MFCINST_GOT_INST, |
140 | MFCINST_HEAD_PARSED, | 140 | MFCINST_HEAD_PARSED, |
141 | MFCINST_HEAD_PRODUCED, | ||
141 | MFCINST_BUFS_SET, | 142 | MFCINST_BUFS_SET, |
142 | MFCINST_RUNNING, | 143 | MFCINST_RUNNING, |
143 | MFCINST_FINISHING, | 144 | MFCINST_FINISHING, |
@@ -602,7 +603,7 @@ struct s5p_mfc_ctx { | |||
602 | int after_packed_pb; | 603 | int after_packed_pb; |
603 | int sei_fp_parse; | 604 | int sei_fp_parse; |
604 | 605 | ||
605 | int dpb_count; | 606 | int pb_count; |
606 | int total_dpb_count; | 607 | int total_dpb_count; |
607 | int mv_count; | 608 | int mv_count; |
608 | /* Buffers */ | 609 | /* Buffers */ |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c index 4af53bd2f182..00b07032f4f0 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | |||
@@ -210,11 +210,11 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
210 | /* Context is to decode a frame */ | 210 | /* Context is to decode a frame */ |
211 | if (ctx->src_queue_cnt >= 1 && | 211 | if (ctx->src_queue_cnt >= 1 && |
212 | ctx->state == MFCINST_RUNNING && | 212 | ctx->state == MFCINST_RUNNING && |
213 | ctx->dst_queue_cnt >= ctx->dpb_count) | 213 | ctx->dst_queue_cnt >= ctx->pb_count) |
214 | return 1; | 214 | return 1; |
215 | /* Context is to return last frame */ | 215 | /* Context is to return last frame */ |
216 | if (ctx->state == MFCINST_FINISHING && | 216 | if (ctx->state == MFCINST_FINISHING && |
217 | ctx->dst_queue_cnt >= ctx->dpb_count) | 217 | ctx->dst_queue_cnt >= ctx->pb_count) |
218 | return 1; | 218 | return 1; |
219 | /* Context is to set buffers */ | 219 | /* Context is to set buffers */ |
220 | if (ctx->src_queue_cnt >= 1 && | 220 | if (ctx->src_queue_cnt >= 1 && |
@@ -224,7 +224,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
224 | /* Resolution change */ | 224 | /* Resolution change */ |
225 | if ((ctx->state == MFCINST_RES_CHANGE_INIT || | 225 | if ((ctx->state == MFCINST_RES_CHANGE_INIT || |
226 | ctx->state == MFCINST_RES_CHANGE_FLUSH) && | 226 | ctx->state == MFCINST_RES_CHANGE_FLUSH) && |
227 | ctx->dst_queue_cnt >= ctx->dpb_count) | 227 | ctx->dst_queue_cnt >= ctx->pb_count) |
228 | return 1; | 228 | return 1; |
229 | if (ctx->state == MFCINST_RES_CHANGE_END && | 229 | if (ctx->state == MFCINST_RES_CHANGE_END && |
230 | ctx->src_queue_cnt >= 1) | 230 | ctx->src_queue_cnt >= 1) |
@@ -537,7 +537,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
537 | mfc_err("vb2_reqbufs on capture failed\n"); | 537 | mfc_err("vb2_reqbufs on capture failed\n"); |
538 | return ret; | 538 | return ret; |
539 | } | 539 | } |
540 | if (reqbufs->count < ctx->dpb_count) { | 540 | if (reqbufs->count < ctx->pb_count) { |
541 | mfc_err("Not enough buffers allocated\n"); | 541 | mfc_err("Not enough buffers allocated\n"); |
542 | reqbufs->count = 0; | 542 | reqbufs->count = 0; |
543 | s5p_mfc_clock_on(); | 543 | s5p_mfc_clock_on(); |
@@ -751,7 +751,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl) | |||
751 | case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: | 751 | case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: |
752 | if (ctx->state >= MFCINST_HEAD_PARSED && | 752 | if (ctx->state >= MFCINST_HEAD_PARSED && |
753 | ctx->state < MFCINST_ABORT) { | 753 | ctx->state < MFCINST_ABORT) { |
754 | ctrl->val = ctx->dpb_count; | 754 | ctrl->val = ctx->pb_count; |
755 | break; | 755 | break; |
756 | } else if (ctx->state != MFCINST_INIT) { | 756 | } else if (ctx->state != MFCINST_INIT) { |
757 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); | 757 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); |
@@ -763,7 +763,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl) | |||
763 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); | 763 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0); |
764 | if (ctx->state >= MFCINST_HEAD_PARSED && | 764 | if (ctx->state >= MFCINST_HEAD_PARSED && |
765 | ctx->state < MFCINST_ABORT) { | 765 | ctx->state < MFCINST_ABORT) { |
766 | ctrl->val = ctx->dpb_count; | 766 | ctrl->val = ctx->pb_count; |
767 | } else { | 767 | } else { |
768 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); | 768 | v4l2_err(&dev->v4l2_dev, "Decoding not initialised\n"); |
769 | return -EINVAL; | 769 | return -EINVAL; |
@@ -924,10 +924,10 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq, | |||
924 | /* Output plane count is 2 - one for Y and one for CbCr */ | 924 | /* Output plane count is 2 - one for Y and one for CbCr */ |
925 | *plane_count = 2; | 925 | *plane_count = 2; |
926 | /* Setup buffer count */ | 926 | /* Setup buffer count */ |
927 | if (*buf_count < ctx->dpb_count) | 927 | if (*buf_count < ctx->pb_count) |
928 | *buf_count = ctx->dpb_count; | 928 | *buf_count = ctx->pb_count; |
929 | if (*buf_count > ctx->dpb_count + MFC_MAX_EXTRA_DPB) | 929 | if (*buf_count > ctx->pb_count + MFC_MAX_EXTRA_DPB) |
930 | *buf_count = ctx->dpb_count + MFC_MAX_EXTRA_DPB; | 930 | *buf_count = ctx->pb_count + MFC_MAX_EXTRA_DPB; |
931 | if (*buf_count > MFC_MAX_BUFFERS) | 931 | if (*buf_count > MFC_MAX_BUFFERS) |
932 | *buf_count = MFC_MAX_BUFFERS; | 932 | *buf_count = MFC_MAX_BUFFERS; |
933 | } else { | 933 | } else { |
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c index 4f6b553c4b2d..5e019aa6113b 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | |||
@@ -592,7 +592,7 @@ static int s5p_mfc_ctx_ready(struct s5p_mfc_ctx *ctx) | |||
592 | return 1; | 592 | return 1; |
593 | /* context is ready to encode a frame */ | 593 | /* context is ready to encode a frame */ |
594 | if ((ctx->state == MFCINST_RUNNING || | 594 | if ((ctx->state == MFCINST_RUNNING || |
595 | ctx->state == MFCINST_HEAD_PARSED) && | 595 | ctx->state == MFCINST_HEAD_PRODUCED) && |
596 | ctx->src_queue_cnt >= 1 && ctx->dst_queue_cnt >= 1) | 596 | ctx->src_queue_cnt >= 1 && ctx->dst_queue_cnt >= 1) |
597 | return 1; | 597 | return 1; |
598 | /* context is ready to encode remaining frames */ | 598 | /* context is ready to encode remaining frames */ |
@@ -649,6 +649,7 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) | |||
649 | struct s5p_mfc_enc_params *p = &ctx->enc_params; | 649 | struct s5p_mfc_enc_params *p = &ctx->enc_params; |
650 | struct s5p_mfc_buf *dst_mb; | 650 | struct s5p_mfc_buf *dst_mb; |
651 | unsigned long flags; | 651 | unsigned long flags; |
652 | unsigned int enc_pb_count; | ||
652 | 653 | ||
653 | if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { | 654 | if (p->seq_hdr_mode == V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE) { |
654 | spin_lock_irqsave(&dev->irqlock, flags); | 655 | spin_lock_irqsave(&dev->irqlock, flags); |
@@ -661,18 +662,19 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx) | |||
661 | vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE); | 662 | vb2_buffer_done(dst_mb->b, VB2_BUF_STATE_DONE); |
662 | spin_unlock_irqrestore(&dev->irqlock, flags); | 663 | spin_unlock_irqrestore(&dev->irqlock, flags); |
663 | } | 664 | } |
664 | if (IS_MFCV6(dev)) { | 665 | |
665 | ctx->state = MFCINST_HEAD_PARSED; /* for INIT_BUFFER cmd */ | 666 | if (!IS_MFCV6(dev)) { |
666 | } else { | ||
667 | ctx->state = MFCINST_RUNNING; | 667 | ctx->state = MFCINST_RUNNING; |
668 | if (s5p_mfc_ctx_ready(ctx)) | 668 | if (s5p_mfc_ctx_ready(ctx)) |
669 | set_work_bit_irqsave(ctx); | 669 | set_work_bit_irqsave(ctx); |
670 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 670 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
671 | } | 671 | } else { |
672 | 672 | enc_pb_count = s5p_mfc_hw_call(dev->mfc_ops, | |
673 | if (IS_MFCV6(dev)) | ||
674 | ctx->dpb_count = s5p_mfc_hw_call(dev->mfc_ops, | ||
675 | get_enc_dpb_count, dev); | 673 | get_enc_dpb_count, dev); |
674 | if (ctx->pb_count < enc_pb_count) | ||
675 | ctx->pb_count = enc_pb_count; | ||
676 | ctx->state = MFCINST_HEAD_PRODUCED; | ||
677 | } | ||
676 | 678 | ||
677 | return 0; | 679 | return 0; |
678 | } | 680 | } |
@@ -1055,15 +1057,13 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1055 | } | 1057 | } |
1056 | ctx->capture_state = QUEUE_BUFS_REQUESTED; | 1058 | ctx->capture_state = QUEUE_BUFS_REQUESTED; |
1057 | 1059 | ||
1058 | if (!IS_MFCV6(dev)) { | 1060 | ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, |
1059 | ret = s5p_mfc_hw_call(ctx->dev->mfc_ops, | 1061 | alloc_codec_buffers, ctx); |
1060 | alloc_codec_buffers, ctx); | 1062 | if (ret) { |
1061 | if (ret) { | 1063 | mfc_err("Failed to allocate encoding buffers\n"); |
1062 | mfc_err("Failed to allocate encoding buffers\n"); | 1064 | reqbufs->count = 0; |
1063 | reqbufs->count = 0; | 1065 | ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); |
1064 | ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); | 1066 | return -ENOMEM; |
1065 | return -ENOMEM; | ||
1066 | } | ||
1067 | } | 1067 | } |
1068 | } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { | 1068 | } else if (reqbufs->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { |
1069 | if (ctx->output_state != QUEUE_FREE) { | 1069 | if (ctx->output_state != QUEUE_FREE) { |
@@ -1071,6 +1071,19 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1071 | ctx->output_state); | 1071 | ctx->output_state); |
1072 | return -EINVAL; | 1072 | return -EINVAL; |
1073 | } | 1073 | } |
1074 | |||
1075 | if (IS_MFCV6(dev)) { | ||
1076 | /* Check for min encoder buffers */ | ||
1077 | if (ctx->pb_count && | ||
1078 | (reqbufs->count < ctx->pb_count)) { | ||
1079 | reqbufs->count = ctx->pb_count; | ||
1080 | mfc_debug(2, "Minimum %d output buffers needed\n", | ||
1081 | ctx->pb_count); | ||
1082 | } else { | ||
1083 | ctx->pb_count = reqbufs->count; | ||
1084 | } | ||
1085 | } | ||
1086 | |||
1074 | ret = vb2_reqbufs(&ctx->vq_src, reqbufs); | 1087 | ret = vb2_reqbufs(&ctx->vq_src, reqbufs); |
1075 | if (ret != 0) { | 1088 | if (ret != 0) { |
1076 | mfc_err("error in vb2_reqbufs() for E(S)\n"); | 1089 | mfc_err("error in vb2_reqbufs() for E(S)\n"); |
@@ -1760,11 +1773,28 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count) | |||
1760 | struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); | 1773 | struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv); |
1761 | struct s5p_mfc_dev *dev = ctx->dev; | 1774 | struct s5p_mfc_dev *dev = ctx->dev; |
1762 | 1775 | ||
1776 | if (IS_MFCV6(dev) && (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)) { | ||
1777 | |||
1778 | if ((ctx->state == MFCINST_GOT_INST) && | ||
1779 | (dev->curr_ctx == ctx->num) && dev->hw_lock) { | ||
1780 | s5p_mfc_wait_for_done_ctx(ctx, | ||
1781 | S5P_MFC_R2H_CMD_SEQ_DONE_RET, | ||
1782 | 0); | ||
1783 | } | ||
1784 | |||
1785 | if (ctx->src_bufs_cnt < ctx->pb_count) { | ||
1786 | mfc_err("Need minimum %d OUTPUT buffers\n", | ||
1787 | ctx->pb_count); | ||
1788 | return -EINVAL; | ||
1789 | } | ||
1790 | } | ||
1791 | |||
1763 | v4l2_ctrl_handler_setup(&ctx->ctrl_handler); | 1792 | v4l2_ctrl_handler_setup(&ctx->ctrl_handler); |
1764 | /* If context is ready then dev = work->data;schedule it to run */ | 1793 | /* If context is ready then dev = work->data;schedule it to run */ |
1765 | if (s5p_mfc_ctx_ready(ctx)) | 1794 | if (s5p_mfc_ctx_ready(ctx)) |
1766 | set_work_bit_irqsave(ctx); | 1795 | set_work_bit_irqsave(ctx); |
1767 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); | 1796 | s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); |
1797 | |||
1768 | return 0; | 1798 | return 0; |
1769 | } | 1799 | } |
1770 | 1800 | ||
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c index db57f2539f2d..383ae77ad506 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c | |||
@@ -167,7 +167,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
167 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); | 167 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); |
168 | ctx->bank1.size = | 168 | ctx->bank1.size = |
169 | ctx->scratch_buf_size + ctx->tmv_buffer_size + | 169 | ctx->scratch_buf_size + ctx->tmv_buffer_size + |
170 | (ctx->dpb_count * (ctx->luma_dpb_size + | 170 | (ctx->pb_count * (ctx->luma_dpb_size + |
171 | ctx->chroma_dpb_size + ctx->me_buffer_size)); | 171 | ctx->chroma_dpb_size + ctx->me_buffer_size)); |
172 | ctx->bank2.size = 0; | 172 | ctx->bank2.size = 0; |
173 | break; | 173 | break; |
@@ -181,7 +181,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
181 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); | 181 | S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6); |
182 | ctx->bank1.size = | 182 | ctx->bank1.size = |
183 | ctx->scratch_buf_size + ctx->tmv_buffer_size + | 183 | ctx->scratch_buf_size + ctx->tmv_buffer_size + |
184 | (ctx->dpb_count * (ctx->luma_dpb_size + | 184 | (ctx->pb_count * (ctx->luma_dpb_size + |
185 | ctx->chroma_dpb_size + ctx->me_buffer_size)); | 185 | ctx->chroma_dpb_size + ctx->me_buffer_size)); |
186 | ctx->bank2.size = 0; | 186 | ctx->bank2.size = 0; |
187 | break; | 187 | break; |
@@ -198,7 +198,6 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx *ctx) | |||
198 | } | 198 | } |
199 | BUG_ON(ctx->bank1.dma & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); | 199 | BUG_ON(ctx->bank1.dma & ((1 << MFC_BANK1_ALIGN_ORDER) - 1)); |
200 | } | 200 | } |
201 | |||
202 | return 0; | 201 | return 0; |
203 | } | 202 | } |
204 | 203 | ||
@@ -497,7 +496,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
497 | 496 | ||
498 | mfc_debug(2, "Buf1: %p (%d)\n", (void *)buf_addr1, buf_size1); | 497 | mfc_debug(2, "Buf1: %p (%d)\n", (void *)buf_addr1, buf_size1); |
499 | 498 | ||
500 | for (i = 0; i < ctx->dpb_count; i++) { | 499 | for (i = 0; i < ctx->pb_count; i++) { |
501 | WRITEL(buf_addr1, S5P_FIMV_E_LUMA_DPB_V6 + (4 * i)); | 500 | WRITEL(buf_addr1, S5P_FIMV_E_LUMA_DPB_V6 + (4 * i)); |
502 | buf_addr1 += ctx->luma_dpb_size; | 501 | buf_addr1 += ctx->luma_dpb_size; |
503 | WRITEL(buf_addr1, S5P_FIMV_E_CHROMA_DPB_V6 + (4 * i)); | 502 | WRITEL(buf_addr1, S5P_FIMV_E_CHROMA_DPB_V6 + (4 * i)); |
@@ -520,7 +519,7 @@ static int s5p_mfc_set_enc_ref_buffer_v6(struct s5p_mfc_ctx *ctx) | |||
520 | buf_size1 -= ctx->tmv_buffer_size; | 519 | buf_size1 -= ctx->tmv_buffer_size; |
521 | 520 | ||
522 | mfc_debug(2, "Buf1: %u, buf_size1: %d (ref frames %d)\n", | 521 | mfc_debug(2, "Buf1: %u, buf_size1: %d (ref frames %d)\n", |
523 | buf_addr1, buf_size1, ctx->dpb_count); | 522 | buf_addr1, buf_size1, ctx->pb_count); |
524 | if (buf_size1 < 0) { | 523 | if (buf_size1 < 0) { |
525 | mfc_debug(2, "Not enough memory has been allocated.\n"); | 524 | mfc_debug(2, "Not enough memory has been allocated.\n"); |
526 | return -ENOMEM; | 525 | return -ENOMEM; |
@@ -1522,22 +1521,6 @@ static inline int s5p_mfc_run_init_enc_buffers(struct s5p_mfc_ctx *ctx) | |||
1522 | struct s5p_mfc_dev *dev = ctx->dev; | 1521 | struct s5p_mfc_dev *dev = ctx->dev; |
1523 | int ret; | 1522 | int ret; |
1524 | 1523 | ||
1525 | ret = s5p_mfc_alloc_codec_buffers_v6(ctx); | ||
1526 | if (ret) { | ||
1527 | mfc_err("Failed to allocate encoding buffers.\n"); | ||
1528 | return -ENOMEM; | ||
1529 | } | ||
1530 | |||
1531 | /* Header was generated now starting processing | ||
1532 | * First set the reference frame buffers | ||
1533 | */ | ||
1534 | if (ctx->capture_state != QUEUE_BUFS_REQUESTED) { | ||
1535 | mfc_err("It seems that destionation buffers were not\n" | ||
1536 | "requested.MFC requires that header should be generated\n" | ||
1537 | "before allocating codec buffer.\n"); | ||
1538 | return -EAGAIN; | ||
1539 | } | ||
1540 | |||
1541 | dev->curr_ctx = ctx->num; | 1524 | dev->curr_ctx = ctx->num; |
1542 | s5p_mfc_clean_ctx_int_flags(ctx); | 1525 | s5p_mfc_clean_ctx_int_flags(ctx); |
1543 | ret = s5p_mfc_set_enc_ref_buffer_v6(ctx); | 1526 | ret = s5p_mfc_set_enc_ref_buffer_v6(ctx); |
@@ -1582,7 +1565,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev) | |||
1582 | mfc_debug(1, "Seting new context to %p\n", ctx); | 1565 | mfc_debug(1, "Seting new context to %p\n", ctx); |
1583 | /* Got context to run in ctx */ | 1566 | /* Got context to run in ctx */ |
1584 | mfc_debug(1, "ctx->dst_queue_cnt=%d ctx->dpb_count=%d ctx->src_queue_cnt=%d\n", | 1567 | mfc_debug(1, "ctx->dst_queue_cnt=%d ctx->dpb_count=%d ctx->src_queue_cnt=%d\n", |
1585 | ctx->dst_queue_cnt, ctx->dpb_count, ctx->src_queue_cnt); | 1568 | ctx->dst_queue_cnt, ctx->pb_count, ctx->src_queue_cnt); |
1586 | mfc_debug(1, "ctx->state=%d\n", ctx->state); | 1569 | mfc_debug(1, "ctx->state=%d\n", ctx->state); |
1587 | /* Last frame has already been sent to MFC | 1570 | /* Last frame has already been sent to MFC |
1588 | * Now obtaining frames from MFC buffer */ | 1571 | * Now obtaining frames from MFC buffer */ |
@@ -1647,7 +1630,7 @@ static void s5p_mfc_try_run_v6(struct s5p_mfc_dev *dev) | |||
1647 | case MFCINST_GOT_INST: | 1630 | case MFCINST_GOT_INST: |
1648 | s5p_mfc_run_init_enc(ctx); | 1631 | s5p_mfc_run_init_enc(ctx); |
1649 | break; | 1632 | break; |
1650 | case MFCINST_HEAD_PARSED: /* Only for MFC6.x */ | 1633 | case MFCINST_HEAD_PRODUCED: |
1651 | ret = s5p_mfc_run_init_enc_buffers(ctx); | 1634 | ret = s5p_mfc_run_init_enc_buffers(ctx); |
1652 | break; | 1635 | break; |
1653 | default: | 1636 | default: |