aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-10-11 14:07:19 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-11 14:07:19 -0400
commitbf3b202b41999f88f091632f13842b7234bd58b7 (patch)
treee2861fcca522cc299e6106fa6c78d85a4a6eedeb /drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
parent782cd9ee985b1523f1ddad57657a24d7855d9e4d (diff)
parent1fdead8ad31d3aa833bc37739273fcde89ace93c (diff)
Merge branch 'staging/for_v3.7' into v4l_for_linus
Applied on the top of changeset 782cd9e, as some of those patches depend on some fixes that went via -arm tree. * staging/for_v3.7: (109 commits) [media] m5mols: Add missing #include <linux/sizes.h> [media] stk1160: Add support for S-Video input Revert "[media] omap3isp: Replace cpu_is_omap3630() with ISP revision check" [media] dvb: LNA implementation changes [media] v4l2-ioctl: fix W=1 warnings [media] v4l2-ioctl: add blocks check for VIDIOC_SUBDEV_G/S_EDID [media] omap3isp: Fix compilation error in ispreg.h [media] rc-msi-digivox-ii: Add full scan keycodes [media] cx25821: testing the wrong variable [media] tda18271-common: hold the I2C adapter during write transfers [media] ds3000: add module parameter to force firmware upload [media] drivers/media: Remove unnecessary semicolon [media] winbond: remove space from driver name [media] iguanair: cannot send data from the stack [media] omap3isp: Replace cpu_is_omap3630() with ISP revision check [media] dvb-usb: print small buffers via %*ph [media] uvc: Add return code check at vb2_queue_init() [media] em28xx: Replace memcpy with struct assignment [media] bt8xx: Add video4linux control V4L2_CID_COLOR_KILLER [media] mem2mem_testdev: Use devm_kzalloc() in probe ...
Diffstat (limited to 'drivers/media/platform/s5p-mfc/s5p_mfc_dec.c')
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_dec.c258
1 files changed, 176 insertions, 82 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 6ee21bb71398..eb6a70b0f821 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -23,85 +23,114 @@
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <media/v4l2-ctrls.h> 24#include <media/v4l2-ctrls.h>
25#include <media/videobuf2-core.h> 25#include <media/videobuf2-core.h>
26#include "regs-mfc.h"
27#include "s5p_mfc_common.h" 26#include "s5p_mfc_common.h"
28#include "s5p_mfc_debug.h" 27#include "s5p_mfc_debug.h"
29#include "s5p_mfc_dec.h" 28#include "s5p_mfc_dec.h"
30#include "s5p_mfc_intr.h" 29#include "s5p_mfc_intr.h"
31#include "s5p_mfc_opr.h" 30#include "s5p_mfc_opr.h"
32#include "s5p_mfc_pm.h" 31#include "s5p_mfc_pm.h"
33#include "s5p_mfc_shm.h" 32
33#define DEF_SRC_FMT_DEC V4L2_PIX_FMT_H264
34#define DEF_DST_FMT_DEC V4L2_PIX_FMT_NV12MT_16X16
34 35
35static struct s5p_mfc_fmt formats[] = { 36static struct s5p_mfc_fmt formats[] = {
36 { 37 {
38 .name = "4:2:0 2 Planes 16x16 Tiles",
39 .fourcc = V4L2_PIX_FMT_NV12MT_16X16,
40 .codec_mode = S5P_MFC_CODEC_NONE,
41 .type = MFC_FMT_RAW,
42 .num_planes = 2,
43 },
44 {
37 .name = "4:2:0 2 Planes 64x32 Tiles", 45 .name = "4:2:0 2 Planes 64x32 Tiles",
38 .fourcc = V4L2_PIX_FMT_NV12MT, 46 .fourcc = V4L2_PIX_FMT_NV12MT,
39 .codec_mode = S5P_FIMV_CODEC_NONE, 47 .codec_mode = S5P_MFC_CODEC_NONE,
40 .type = MFC_FMT_RAW, 48 .type = MFC_FMT_RAW,
41 .num_planes = 2, 49 .num_planes = 2,
42 }, 50 },
43 { 51 {
44 .name = "4:2:0 2 Planes", 52 .name = "4:2:0 2 Planes Y/CbCr",
45 .fourcc = V4L2_PIX_FMT_NV12M, 53 .fourcc = V4L2_PIX_FMT_NV12M,
46 .codec_mode = S5P_FIMV_CODEC_NONE, 54 .codec_mode = S5P_MFC_CODEC_NONE,
47 .type = MFC_FMT_RAW, 55 .type = MFC_FMT_RAW,
48 .num_planes = 2, 56 .num_planes = 2,
57 },
58 {
59 .name = "4:2:0 2 Planes Y/CrCb",
60 .fourcc = V4L2_PIX_FMT_NV21M,
61 .codec_mode = S5P_MFC_CODEC_NONE,
62 .type = MFC_FMT_RAW,
63 .num_planes = 2,
49 }, 64 },
50 { 65 {
51 .name = "H264 Encoded Stream", 66 .name = "H264 Encoded Stream",
52 .fourcc = V4L2_PIX_FMT_H264, 67 .fourcc = V4L2_PIX_FMT_H264,
53 .codec_mode = S5P_FIMV_CODEC_H264_DEC, 68 .codec_mode = S5P_MFC_CODEC_H264_DEC,
54 .type = MFC_FMT_DEC, 69 .type = MFC_FMT_DEC,
55 .num_planes = 1, 70 .num_planes = 1,
56 }, 71 },
57 { 72 {
58 .name = "H263 Encoded Stream", 73 .name = "H264/MVC Encoded Stream",
59 .fourcc = V4L2_PIX_FMT_H263, 74 .fourcc = V4L2_PIX_FMT_H264_MVC,
60 .codec_mode = S5P_FIMV_CODEC_H263_DEC, 75 .codec_mode = S5P_MFC_CODEC_H264_MVC_DEC,
61 .type = MFC_FMT_DEC, 76 .type = MFC_FMT_DEC,
62 .num_planes = 1, 77 .num_planes = 1,
63 }, 78 },
64 { 79 {
65 .name = "MPEG1 Encoded Stream", 80 .name = "H263 Encoded Stream",
66 .fourcc = V4L2_PIX_FMT_MPEG1, 81 .fourcc = V4L2_PIX_FMT_H263,
67 .codec_mode = S5P_FIMV_CODEC_MPEG2_DEC, 82 .codec_mode = S5P_MFC_CODEC_H263_DEC,
68 .type = MFC_FMT_DEC, 83 .type = MFC_FMT_DEC,
69 .num_planes = 1, 84 .num_planes = 1,
70 }, 85 },
71 { 86 {
72 .name = "MPEG2 Encoded Stream", 87 .name = "MPEG1 Encoded Stream",
73 .fourcc = V4L2_PIX_FMT_MPEG2, 88 .fourcc = V4L2_PIX_FMT_MPEG1,
74 .codec_mode = S5P_FIMV_CODEC_MPEG2_DEC, 89 .codec_mode = S5P_MFC_CODEC_MPEG2_DEC,
75 .type = MFC_FMT_DEC, 90 .type = MFC_FMT_DEC,
76 .num_planes = 1, 91 .num_planes = 1,
77 }, 92 },
78 { 93 {
79 .name = "MPEG4 Encoded Stream", 94 .name = "MPEG2 Encoded Stream",
80 .fourcc = V4L2_PIX_FMT_MPEG4, 95 .fourcc = V4L2_PIX_FMT_MPEG2,
81 .codec_mode = S5P_FIMV_CODEC_MPEG4_DEC, 96 .codec_mode = S5P_MFC_CODEC_MPEG2_DEC,
82 .type = MFC_FMT_DEC, 97 .type = MFC_FMT_DEC,
83 .num_planes = 1, 98 .num_planes = 1,
84 }, 99 },
85 { 100 {
86 .name = "XviD Encoded Stream", 101 .name = "MPEG4 Encoded Stream",
87 .fourcc = V4L2_PIX_FMT_XVID, 102 .fourcc = V4L2_PIX_FMT_MPEG4,
88 .codec_mode = S5P_FIMV_CODEC_MPEG4_DEC, 103 .codec_mode = S5P_MFC_CODEC_MPEG4_DEC,
89 .type = MFC_FMT_DEC, 104 .type = MFC_FMT_DEC,
90 .num_planes = 1, 105 .num_planes = 1,
91 }, 106 },
92 { 107 {
93 .name = "VC1 Encoded Stream", 108 .name = "XviD Encoded Stream",
94 .fourcc = V4L2_PIX_FMT_VC1_ANNEX_G, 109 .fourcc = V4L2_PIX_FMT_XVID,
95 .codec_mode = S5P_FIMV_CODEC_VC1_DEC, 110 .codec_mode = S5P_MFC_CODEC_MPEG4_DEC,
96 .type = MFC_FMT_DEC, 111 .type = MFC_FMT_DEC,
97 .num_planes = 1, 112 .num_planes = 1,
98 }, 113 },
99 { 114 {
100 .name = "VC1 RCV Encoded Stream", 115 .name = "VC1 Encoded Stream",
101 .fourcc = V4L2_PIX_FMT_VC1_ANNEX_L, 116 .fourcc = V4L2_PIX_FMT_VC1_ANNEX_G,
102 .codec_mode = S5P_FIMV_CODEC_VC1RCV_DEC, 117 .codec_mode = S5P_MFC_CODEC_VC1_DEC,
103 .type = MFC_FMT_DEC, 118 .type = MFC_FMT_DEC,
104 .num_planes = 1, 119 .num_planes = 1,
120 },
121 {
122 .name = "VC1 RCV Encoded Stream",
123 .fourcc = V4L2_PIX_FMT_VC1_ANNEX_L,
124 .codec_mode = S5P_MFC_CODEC_VC1RCV_DEC,
125 .type = MFC_FMT_DEC,
126 .num_planes = 1,
127 },
128 {
129 .name = "VP8 Encoded Stream",
130 .fourcc = V4L2_PIX_FMT_VP8,
131 .codec_mode = S5P_MFC_CODEC_VP8_DEC,
132 .type = MFC_FMT_DEC,
133 .num_planes = 1,
105 }, 134 },
106}; 135};
107 136
@@ -297,7 +326,7 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
297 /* If the MFC is parsing the header, 326 /* If the MFC is parsing the header,
298 * so wait until it is finished */ 327 * so wait until it is finished */
299 s5p_mfc_clean_ctx_int_flags(ctx); 328 s5p_mfc_clean_ctx_int_flags(ctx);
300 s5p_mfc_wait_for_done_ctx(ctx, S5P_FIMV_R2H_CMD_SEQ_DONE_RET, 329 s5p_mfc_wait_for_done_ctx(ctx, S5P_MFC_R2H_CMD_SEQ_DONE_RET,
301 0); 330 0);
302 } 331 }
303 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE && 332 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE &&
@@ -342,21 +371,36 @@ static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
342/* Try format */ 371/* Try format */
343static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f) 372static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
344{ 373{
374 struct s5p_mfc_dev *dev = video_drvdata(file);
345 struct s5p_mfc_fmt *fmt; 375 struct s5p_mfc_fmt *fmt;
346 376
347 if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 377 mfc_debug(2, "Type is %d\n", f->type);
348 mfc_err("This node supports decoding only\n"); 378 if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
349 return -EINVAL; 379 fmt = find_format(f, MFC_FMT_DEC);
350 } 380 if (!fmt) {
351 fmt = find_format(f, MFC_FMT_DEC); 381 mfc_err("Unsupported format for source.\n");
352 if (!fmt) { 382 return -EINVAL;
353 mfc_err("Unsupported format\n"); 383 }
354 return -EINVAL; 384 if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) {
355 } 385 mfc_err("Not supported format.\n");
356 if (fmt->type != MFC_FMT_DEC) { 386 return -EINVAL;
357 mfc_err("\n"); 387 }
358 return -EINVAL; 388 } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
389 fmt = find_format(f, MFC_FMT_RAW);
390 if (!fmt) {
391 mfc_err("Unsupported format for destination.\n");
392 return -EINVAL;
393 }
394 if (IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) {
395 mfc_err("Not supported format.\n");
396 return -EINVAL;
397 } else if (!IS_MFCV6(dev) &&
398 (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) {
399 mfc_err("Not supported format.\n");
400 return -EINVAL;
401 }
359 } 402 }
403
360 return 0; 404 return 0;
361} 405}
362 406
@@ -379,8 +423,29 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
379 ret = -EBUSY; 423 ret = -EBUSY;
380 goto out; 424 goto out;
381 } 425 }
426 if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
427 fmt = find_format(f, MFC_FMT_RAW);
428 if (!fmt) {
429 mfc_err("Unsupported format for source.\n");
430 return -EINVAL;
431 }
432 if (!IS_MFCV6(dev) && (fmt->fourcc != V4L2_PIX_FMT_NV12MT)) {
433 mfc_err("Not supported format.\n");
434 return -EINVAL;
435 } else if (IS_MFCV6(dev) &&
436 (fmt->fourcc == V4L2_PIX_FMT_NV12MT)) {
437 mfc_err("Not supported format.\n");
438 return -EINVAL;
439 }
440 ctx->dst_fmt = fmt;
441 mfc_debug_leave();
442 return ret;
443 } else if (f->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
444 mfc_err("Wrong type error for S_FMT : %d", f->type);
445 return -EINVAL;
446 }
382 fmt = find_format(f, MFC_FMT_DEC); 447 fmt = find_format(f, MFC_FMT_DEC);
383 if (!fmt || fmt->codec_mode == S5P_FIMV_CODEC_NONE) { 448 if (!fmt || fmt->codec_mode == S5P_MFC_CODEC_NONE) {
384 mfc_err("Unknown codec\n"); 449 mfc_err("Unknown codec\n");
385 ret = -EINVAL; 450 ret = -EINVAL;
386 goto out; 451 goto out;
@@ -391,6 +456,10 @@ static int vidioc_s_fmt(struct file *file, void *priv, struct v4l2_format *f)
391 ret = -EINVAL; 456 ret = -EINVAL;
392 goto out; 457 goto out;
393 } 458 }
459 if (!IS_MFCV6(dev) && (fmt->fourcc == V4L2_PIX_FMT_VP8)) {
460 mfc_err("Not supported format.\n");
461 return -EINVAL;
462 }
394 ctx->src_fmt = fmt; 463 ctx->src_fmt = fmt;
395 ctx->codec_mode = fmt->codec_mode; 464 ctx->codec_mode = fmt->codec_mode;
396 mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode); 465 mfc_debug(2, "The codec number is: %d\n", ctx->codec_mode);
@@ -476,7 +545,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
476 return -ENOMEM; 545 return -ENOMEM;
477 } 546 }
478 ctx->total_dpb_count = reqbufs->count; 547 ctx->total_dpb_count = reqbufs->count;
479 ret = s5p_mfc_alloc_codec_buffers(ctx); 548 ret = s5p_mfc_hw_call(dev->mfc_ops, alloc_codec_buffers, ctx);
480 if (ret) { 549 if (ret) {
481 mfc_err("Failed to allocate decoding buffers\n"); 550 mfc_err("Failed to allocate decoding buffers\n");
482 reqbufs->count = 0; 551 reqbufs->count = 0;
@@ -492,15 +561,16 @@ static int vidioc_reqbufs(struct file *file, void *priv,
492 reqbufs->count = 0; 561 reqbufs->count = 0;
493 s5p_mfc_clock_on(); 562 s5p_mfc_clock_on();
494 ret = vb2_reqbufs(&ctx->vq_dst, reqbufs); 563 ret = vb2_reqbufs(&ctx->vq_dst, reqbufs);
495 s5p_mfc_release_codec_buffers(ctx); 564 s5p_mfc_hw_call(dev->mfc_ops, release_codec_buffers,
565 ctx);
496 s5p_mfc_clock_off(); 566 s5p_mfc_clock_off();
497 return -ENOMEM; 567 return -ENOMEM;
498 } 568 }
499 if (s5p_mfc_ctx_ready(ctx)) 569 if (s5p_mfc_ctx_ready(ctx))
500 set_work_bit_irqsave(ctx); 570 set_work_bit_irqsave(ctx);
501 s5p_mfc_try_run(dev); 571 s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
502 s5p_mfc_wait_for_done_ctx(ctx, 572 s5p_mfc_wait_for_done_ctx(ctx,
503 S5P_FIMV_R2H_CMD_INIT_BUFFERS_RET, 0); 573 S5P_MFC_R2H_CMD_INIT_BUFFERS_RET, 0);
504 } 574 }
505 return ret; 575 return ret;
506} 576}
@@ -582,18 +652,22 @@ static int vidioc_streamon(struct file *file, void *priv,
582 ctx->src_bufs_cnt = 0; 652 ctx->src_bufs_cnt = 0;
583 ctx->capture_state = QUEUE_FREE; 653 ctx->capture_state = QUEUE_FREE;
584 ctx->output_state = QUEUE_FREE; 654 ctx->output_state = QUEUE_FREE;
585 s5p_mfc_alloc_instance_buffer(ctx); 655 s5p_mfc_hw_call(dev->mfc_ops, alloc_instance_buffer,
586 s5p_mfc_alloc_dec_temp_buffers(ctx); 656 ctx);
657 s5p_mfc_hw_call(dev->mfc_ops, alloc_dec_temp_buffers,
658 ctx);
587 set_work_bit_irqsave(ctx); 659 set_work_bit_irqsave(ctx);
588 s5p_mfc_clean_ctx_int_flags(ctx); 660 s5p_mfc_clean_ctx_int_flags(ctx);
589 s5p_mfc_try_run(dev); 661 s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
590 662
591 if (s5p_mfc_wait_for_done_ctx(ctx, 663 if (s5p_mfc_wait_for_done_ctx(ctx,
592 S5P_FIMV_R2H_CMD_OPEN_INSTANCE_RET, 0)) { 664 S5P_MFC_R2H_CMD_OPEN_INSTANCE_RET, 0)) {
593 /* Error or timeout */ 665 /* Error or timeout */
594 mfc_err("Error getting instance from hardware\n"); 666 mfc_err("Error getting instance from hardware\n");
595 s5p_mfc_release_instance_buffer(ctx); 667 s5p_mfc_hw_call(dev->mfc_ops,
596 s5p_mfc_release_dec_desc_buffer(ctx); 668 release_instance_buffer, ctx);
669 s5p_mfc_hw_call(dev->mfc_ops,
670 release_dec_desc_buffer, ctx);
597 return -EIO; 671 return -EIO;
598 } 672 }
599 mfc_debug(2, "Got instance number: %d\n", ctx->inst_no); 673 mfc_debug(2, "Got instance number: %d\n", ctx->inst_no);
@@ -662,7 +736,7 @@ static int s5p_mfc_dec_g_v_ctrl(struct v4l2_ctrl *ctrl)
662 /* Should wait for the header to be parsed */ 736 /* Should wait for the header to be parsed */
663 s5p_mfc_clean_ctx_int_flags(ctx); 737 s5p_mfc_clean_ctx_int_flags(ctx);
664 s5p_mfc_wait_for_done_ctx(ctx, 738 s5p_mfc_wait_for_done_ctx(ctx,
665 S5P_FIMV_R2H_CMD_SEQ_DONE_RET, 0); 739 S5P_MFC_R2H_CMD_SEQ_DONE_RET, 0);
666 if (ctx->state >= MFCINST_HEAD_PARSED && 740 if (ctx->state >= MFCINST_HEAD_PARSED &&
667 ctx->state < MFCINST_ABORT) { 741 ctx->state < MFCINST_ABORT) {
668 ctrl->val = ctx->dpb_count; 742 ctrl->val = ctx->dpb_count;
@@ -686,6 +760,7 @@ static int vidioc_g_crop(struct file *file, void *priv,
686 struct v4l2_crop *cr) 760 struct v4l2_crop *cr)
687{ 761{
688 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv); 762 struct s5p_mfc_ctx *ctx = fh_to_ctx(priv);
763 struct s5p_mfc_dev *dev = ctx->dev;
689 u32 left, right, top, bottom; 764 u32 left, right, top, bottom;
690 765
691 if (ctx->state != MFCINST_HEAD_PARSED && 766 if (ctx->state != MFCINST_HEAD_PARSED &&
@@ -695,10 +770,10 @@ static int vidioc_g_crop(struct file *file, void *priv,
695 return -EINVAL; 770 return -EINVAL;
696 } 771 }
697 if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) { 772 if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_H264) {
698 left = s5p_mfc_read_shm(ctx, CROP_INFO_H); 773 left = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_h, ctx);
699 right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT; 774 right = left >> S5P_FIMV_SHARED_CROP_RIGHT_SHIFT;
700 left = left & S5P_FIMV_SHARED_CROP_LEFT_MASK; 775 left = left & S5P_FIMV_SHARED_CROP_LEFT_MASK;
701 top = s5p_mfc_read_shm(ctx, CROP_INFO_V); 776 top = s5p_mfc_hw_call(dev->mfc_ops, get_crop_info_v, ctx);
702 bottom = top >> S5P_FIMV_SHARED_CROP_BOTTOM_SHIFT; 777 bottom = top >> S5P_FIMV_SHARED_CROP_BOTTOM_SHIFT;
703 top = top & S5P_FIMV_SHARED_CROP_TOP_MASK; 778 top = top & S5P_FIMV_SHARED_CROP_TOP_MASK;
704 cr->c.left = left; 779 cr->c.left = left;
@@ -749,6 +824,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
749 void *allocators[]) 824 void *allocators[])
750{ 825{
751 struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv); 826 struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
827 struct s5p_mfc_dev *dev = ctx->dev;
752 828
753 /* Video output for decoding (source) 829 /* Video output for decoding (source)
754 * this can be set after getting an instance */ 830 * this can be set after getting an instance */
@@ -784,7 +860,13 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
784 vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 860 vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
785 psize[0] = ctx->luma_size; 861 psize[0] = ctx->luma_size;
786 psize[1] = ctx->chroma_size; 862 psize[1] = ctx->chroma_size;
787 allocators[0] = ctx->dev->alloc_ctx[MFC_BANK2_ALLOC_CTX]; 863
864 if (IS_MFCV6(dev))
865 allocators[0] =
866 ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX];
867 else
868 allocators[0] =
869 ctx->dev->alloc_ctx[MFC_BANK2_ALLOC_CTX];
788 allocators[1] = ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX]; 870 allocators[1] = ctx->dev->alloc_ctx[MFC_BANK1_ALLOC_CTX];
789 } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && 871 } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&
790 ctx->state == MFCINST_INIT) { 872 ctx->state == MFCINST_INIT) {
@@ -876,7 +958,7 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
876 /* If context is ready then dev = work->data;schedule it to run */ 958 /* If context is ready then dev = work->data;schedule it to run */
877 if (s5p_mfc_ctx_ready(ctx)) 959 if (s5p_mfc_ctx_ready(ctx))
878 set_work_bit_irqsave(ctx); 960 set_work_bit_irqsave(ctx);
879 s5p_mfc_try_run(dev); 961 s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
880 return 0; 962 return 0;
881} 963}
882 964
@@ -892,19 +974,21 @@ static int s5p_mfc_stop_streaming(struct vb2_queue *q)
892 dev->curr_ctx == ctx->num && dev->hw_lock) { 974 dev->curr_ctx == ctx->num && dev->hw_lock) {
893 ctx->state = MFCINST_ABORT; 975 ctx->state = MFCINST_ABORT;
894 s5p_mfc_wait_for_done_ctx(ctx, 976 s5p_mfc_wait_for_done_ctx(ctx,
895 S5P_FIMV_R2H_CMD_FRAME_DONE_RET, 0); 977 S5P_MFC_R2H_CMD_FRAME_DONE_RET, 0);
896 aborted = 1; 978 aborted = 1;
897 } 979 }
898 spin_lock_irqsave(&dev->irqlock, flags); 980 spin_lock_irqsave(&dev->irqlock, flags);
899 if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { 981 if (q->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
900 s5p_mfc_cleanup_queue(&ctx->dst_queue, &ctx->vq_dst); 982 s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->dst_queue,
983 &ctx->vq_dst);
901 INIT_LIST_HEAD(&ctx->dst_queue); 984 INIT_LIST_HEAD(&ctx->dst_queue);
902 ctx->dst_queue_cnt = 0; 985 ctx->dst_queue_cnt = 0;
903 ctx->dpb_flush_flag = 1; 986 ctx->dpb_flush_flag = 1;
904 ctx->dec_dst_flag = 0; 987 ctx->dec_dst_flag = 0;
905 } 988 }
906 if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { 989 if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
907 s5p_mfc_cleanup_queue(&ctx->src_queue, &ctx->vq_src); 990 s5p_mfc_hw_call(dev->mfc_ops, cleanup_queue, &ctx->src_queue,
991 &ctx->vq_src);
908 INIT_LIST_HEAD(&ctx->src_queue); 992 INIT_LIST_HEAD(&ctx->src_queue);
909 ctx->src_queue_cnt = 0; 993 ctx->src_queue_cnt = 0;
910 } 994 }
@@ -944,7 +1028,7 @@ static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
944 } 1028 }
945 if (s5p_mfc_ctx_ready(ctx)) 1029 if (s5p_mfc_ctx_ready(ctx))
946 set_work_bit_irqsave(ctx); 1030 set_work_bit_irqsave(ctx);
947 s5p_mfc_try_run(dev); 1031 s5p_mfc_hw_call(dev->mfc_ops, try_run, dev);
948} 1032}
949 1033
950static struct vb2_ops s5p_mfc_dec_qops = { 1034static struct vb2_ops s5p_mfc_dec_qops = {
@@ -1028,3 +1112,13 @@ void s5p_mfc_dec_ctrls_delete(struct s5p_mfc_ctx *ctx)
1028 ctx->ctrls[i] = NULL; 1112 ctx->ctrls[i] = NULL;
1029} 1113}
1030 1114
1115void s5p_mfc_dec_init(struct s5p_mfc_ctx *ctx)
1116{
1117 struct v4l2_format f;
1118 f.fmt.pix_mp.pixelformat = DEF_SRC_FMT_DEC;
1119 ctx->src_fmt = find_format(&f, MFC_FMT_DEC);
1120 f.fmt.pix_mp.pixelformat = DEF_DST_FMT_DEC;
1121 ctx->dst_fmt = find_format(&f, MFC_FMT_RAW);
1122 mfc_debug(2, "Default src_fmt is %x, dest_fmt is %x\n",
1123 (unsigned int)ctx->src_fmt, (unsigned int)ctx->dst_fmt);
1124}