diff for duplicates of <0fe401da20ff$5e47e410$1ad7ac30$@samsung.com> diff --git a/a/1.txt b/N1/1.txt index 4e26f47..1073ffd 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -18,926 +18,934 @@ Hi Nicolas, > Subject: Re: [Patch v4 04/11] media: s5p-mfc: Add YV12 and I420 multiplanar > format support > -> Le mercredi 25 octobre 2023 à 15:52 +0530, Aakarsh Jain a écrit :\r -> > YV12 and I420 format (3-plane) support is added. Stride information is\r -> > added to all formats and planes since it is necessary for YV12/I420\r -> > which are different from width.\r -> >\r -> > Cc: linux-fsd@tesla.com\r -> > Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com>\r -> > Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>\r -> > ---\r -> > .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 2 +\r -> > .../platform/samsung/s5p-mfc/regs-mfc-v7.h | 1 +\r -> > .../platform/samsung/s5p-mfc/regs-mfc-v8.h | 3 +\r -> > .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 4 +\r -> > .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 45 ++++-\r -> > .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 86 +++++++--\r -> > .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 6 +-\r -> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 12 +-\r -> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 168\r -> +++++++++++++++---\r -> > 9 files changed, 281 insertions(+), 46 deletions(-)\r -> >\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r -> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r -> > index 6c68a45082d0..70464f47c1f9 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r -> > @@ -26,6 +26,8 @@\r -> > #define MFC_VERSION_V12 0xC0\r -> > #define MFC_NUM_PORTS_V12 1\r -> > #define S5P_FIMV_CODEC_VP9_ENC 27\r -> > +#define MFC_CHROMA_PAD_BYTES_V12 256\r -> > +#define S5P_FIMV_D_ALIGN_PLANE_SIZE_V12 256\r -> >\r -> > /* Encoder buffer size for MFCv12 */\r -> > #define ENC_V120_BASE_SIZE(x, y) \\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r -> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r -> > index 4a7adfdaa359..50f9bf0603c1 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r -> > @@ -24,6 +24,7 @@\r -> >\r -> > #define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7\r -> 0xfa70\r -> > #define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7\r -> 0xfa74\r -> > +#define S5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7\r -> 0xfa78\r -> >\r -> > #define S5P_FIMV_E_VP8_OPTIONS_V7 0xfdb0\r -> > #define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7 0xfdb4\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r -> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r -> > index 162e3c7e920f..0ef9eb2dff22 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r -> > @@ -17,13 +17,16 @@\r -> > #define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8 0xf108\r -> > #define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8 0xf144\r -> > #define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8 0xf148\r -> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8 0xf14C\r -> > #define S5P_FIMV_D_MV_BUFFER_SIZE_V8 0xf150\r -> >\r -> > #define S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8 0xf138\r -> > #define S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8\r -> 0xf13c\r -> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8\r -> 0xf140\r -> >\r -> > #define S5P_FIMV_D_FIRST_PLANE_DPB_V8 0xf160\r -> > #define S5P_FIMV_D_SECOND_PLANE_DPB_V8 0xf260\r -> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_V8 0xf360\r -> > #define S5P_FIMV_D_MV_BUFFER_V8 0xf460\r -> >\r -> > #define S5P_FIMV_D_NUM_MV_V8 0xf134\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r -> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r -> > index dd2e9f7704ab..9a39cccfe002 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r -> > @@ -56,6 +56,7 @@\r -> > #define MFC_NO_INSTANCE_SET -1\r -> > #define MFC_ENC_CAP_PLANE_COUNT 1\r -> > #define MFC_ENC_OUT_PLANE_COUNT 2\r -> > +#define VB2_MAX_PLANE_COUNT 3\r -> > #define STUFF_BYTE 4\r -> > #define MFC_MAX_CTRLS 128\r -> >\r -> > @@ -181,6 +182,7 @@ struct s5p_mfc_buf {\r -> > struct {\r -> > size_t luma;\r -> > size_t chroma;\r -> > + size_t chroma_1;\r -> > } raw;\r -> > size_t stream;\r -> > } cookie;\r -> > @@ -657,6 +659,7 @@ struct s5p_mfc_ctx {\r -> >\r -> > int luma_size;\r -> > int chroma_size;\r -> > + int chroma_size_1;\r -> > int mv_size;\r -> >\r -> > unsigned long consumed_stream;\r -> > @@ -722,6 +725,7 @@ struct s5p_mfc_ctx {\r -> > size_t scratch_buf_size;\r -> > int is_10bit;\r -> > int is_422;\r -> > + int stride[VB2_MAX_PLANE_COUNT];\r -> > };\r -> >\r -> > /*\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r -> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r -> > index e219cbcd86d5..317f796fffa1 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r -> > @@ -56,6 +56,20 @@ static struct s5p_mfc_fmt formats[] = {\r -> > .num_planes = 2,\r -> > .versions = MFC_V6PLUS_BITS,\r -> > },\r -> > + {\r -> > + .fourcc = V4L2_PIX_FMT_YUV420M,\r -> > + .codec_mode = S5P_MFC_CODEC_NONE,\r -> > + .type = MFC_FMT_RAW,\r -> > + .num_planes = 3,\r -> > + .versions = MFC_V12_BIT,\r -> > + },\r -> > + {\r -> > + .fourcc = V4L2_PIX_FMT_YVU420M,\r -> > + .codec_mode = S5P_MFC_CODEC_NONE,\r -> > + .type = MFC_FMT_RAW,\r -> > + .num_planes = 3,\r -> > + .versions = MFC_V12_BIT\r -> > + },\r -> > {\r -> > .fourcc = V4L2_PIX_FMT_H264,\r -> > .codec_mode = S5P_MFC_CODEC_H264_DEC,\r -> > @@ -359,10 +373,15 @@ static int vidioc_g_fmt(struct file *file, void *priv,\r -> struct v4l2_format *f)\r -> > /* Set pixelformat to the format in which MFC\r -> > outputs the decoded frame */\r -> > pix_mp->pixelformat = ctx->dst_fmt->fourcc;\r -> > - pix_mp->plane_fmt[0].bytesperline = ctx->buf_width;\r -> > + pix_mp->plane_fmt[0].bytesperline = ctx->stride[0];\r -> > pix_mp->plane_fmt[0].sizeimage = ctx->luma_size;\r -> > - pix_mp->plane_fmt[1].bytesperline = ctx->buf_width;\r -> > + pix_mp->plane_fmt[1].bytesperline = ctx->stride[1];\r -> > pix_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M) {\r -> > + pix_mp->plane_fmt[2].bytesperline = ctx->stride[2];\r -> > + pix_mp->plane_fmt[2].sizeimage = ctx-\r -> >chroma_size_1;\r -> > + }\r -> > } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {\r -> > /* This is run on OUTPUT\r -> > The buffer contains compressed image @@ -937,6 +956,9\r -> @@ static\r -> > int s5p_mfc_queue_setup(struct vb2_queue *vq,\r -> > vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {\r -> > /* Output plane count is 2 - one for Y and one for CbCr */\r -> > *plane_count = 2;\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + *plane_count = 3;\r -> \r -> I don't usually interfere, this is your driver to maintain, but this becomes\r -> horribly messy. Have you consider de-hardcoding a little and encapsulate per\r -> HW format details into a C structure ? Drivers these days try to make sure of\r -> v4l2- common library, which as a matter of fact knows that YUV420M and\r -> YVU420M have 3 places, so that you don't have to duplicate it in your driver.\r -> \r -> regards,\r -> Nicolas\r -\r -Thanks for pointing out.\r -We could have done it in this way ' *plane_count = ctx->dst_fmt->num_planes' also.\r -Anyway, will make use of ' v4l2- common library ' for getting the planes count here in next series.\r -\r -Thanks for the review.\r -> \r -> > /* Setup buffer count */\r -> > if (*buf_count < ctx->pb_count)\r -> > *buf_count = ctx->pb_count;\r -> > @@ -955,12 +977,17 @@ static int s5p_mfc_queue_setup(struct\r -> vb2_queue *vq,\r -> > vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {\r -> > psize[0] = ctx->luma_size;\r -> > psize[1] = ctx->chroma_size;\r -> > -\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + psize[2] = ctx->chroma_size_1;\r -> > if (IS_MFCV6_PLUS(dev))\r -> > alloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX];\r -> > else\r -> > alloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX];\r -> > alloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX];\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + alloc_devs[2] = ctx->dev->mem_dev[BANK_L_CTX];\r -> > } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&\r -> > ctx->state == MFCINST_INIT) {\r -> > psize[0] = ctx->dec_src_buf_size;\r -> > @@ -994,12 +1021,24 @@ static int s5p_mfc_buf_init(struct vb2_buffer\r -> *vb)\r -> > mfc_err("Plane buffer (CAPTURE) is too small\n");\r -> > return -EINVAL;\r -> > }\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M) {\r -> > + if (vb2_plane_size(vb, 2) < ctx->chroma_size_1) {\r -> > + mfc_err("Plane buffer (CAPTURE) is too\r -> small\n");\r -> > + return -EINVAL;\r -> > + }\r -> > + }\r -> > i = vb->index;\r -> > ctx->dst_bufs[i].b = vbuf;\r -> > ctx->dst_bufs[i].cookie.raw.luma =\r -> >\r -> vb2_dma_contig_plane_dma_addr(vb, 0);\r -> > ctx->dst_bufs[i].cookie.raw.chroma =\r -> >\r -> vb2_dma_contig_plane_dma_addr(vb, 1);\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M) {\r -> > + ctx->dst_bufs[i].cookie.raw.chroma_1 =\r -> > +\r -> vb2_dma_contig_plane_dma_addr(vb, 2);\r -> > + }\r -> > ctx->dst_bufs_cnt++;\r -> > } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {\r -> > if (IS_ERR_OR_NULL(ERR_PTR(\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r -> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r -> > index e4d6e7c117b5..0eec04eb3ef3 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r -> > @@ -59,6 +59,20 @@ static struct s5p_mfc_fmt formats[] = {\r -> > .num_planes = 2,\r -> > .versions = MFC_V6PLUS_BITS,\r -> > },\r -> > + {\r -> > + .fourcc = V4L2_PIX_FMT_YUV420M,\r -> > + .codec_mode = S5P_MFC_CODEC_NONE,\r -> > + .type = MFC_FMT_RAW,\r -> > + .num_planes = 3,\r -> > + .versions = MFC_V12_BIT,\r -> > + },\r -> > + {\r -> > + .fourcc = V4L2_PIX_FMT_YVU420M,\r -> > + .codec_mode = S5P_MFC_CODEC_NONE,\r -> > + .type = MFC_FMT_RAW,\r -> > + .num_planes = 3,\r -> > + .versions = MFC_V12_BIT,\r -> > + },\r -> > {\r -> > .fourcc = V4L2_PIX_FMT_H264,\r -> > .codec_mode = S5P_MFC_CODEC_H264_ENC,\r -> > @@ -1193,14 +1207,20 @@ static int enc_pre_frame_start(struct\r -> s5p_mfc_ctx *ctx)\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> > struct s5p_mfc_buf *dst_mb;\r -> > struct s5p_mfc_buf *src_mb;\r -> > - unsigned long src_y_addr, src_c_addr, dst_addr;\r -> > + unsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr;\r -> > unsigned int dst_size;\r -> >\r -> > src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);\r -> > src_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b-\r -> >vb2_buf, 0);\r -> > src_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b-\r -> >vb2_buf, 1);\r -> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r -> > + src_c_1_addr =\r -> > + vb2_dma_contig_plane_dma_addr(&src_mb->b-\r -> >vb2_buf, 2);\r -> > + else\r -> > + src_c_1_addr = 0;\r -> > s5p_mfc_hw_call(dev->mfc_ops, set_enc_frame_buffer, ctx,\r -> > - src_y_addr,\r -> src_c_addr);\r -> > + src_y_addr, src_c_addr,\r -> src_c_1_addr);\r -> >\r -> > dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);\r -> > dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b-\r -> >vb2_buf, 0); @@\r -> > -1215,8 +1235,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx\r -> > *ctx) {\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> > struct s5p_mfc_buf *mb_entry;\r -> > - unsigned long enc_y_addr = 0, enc_c_addr = 0;\r -> > - unsigned long mb_y_addr, mb_c_addr;\r -> > + unsigned long enc_y_addr = 0, enc_c_addr = 0, enc_c_1_addr = 0;\r -> > + unsigned long mb_y_addr, mb_c_addr, mb_c_1_addr;\r -> > int slice_type;\r -> > unsigned int strm_size;\r -> > bool src_ready;\r -> > @@ -1229,14 +1249,21 @@ static int enc_post_frame_start(struct\r -> s5p_mfc_ctx *ctx)\r -> > mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT));\r -> > if (slice_type >= 0) {\r -> > s5p_mfc_hw_call(dev->mfc_ops, get_enc_frame_buffer,\r -> ctx,\r -> > - &enc_y_addr, &enc_c_addr);\r -> > + &enc_y_addr, &enc_c_addr,\r -> &enc_c_1_addr);\r -> > list_for_each_entry(mb_entry, &ctx->src_queue, list) {\r -> > mb_y_addr = vb2_dma_contig_plane_dma_addr(\r -> > &mb_entry->b->vb2_buf, 0);\r -> > mb_c_addr = vb2_dma_contig_plane_dma_addr(\r -> > &mb_entry->b->vb2_buf, 1);\r -> > - if ((enc_y_addr == mb_y_addr) &&\r -> > - (enc_c_addr == mb_c_addr))\r -> {\r -> > + if (ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + mb_c_1_addr =\r -> vb2_dma_contig_plane_dma_addr\r -> > + (&mb_entry->b->vb2_buf,\r -> 2);\r -> > + else\r -> > + mb_c_1_addr = 0;\r -> > + if ((enc_y_addr == mb_y_addr)\r -> > + && (enc_c_addr == mb_c_addr)\r -> > + && (enc_c_1_addr ==\r -> mb_c_1_addr)) {\r -> > list_del(&mb_entry->list);\r -> > ctx->src_queue_cnt--;\r -> > vb2_buffer_done(&mb_entry->b->vb2_buf,\r -> > @@ -1249,8 +1276,15 @@ static int enc_post_frame_start(struct\r -> s5p_mfc_ctx *ctx)\r -> > &mb_entry->b->vb2_buf, 0);\r -> > mb_c_addr = vb2_dma_contig_plane_dma_addr(\r -> > &mb_entry->b->vb2_buf, 1);\r -> > - if ((enc_y_addr == mb_y_addr) &&\r -> > - (enc_c_addr == mb_c_addr))\r -> {\r -> > + if (ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + mb_c_1_addr =\r -> vb2_dma_contig_plane_dma_addr(\r -> > + &mb_entry->b->vb2_buf, 2);\r -> > + else\r -> > + mb_c_1_addr = 0;\r -> > + if ((enc_y_addr == mb_y_addr)\r -> > + && (enc_c_addr == mb_c_addr)\r -> > + && (enc_c_1_addr ==\r -> mb_c_1_addr)) {\r -> > list_del(&mb_entry->list);\r -> > ctx->ref_queue_cnt--;\r -> > vb2_buffer_done(&mb_entry->b->vb2_buf,\r -> > @@ -1381,10 +1415,15 @@ static int vidioc_g_fmt(struct file *file, void\r -> *priv, struct v4l2_format *f)\r -> > pix_fmt_mp->pixelformat = ctx->src_fmt->fourcc;\r -> > pix_fmt_mp->num_planes = ctx->src_fmt->num_planes;\r -> >\r -> > - pix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width;\r -> > + pix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0];\r -> > pix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size;\r -> > - pix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width;\r -> > + pix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1];\r -> > pix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\r -> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M) {\r -> > + pix_fmt_mp->plane_fmt[2].bytesperline = ctx-\r -> >stride[2];\r -> > + pix_fmt_mp->plane_fmt[2].sizeimage = ctx-\r -> >chroma_size_1;\r -> > + }\r -> > } else {\r -> > mfc_err("invalid buf type\n");\r -> > return -EINVAL;\r -> > @@ -1468,9 +1507,14 @@ static int vidioc_s_fmt(struct file *file, void\r -> > *priv, struct v4l2_format *f)\r -> >\r -> > s5p_mfc_hw_call(dev->mfc_ops, enc_calc_src_size, ctx);\r -> > pix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size;\r -> > - pix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width;\r -> > + pix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0];\r -> > pix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\r -> > - pix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width;\r -> > + pix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1];\r -> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M) {\r -> > + pix_fmt_mp->plane_fmt[2].bytesperline = ctx-\r -> >stride[2];\r -> > + pix_fmt_mp->plane_fmt[2].sizeimage = ctx-\r -> >chroma_size_1;\r -> > + }\r -> >\r -> > ctx->src_bufs_cnt = 0;\r -> > ctx->output_state = QUEUE_FREE;\r -> > @@ -2414,10 +2458,16 @@ static int s5p_mfc_queue_setup(struct\r -> > vb2_queue *vq,\r -> >\r -> > psize[0] = ctx->luma_size;\r -> > psize[1] = ctx->chroma_size;\r -> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + psize[2] = ctx->chroma_size_1;\r -> >\r -> > if (IS_MFCV6_PLUS(dev)) {\r -> > alloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX];\r -> > alloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX];\r -> > + if (ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + alloc_devs[2] = ctx->dev-\r -> >mem_dev[BANK_L_CTX];\r -> > } else {\r -> > alloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX];\r -> > alloc_devs[1] = ctx->dev->mem_dev[BANK_R_CTX];\r -> @@ -2456,6 +2506,10\r -> > @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)\r -> >\r -> vb2_dma_contig_plane_dma_addr(vb, 0);\r -> > ctx->src_bufs[i].cookie.raw.chroma =\r -> >\r -> vb2_dma_contig_plane_dma_addr(vb, 1);\r -> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + ctx->src_bufs[i].cookie.raw.chroma_1 =\r -> > +\r -> vb2_dma_contig_plane_dma_addr(vb, 2);\r -> > ctx->src_bufs_cnt++;\r -> > } else {\r -> > mfc_err("invalid queue type: %d\n", vq->type); @@ -2493,6\r -> +2547,12\r -> > @@ static int s5p_mfc_buf_prepare(struct vb2_buffer *vb)\r -> > mfc_err("plane size is too small for output\n");\r -> > return -EINVAL;\r -> > }\r -> > + if ((ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) &&\r -> > + (vb2_plane_size(vb, 2) < ctx->chroma_size_1)) {\r -> > + mfc_err("plane size is too small for output\n");\r -> > + return -EINVAL;\r -> > + }\r -> > } else {\r -> > mfc_err("invalid queue type: %d\n", vq->type);\r -> > return -EINVAL;\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r -> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r -> > index 87ac56756a16..7c5e851c8191 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r -> > @@ -293,9 +293,11 @@ struct s5p_mfc_hw_ops {\r -> > int (*set_enc_stream_buffer)(struct s5p_mfc_ctx *ctx,\r -> > unsigned long addr, unsigned int size);\r -> > void (*set_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,\r -> > - unsigned long y_addr, unsigned long c_addr);\r -> > + unsigned long y_addr, unsigned long c_addr,\r -> > + unsigned long c_1_addr);\r -> > void (*get_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,\r -> > - unsigned long *y_addr, unsigned long *c_addr);\r -> > + unsigned long *y_addr, unsigned long *c_addr,\r -> > + unsigned long *c_1_addr);\r -> > void (*try_run)(struct s5p_mfc_dev *dev);\r -> > void (*clear_int_flags)(struct s5p_mfc_dev *dev);\r -> > int (*get_dspl_y_adr)(struct s5p_mfc_dev *dev); diff --git\r -> > a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r -> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r -> > index 28a06dc343fd..fcfaf125a5a1 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r -> > @@ -516,7 +516,8 @@ static int\r -> s5p_mfc_set_enc_stream_buffer_v5(struct\r -> > s5p_mfc_ctx *ctx, }\r -> >\r -> > static void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,\r -> > - unsigned long y_addr, unsigned long c_addr)\r -> > + unsigned long y_addr, unsigned long c_addr,\r -> > + unsigned long c_1_addr)\r -> > {\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> >\r -> > @@ -525,7 +526,8 @@ static void\r -> s5p_mfc_set_enc_frame_buffer_v5(struct\r -> > s5p_mfc_ctx *ctx, }\r -> >\r -> > static void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,\r -> > - unsigned long *y_addr, unsigned long *c_addr)\r -> > + unsigned long *y_addr, unsigned long *c_addr,\r -> > + unsigned long *c_1_addr)\r -> > {\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> >\r -> > @@ -1210,7 +1212,7 @@ static int s5p_mfc_run_enc_frame(struct\r -> s5p_mfc_ctx *ctx)\r -> > if (list_empty(&ctx->src_queue)) {\r -> > /* send null frame */\r -> > s5p_mfc_set_enc_frame_buffer_v5(ctx, dev-\r -> >dma_base[BANK_R_CTX],\r -> > - dev-\r -> >dma_base[BANK_R_CTX]);\r -> > + dev-\r -> >dma_base[BANK_R_CTX], 0);\r -> > src_mb = NULL;\r -> > } else {\r -> > src_mb = list_entry(ctx->src_queue.next, struct\r -> s5p_mfc_buf, @@\r -> > -1220,7 +1222,7 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx\r -> *ctx)\r -> > /* send null frame */\r -> > s5p_mfc_set_enc_frame_buffer_v5(ctx,\r -> > dev-\r -> >dma_base[BANK_R_CTX],\r -> > - dev-\r -> >dma_base[BANK_R_CTX]);\r -> > + dev-\r -> >dma_base[BANK_R_CTX], 0);\r -> > ctx->state = MFCINST_FINISHING;\r -> > } else {\r -> > src_y_addr = vb2_dma_contig_plane_dma_addr(\r -> @@ -1228,7 +1230,7 @@\r -> > static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)\r -> > src_c_addr = vb2_dma_contig_plane_dma_addr(\r -> > &src_mb->b->vb2_buf, 1);\r -> > s5p_mfc_set_enc_frame_buffer_v5(ctx, src_y_addr,\r -> > - src_c_addr);\r -> > + src_c_addr,\r -> 0);\r -> > if (src_mb->flags & MFC_BUF_FLAG_EOS)\r -> > ctx->state = MFCINST_FINISHING;\r -> > }\r -> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r -> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r -> > index fb3f0718821d..e579c765e902 100644\r -> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r -> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r -> > @@ -494,16 +494,43 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct\r -> s5p_mfc_ctx *ctx)\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> > ctx->buf_width = ALIGN(ctx->img_width,\r -> S5P_FIMV_NV12MT_HALIGN_V6);\r -> > ctx->buf_height = ALIGN(ctx->img_height,\r -> S5P_FIMV_NV12MT_VALIGN_V6);\r -> > + ctx->chroma_size_1 = 0;\r -> > mfc_debug(2, "SEQ Done: Movie dimensions %dx%d,\n"\r -> > "buffer dimensions: %dx%d\n", ctx->img_width,\r -> > ctx->img_height, ctx->buf_width, ctx->buf_height);\r -> >\r -> > - ctx->luma_size = calc_plane(ctx->img_width, ctx->img_height);\r -> > - ctx->chroma_size = calc_plane(ctx->img_width, (ctx->img_height >>\r -> 1));\r -> > + switch (ctx->dst_fmt->fourcc) {\r -> > + case V4L2_PIX_FMT_NV12M:\r -> > + case V4L2_PIX_FMT_NV21M:\r -> > + ctx->stride[0] = ALIGN(ctx->img_width,\r -> > + S5P_FIMV_NV12MT_HALIGN_V6);\r -> > + ctx->stride[1] = ALIGN(ctx->img_width,\r -> > + S5P_FIMV_NV12MT_HALIGN_V6);\r -> > + ctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height);\r -> > + ctx->chroma_size = calc_plane(ctx->stride[1],\r -> > + (ctx->img_height / 2));\r -> > + break;\r -> > + case V4L2_PIX_FMT_YUV420M:\r -> > + case V4L2_PIX_FMT_YVU420M:\r -> > + ctx->stride[0] = ALIGN(ctx->img_width,\r -> > + S5P_FIMV_NV12MT_HALIGN_V6);\r -> > + ctx->stride[1] = ALIGN(ctx->img_width / 2,\r -> > + S5P_FIMV_NV12MT_HALIGN_V6);\r -> > + ctx->stride[2] = ALIGN(ctx->img_width / 2,\r -> > + S5P_FIMV_NV12MT_HALIGN_V6);\r -> > + ctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height);\r -> > + ctx->chroma_size = calc_plane(ctx->stride[1],\r -> > + (ctx->img_height / 2));\r -> > + ctx->chroma_size_1 = calc_plane(ctx->stride[2],\r -> > + (ctx->img_height / 2));\r -> > + break;\r -> > + }\r -> > +\r -> > if (IS_MFCV8_PLUS(ctx->dev)) {\r -> > /* MFCv8 needs additional 64 bytes for luma,chroma dpb*/\r -> > ctx->luma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\r -> > ctx->chroma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\r -> > + ctx->chroma_size_1 +=\r -> S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\r -> > }\r -> >\r -> > if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC || @@ -534,15\r -> +561,53\r -> > @@ static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx)\r -> > mb_width = MB_WIDTH(ctx->img_width);\r -> > mb_height = MB_HEIGHT(ctx->img_height);\r -> >\r -> > - ctx->buf_width = ALIGN(ctx->img_width,\r -> S5P_FIMV_NV12M_HALIGN_V6);\r -> > - ctx->luma_size = ALIGN((mb_width * mb_height) * 256, 256);\r -> > - ctx->chroma_size = ALIGN((mb_width * mb_height) * 128, 256);\r -> > -\r -> > - /* MFCv7 needs pad bytes for Luma and Chroma */\r -> > - if (IS_MFCV7_PLUS(ctx->dev)) {\r -> > + if (IS_MFCV12(ctx->dev)) {\r -> > + switch (ctx->src_fmt->fourcc) {\r -> > + case V4L2_PIX_FMT_NV12M:\r -> > + case V4L2_PIX_FMT_NV21M:\r -> > + ctx->stride[0] = ALIGN(ctx->img_width,\r -> > +\r -> S5P_FIMV_NV12M_HALIGN_V6);\r -> > + ctx->stride[1] = ALIGN(ctx->img_width,\r -> > +\r -> S5P_FIMV_NV12M_HALIGN_V6);\r -> > + ctx->luma_size = ctx->stride[0] *\r -> > + ALIGN(ctx->img_height, 16);\r -> > + ctx->chroma_size = ctx->stride[0] *\r -> > + ALIGN(ctx->img_height / 2,\r -> 16);\r -> > + break;\r -> > + case V4L2_PIX_FMT_YUV420M:\r -> > + case V4L2_PIX_FMT_YVU420M:\r -> > + ctx->stride[0] = ALIGN(ctx->img_width,\r -> > +\r -> S5P_FIMV_NV12M_HALIGN_V6);\r -> > + ctx->stride[1] = ALIGN(ctx->img_width / 2,\r -> > +\r -> S5P_FIMV_NV12M_HALIGN_V6);\r -> > + ctx->stride[2] = ALIGN(ctx->img_width / 2,\r -> > +\r -> S5P_FIMV_NV12M_HALIGN_V6);\r -> > + ctx->luma_size = ctx->stride[0] *\r -> > + ALIGN(ctx->img_height, 16);\r -> > + ctx->chroma_size = ctx->stride[1] *\r -> > + ALIGN(ctx->img_height / 2,\r -> 16);\r -> > + ctx->chroma_size_1 = ctx->stride[2] *\r -> > + ALIGN(ctx->img_height / 2,\r -> 16);\r -> > + break;\r -> > + }\r -> > ctx->luma_size += MFC_LUMA_PAD_BYTES_V7;\r -> > - ctx->chroma_size += MFC_CHROMA_PAD_BYTES_V7;\r -> > + ctx->chroma_size += MFC_CHROMA_PAD_BYTES_V12;\r -> > + ctx->chroma_size_1 += MFC_CHROMA_PAD_BYTES_V12;\r -> > + } else {\r -> > + ctx->buf_width = ALIGN(ctx->img_width,\r -> > + S5P_FIMV_NV12M_HALIGN_V6);\r -> > + ctx->stride[0] = ctx->buf_width;\r -> > + ctx->stride[1] = ctx->buf_width;\r -> > + ctx->luma_size = ALIGN((mb_width * mb_height) * 256,\r -> 256);\r -> > + ctx->chroma_size = ALIGN((mb_width * mb_height) * 128,\r -> 256);\r -> > + ctx->chroma_size_1 = 0;\r -> > + /* MFCv7 needs pad bytes for Luma and Chroma */\r -> > + if (IS_MFCV7_PLUS(ctx->dev)) {\r -> > + ctx->luma_size += MFC_LUMA_PAD_BYTES_V7;\r -> > + ctx->chroma_size += MFC_LUMA_PAD_BYTES_V7;\r -> > + }\r -> > }\r -> > +\r -> > }\r -> >\r -> > /* Set registers for decoding stream buffer */ @@ -588,15 +653,21 @@\r -> > static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)\r -> > writel(ctx->total_dpb_count, mfc_regs->d_num_dpb);\r -> > writel(ctx->luma_size, mfc_regs->d_first_plane_dpb_size);\r -> > writel(ctx->chroma_size, mfc_regs->d_second_plane_dpb_size);\r -> > -\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r -> > + writel(ctx->chroma_size_1, mfc_regs-\r -> >d_third_plane_dpb_size);\r -> > writel(buf_addr1, mfc_regs->d_scratch_buffer_addr);\r -> > writel(ctx->scratch_buf_size, mfc_regs->d_scratch_buffer_size);\r -> >\r -> > if (IS_MFCV8_PLUS(dev)) {\r -> > - writel(ctx->img_width,\r -> > + writel(ctx->stride[0],\r -> > mfc_regs->d_first_plane_dpb_stride_size);\r -> > - writel(ctx->img_width,\r -> > + writel(ctx->stride[1],\r -> > mfc_regs->d_second_plane_dpb_stride_size);\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + writel(ctx->stride[2],\r -> > + mfc_regs->d_third_plane_dpb_stride_size);\r -> > }\r -> >\r -> > buf_addr1 += ctx->scratch_buf_size;\r -> > @@ -625,6 +696,13 @@ static int\r -> s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)\r -> > ctx->dst_bufs[i].cookie.raw.chroma);\r -> > writel(ctx->dst_bufs[i].cookie.raw.chroma,\r -> > mfc_regs->d_second_plane_dpb + i * 4);\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->dst_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M) {\r -> > + mfc_debug(2, "\tChroma_1 %d: %zx\n", i,\r -> > + ctx-\r -> >dst_bufs[i].cookie.raw.chroma_1);\r -> > + writel(ctx->dst_bufs[i].cookie.raw.chroma_1,\r -> > + mfc_regs->d_third_plane_dpb + i *\r -> 4);\r -> > + }\r -> > }\r -> > if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC ||\r -> > ctx->codec_mode ==\r -> S5P_MFC_CODEC_H264_MVC_DEC || @@ -683,20\r -> > +761,24 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct\r -> > s5p_mfc_ctx *ctx, }\r -> >\r -> > static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,\r -> > - unsigned long y_addr, unsigned long c_addr)\r -> > + unsigned long y_addr, unsigned long c_addr,\r -> > + unsigned long c_1_addr)\r -> > {\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> > const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;\r -> >\r -> > writel(y_addr, mfc_regs->e_source_first_plane_addr);\r -> > writel(c_addr, mfc_regs->e_source_second_plane_addr);\r -> > + writel(c_1_addr, mfc_regs->e_source_third_plane_addr);\r -> >\r -> > mfc_debug(2, "enc src y buf addr: 0x%08lx\n", y_addr);\r -> > mfc_debug(2, "enc src c buf addr: 0x%08lx\n", c_addr);\r -> > + mfc_debug(2, "enc src cr buf addr: 0x%08lx\n", c_1_addr);\r -> > }\r -> >\r -> > static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,\r -> > - unsigned long *y_addr, unsigned long *c_addr)\r -> > + unsigned long *y_addr, unsigned long *c_addr,\r -> > + unsigned long *c_1_addr)\r -> > {\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> > const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs; @@ -704,12\r -> > +786,17 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct\r -> > s5p_mfc_ctx *ctx,\r -> >\r -> > *y_addr = readl(mfc_regs->e_encoded_source_first_plane_addr);\r -> > *c_addr = readl(mfc_regs-\r -> >e_encoded_source_second_plane_addr);\r -> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r -> > + *c_1_addr = readl(mfc_regs-\r -> >e_encoded_source_third_plane_addr);\r -> > + else\r -> > + *c_1_addr = 0;\r -> >\r -> > enc_recon_y_addr = readl(mfc_regs->e_recon_luma_dpb_addr);\r -> > enc_recon_c_addr = readl(mfc_regs->e_recon_chroma_dpb_addr);\r -> >\r -> > mfc_debug(2, "recon y addr: 0x%08lx y_addr: 0x%08lx\n",\r -> enc_recon_y_addr, *y_addr);\r -> > - mfc_debug(2, "recon c addr: 0x%08lx\n", enc_recon_c_addr);\r -> > + mfc_debug(2, "recon c addr: 0x%08lx c_addr: 0x%08lx\n",\r -> > +enc_recon_c_addr, *c_addr);\r -> > }\r -> >\r -> > /* Set encoding ref & codec buffer */ @@ -886,6 +973,20 @@ static int\r -> > s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)\r -> > writel(reg, mfc_regs->e_enc_options);\r -> > /* 0: NV12(CbCr), 1: NV21(CrCb) */\r -> > writel(0x0, mfc_regs->pixel_format);\r -> > + } else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) {\r -> > + /* 0: Linear, 1: 2D tiled*/\r -> > + reg = readl(mfc_regs->e_enc_options);\r -> > + reg &= ~(0x1 << 7);\r -> > + writel(reg, mfc_regs->e_enc_options);\r -> > + /* 2: YV12(CrCb), 3: I420(CrCb) */\r -> > + writel(0x2, mfc_regs->pixel_format);\r -> > + } else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M) {\r -> > + /* 0: Linear, 1: 2D tiled*/\r -> > + reg = readl(mfc_regs->e_enc_options);\r -> > + reg &= ~(0x1 << 7);\r -> > + writel(reg, mfc_regs->e_enc_options);\r -> > + /* 2: YV12(CrCb), 3: I420(CrCb) */\r -> > + writel(0x3, mfc_regs->pixel_format);\r -> > }\r -> >\r -> > /* memory structure recon. frame */\r -> > @@ -1696,8 +1797,12 @@ static int s5p_mfc_init_decode_v6(struct\r -> s5p_mfc_ctx *ctx)\r -> > else\r -> > writel(reg, mfc_regs->d_dec_options);\r -> >\r -> > - /* 0: NV12(CbCr), 1: NV21(CrCb) */\r -> > - if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M)\r -> > + /* 0: NV12(CbCr), 1: NV21(CrCb), 2: YV12(CrCb), 3: I420(CbCr) */\r -> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M)\r -> > + writel(0x3, mfc_regs->pixel_format);\r -> > + else if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r -> > + writel(0x2, mfc_regs->pixel_format);\r -> > + else if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M)\r -> > writel(0x1, mfc_regs->pixel_format);\r -> > else\r -> > writel(0x0, mfc_regs->pixel_format); @@ -1781,8 +1886,12\r -> @@ static\r -> > int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx)\r -> >\r -> > /* Set stride lengths for v7 & above */\r -> > if (IS_MFCV7_PLUS(dev)) {\r -> > - writel(ctx->img_width, mfc_regs-\r -> >e_source_first_plane_stride);\r -> > - writel(ctx->img_width, mfc_regs-\r -> >e_source_second_plane_stride);\r -> > + writel(ctx->stride[0], mfc_regs-\r -> >e_source_first_plane_stride);\r -> > + writel(ctx->stride[1], mfc_regs-\r -> >e_source_second_plane_stride);\r -> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + writel(ctx->stride[2],\r -> > + mfc_regs-\r -> >e_source_third_plane_stride);\r -> > }\r -> >\r -> > writel(ctx->inst_no, mfc_regs->instance_id); @@ -1891,7 +2000,7\r -> @@\r -> > static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)\r -> > struct s5p_mfc_dev *dev = ctx->dev;\r -> > struct s5p_mfc_buf *dst_mb;\r -> > struct s5p_mfc_buf *src_mb;\r -> > - unsigned long src_y_addr, src_c_addr, dst_addr;\r -> > + unsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr;\r -> > /*\r -> > unsigned int src_y_size, src_c_size;\r -> > */\r -> > @@ -1909,22 +2018,29 @@ static inline int s5p_mfc_run_enc_frame(struct\r -> > s5p_mfc_ctx *ctx)\r -> >\r -> > if (list_empty(&ctx->src_queue)) {\r -> > /* send null frame */\r -> > - s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0);\r -> > + s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0);\r -> > src_mb = NULL;\r -> > } else {\r -> > src_mb = list_entry(ctx->src_queue.next, struct\r -> s5p_mfc_buf, list);\r -> > src_mb->flags |= MFC_BUF_FLAG_USED;\r -> > if (src_mb->b->vb2_buf.planes[0].bytesused == 0) {\r -> > - s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0);\r -> > + s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0);\r -> > ctx->state = MFCINST_FINISHING;\r -> > } else {\r -> > src_y_addr =\r -> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0);\r -> > src_c_addr =\r -> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf,\r -> > 1);\r -> > + if (ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YUV420M ||\r -> > + ctx->src_fmt->fourcc ==\r -> V4L2_PIX_FMT_YVU420M)\r -> > + src_c_1_addr =\r -> vb2_dma_contig_plane_dma_addr\r -> > + (&src_mb->b->vb2_buf, 2);\r -> > + else\r -> > + src_c_1_addr = 0;\r -> >\r -> > mfc_debug(2, "enc src y addr: 0x%08lx\n",\r -> src_y_addr);\r -> > mfc_debug(2, "enc src c addr: 0x%08lx\n",\r -> src_c_addr);\r -> >\r -> > - s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr,\r -> src_c_addr);\r -> > + s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr,\r -> > + src_c_addr, src_c_1_addr);\r -> > if (src_mb->flags & MFC_BUF_FLAG_EOS)\r -> > ctx->state = MFCINST_FINISHING;\r -> > }\r -> > @@ -2450,6 +2566,8 @@ const struct s5p_mfc_regs\r -> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)\r -> > S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7);\r -> > R(e_encoded_source_second_plane_addr,\r -> >\r -> S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7);\r -> > + R(e_encoded_source_third_plane_addr,\r -> > + S5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7);\r -> > R(e_vp8_options, S5P_FIMV_E_VP8_OPTIONS_V7);\r -> >\r -> > if (!IS_MFCV8_PLUS(dev))\r -> > @@ -2464,16 +2582,20 @@ const struct s5p_mfc_regs\r -> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)\r -> > R(d_cpb_buffer_offset, S5P_FIMV_D_CPB_BUFFER_OFFSET_V8);\r -> > R(d_first_plane_dpb_size,\r -> S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8);\r -> > R(d_second_plane_dpb_size,\r -> S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8);\r -> > + R(d_third_plane_dpb_size,\r -> S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8);\r -> > R(d_scratch_buffer_addr,\r -> S5P_FIMV_D_SCRATCH_BUFFER_ADDR_V8);\r -> > R(d_scratch_buffer_size, S5P_FIMV_D_SCRATCH_BUFFER_SIZE_V8);\r -> > R(d_first_plane_dpb_stride_size,\r -> > S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8);\r -> > R(d_second_plane_dpb_stride_size,\r -> >\r -> S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8);\r -> > + R(d_third_plane_dpb_stride_size,\r -> > + S5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8);\r -> > R(d_mv_buffer_size, S5P_FIMV_D_MV_BUFFER_SIZE_V8);\r -> > R(d_num_mv, S5P_FIMV_D_NUM_MV_V8);\r -> > R(d_first_plane_dpb, S5P_FIMV_D_FIRST_PLANE_DPB_V8);\r -> > R(d_second_plane_dpb, S5P_FIMV_D_SECOND_PLANE_DPB_V8);\r -> > + R(d_third_plane_dpb, S5P_FIMV_D_THIRD_PLANE_DPB_V8);\r -> > R(d_mv_buffer, S5P_FIMV_D_MV_BUFFER_V8);\r -> > R(d_init_buffer_options, S5P_FIMV_D_INIT_BUFFER_OPTIONS_V8);\r -> > R(d_available_dpb_flag_lower,\r +> Le mercredi 25 octobre 2023 à 15:52 +0530, Aakarsh Jain a écrit : +> > YV12 and I420 format (3-plane) support is added. Stride information is +> > added to all formats and planes since it is necessary for YV12/I420 +> > which are different from width. +> > +> > Cc: linux-fsd@tesla.com +> > Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com> +> > Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com> +> > --- +> > .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 2 + +> > .../platform/samsung/s5p-mfc/regs-mfc-v7.h | 1 + +> > .../platform/samsung/s5p-mfc/regs-mfc-v8.h | 3 + +> > .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 4 + +> > .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 45 ++++- +> > .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 86 +++++++-- +> > .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 6 +- +> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 12 +- +> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 168 +> +++++++++++++++--- +> > 9 files changed, 281 insertions(+), 46 deletions(-) +> > +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h +> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h +> > index 6c68a45082d0..70464f47c1f9 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h +> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h +> > @@ -26,6 +26,8 @@ +> > #define MFC_VERSION_V12 0xC0 +> > #define MFC_NUM_PORTS_V12 1 +> > #define S5P_FIMV_CODEC_VP9_ENC 27 +> > +#define MFC_CHROMA_PAD_BYTES_V12 256 +> > +#define S5P_FIMV_D_ALIGN_PLANE_SIZE_V12 256 +> > +> > /* Encoder buffer size for MFCv12 */ +> > #define ENC_V120_BASE_SIZE(x, y) \ +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h +> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h +> > index 4a7adfdaa359..50f9bf0603c1 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h +> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h +> > @@ -24,6 +24,7 @@ +> > +> > #define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7 +> 0xfa70 +> > #define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7 +> 0xfa74 +> > +#define S5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7 +> 0xfa78 +> > +> > #define S5P_FIMV_E_VP8_OPTIONS_V7 0xfdb0 +> > #define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7 0xfdb4 +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h +> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h +> > index 162e3c7e920f..0ef9eb2dff22 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h +> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h +> > @@ -17,13 +17,16 @@ +> > #define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8 0xf108 +> > #define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8 0xf144 +> > #define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8 0xf148 +> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8 0xf14C +> > #define S5P_FIMV_D_MV_BUFFER_SIZE_V8 0xf150 +> > +> > #define S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8 0xf138 +> > #define S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8 +> 0xf13c +> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8 +> 0xf140 +> > +> > #define S5P_FIMV_D_FIRST_PLANE_DPB_V8 0xf160 +> > #define S5P_FIMV_D_SECOND_PLANE_DPB_V8 0xf260 +> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_V8 0xf360 +> > #define S5P_FIMV_D_MV_BUFFER_V8 0xf460 +> > +> > #define S5P_FIMV_D_NUM_MV_V8 0xf134 +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +> > index dd2e9f7704ab..9a39cccfe002 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h +> > @@ -56,6 +56,7 @@ +> > #define MFC_NO_INSTANCE_SET -1 +> > #define MFC_ENC_CAP_PLANE_COUNT 1 +> > #define MFC_ENC_OUT_PLANE_COUNT 2 +> > +#define VB2_MAX_PLANE_COUNT 3 +> > #define STUFF_BYTE 4 +> > #define MFC_MAX_CTRLS 128 +> > +> > @@ -181,6 +182,7 @@ struct s5p_mfc_buf { +> > struct { +> > size_t luma; +> > size_t chroma; +> > + size_t chroma_1; +> > } raw; +> > size_t stream; +> > } cookie; +> > @@ -657,6 +659,7 @@ struct s5p_mfc_ctx { +> > +> > int luma_size; +> > int chroma_size; +> > + int chroma_size_1; +> > int mv_size; +> > +> > unsigned long consumed_stream; +> > @@ -722,6 +725,7 @@ struct s5p_mfc_ctx { +> > size_t scratch_buf_size; +> > int is_10bit; +> > int is_422; +> > + int stride[VB2_MAX_PLANE_COUNT]; +> > }; +> > +> > /* +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +> > index e219cbcd86d5..317f796fffa1 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c +> > @@ -56,6 +56,20 @@ static struct s5p_mfc_fmt formats[] = { +> > .num_planes = 2, +> > .versions = MFC_V6PLUS_BITS, +> > }, +> > + { +> > + .fourcc = V4L2_PIX_FMT_YUV420M, +> > + .codec_mode = S5P_MFC_CODEC_NONE, +> > + .type = MFC_FMT_RAW, +> > + .num_planes = 3, +> > + .versions = MFC_V12_BIT, +> > + }, +> > + { +> > + .fourcc = V4L2_PIX_FMT_YVU420M, +> > + .codec_mode = S5P_MFC_CODEC_NONE, +> > + .type = MFC_FMT_RAW, +> > + .num_planes = 3, +> > + .versions = MFC_V12_BIT +> > + }, +> > { +> > .fourcc = V4L2_PIX_FMT_H264, +> > .codec_mode = S5P_MFC_CODEC_H264_DEC, +> > @@ -359,10 +373,15 @@ static int vidioc_g_fmt(struct file *file, void *priv, +> struct v4l2_format *f) +> > /* Set pixelformat to the format in which MFC +> > outputs the decoded frame */ +> > pix_mp->pixelformat = ctx->dst_fmt->fourcc; +> > - pix_mp->plane_fmt[0].bytesperline = ctx->buf_width; +> > + pix_mp->plane_fmt[0].bytesperline = ctx->stride[0]; +> > pix_mp->plane_fmt[0].sizeimage = ctx->luma_size; +> > - pix_mp->plane_fmt[1].bytesperline = ctx->buf_width; +> > + pix_mp->plane_fmt[1].bytesperline = ctx->stride[1]; +> > pix_mp->plane_fmt[1].sizeimage = ctx->chroma_size; +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) { +> > + pix_mp->plane_fmt[2].bytesperline = ctx->stride[2]; +> > + pix_mp->plane_fmt[2].sizeimage = ctx- +> >chroma_size_1; +> > + } +> > } else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { +> > /* This is run on OUTPUT +> > The buffer contains compressed image @@ -937,6 +956,9 +> @@ static +> > int s5p_mfc_queue_setup(struct vb2_queue *vq, +> > vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { +> > /* Output plane count is 2 - one for Y and one for CbCr */ +> > *plane_count = 2; +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + *plane_count = 3; +> +> I don't usually interfere, this is your driver to maintain, but this becomes +> horribly messy. Have you consider de-hardcoding a little and encapsulate per +> HW format details into a C structure ? Drivers these days try to make sure of +> v4l2- common library, which as a matter of fact knows that YUV420M and +> YVU420M have 3 places, so that you don't have to duplicate it in your driver. +> +> regards, +> Nicolas + +Thanks for pointing out. +We could have done it in this way ' *plane_count = ctx->dst_fmt->num_planes' also. +Anyway, will make use of ' v4l2- common library ' for getting the planes count here in next series. + +Thanks for the review. +> +> > /* Setup buffer count */ +> > if (*buf_count < ctx->pb_count) +> > *buf_count = ctx->pb_count; +> > @@ -955,12 +977,17 @@ static int s5p_mfc_queue_setup(struct +> vb2_queue *vq, +> > vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { +> > psize[0] = ctx->luma_size; +> > psize[1] = ctx->chroma_size; +> > - +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + psize[2] = ctx->chroma_size_1; +> > if (IS_MFCV6_PLUS(dev)) +> > alloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX]; +> > else +> > alloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX]; +> > alloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX]; +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + alloc_devs[2] = ctx->dev->mem_dev[BANK_L_CTX]; +> > } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && +> > ctx->state == MFCINST_INIT) { +> > psize[0] = ctx->dec_src_buf_size; +> > @@ -994,12 +1021,24 @@ static int s5p_mfc_buf_init(struct vb2_buffer +> *vb) +> > mfc_err("Plane buffer (CAPTURE) is too small\n"); +> > return -EINVAL; +> > } +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) { +> > + if (vb2_plane_size(vb, 2) < ctx->chroma_size_1) { +> > + mfc_err("Plane buffer (CAPTURE) is too +> small\n"); +> > + return -EINVAL; +> > + } +> > + } +> > i = vb->index; +> > ctx->dst_bufs[i].b = vbuf; +> > ctx->dst_bufs[i].cookie.raw.luma = +> > +> vb2_dma_contig_plane_dma_addr(vb, 0); +> > ctx->dst_bufs[i].cookie.raw.chroma = +> > +> vb2_dma_contig_plane_dma_addr(vb, 1); +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) { +> > + ctx->dst_bufs[i].cookie.raw.chroma_1 = +> > + +> vb2_dma_contig_plane_dma_addr(vb, 2); +> > + } +> > ctx->dst_bufs_cnt++; +> > } else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { +> > if (IS_ERR_OR_NULL(ERR_PTR( +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +> > index e4d6e7c117b5..0eec04eb3ef3 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c +> > @@ -59,6 +59,20 @@ static struct s5p_mfc_fmt formats[] = { +> > .num_planes = 2, +> > .versions = MFC_V6PLUS_BITS, +> > }, +> > + { +> > + .fourcc = V4L2_PIX_FMT_YUV420M, +> > + .codec_mode = S5P_MFC_CODEC_NONE, +> > + .type = MFC_FMT_RAW, +> > + .num_planes = 3, +> > + .versions = MFC_V12_BIT, +> > + }, +> > + { +> > + .fourcc = V4L2_PIX_FMT_YVU420M, +> > + .codec_mode = S5P_MFC_CODEC_NONE, +> > + .type = MFC_FMT_RAW, +> > + .num_planes = 3, +> > + .versions = MFC_V12_BIT, +> > + }, +> > { +> > .fourcc = V4L2_PIX_FMT_H264, +> > .codec_mode = S5P_MFC_CODEC_H264_ENC, +> > @@ -1193,14 +1207,20 @@ static int enc_pre_frame_start(struct +> s5p_mfc_ctx *ctx) +> > struct s5p_mfc_dev *dev = ctx->dev; +> > struct s5p_mfc_buf *dst_mb; +> > struct s5p_mfc_buf *src_mb; +> > - unsigned long src_y_addr, src_c_addr, dst_addr; +> > + unsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr; +> > unsigned int dst_size; +> > +> > src_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list); +> > src_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b- +> >vb2_buf, 0); +> > src_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b- +> >vb2_buf, 1); +> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) +> > + src_c_1_addr = +> > + vb2_dma_contig_plane_dma_addr(&src_mb->b- +> >vb2_buf, 2); +> > + else +> > + src_c_1_addr = 0; +> > s5p_mfc_hw_call(dev->mfc_ops, set_enc_frame_buffer, ctx, +> > - src_y_addr, +> src_c_addr); +> > + src_y_addr, src_c_addr, +> src_c_1_addr); +> > +> > dst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list); +> > dst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b- +> >vb2_buf, 0); @@ +> > -1215,8 +1235,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx +> > *ctx) { +> > struct s5p_mfc_dev *dev = ctx->dev; +> > struct s5p_mfc_buf *mb_entry; +> > - unsigned long enc_y_addr = 0, enc_c_addr = 0; +> > - unsigned long mb_y_addr, mb_c_addr; +> > + unsigned long enc_y_addr = 0, enc_c_addr = 0, enc_c_1_addr = 0; +> > + unsigned long mb_y_addr, mb_c_addr, mb_c_1_addr; +> > int slice_type; +> > unsigned int strm_size; +> > bool src_ready; +> > @@ -1229,14 +1249,21 @@ static int enc_post_frame_start(struct +> s5p_mfc_ctx *ctx) +> > mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT)); +> > if (slice_type >= 0) { +> > s5p_mfc_hw_call(dev->mfc_ops, get_enc_frame_buffer, +> ctx, +> > - &enc_y_addr, &enc_c_addr); +> > + &enc_y_addr, &enc_c_addr, +> &enc_c_1_addr); +> > list_for_each_entry(mb_entry, &ctx->src_queue, list) { +> > mb_y_addr = vb2_dma_contig_plane_dma_addr( +> > &mb_entry->b->vb2_buf, 0); +> > mb_c_addr = vb2_dma_contig_plane_dma_addr( +> > &mb_entry->b->vb2_buf, 1); +> > - if ((enc_y_addr == mb_y_addr) && +> > - (enc_c_addr == mb_c_addr)) +> { +> > + if (ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + mb_c_1_addr = +> vb2_dma_contig_plane_dma_addr +> > + (&mb_entry->b->vb2_buf, +> 2); +> > + else +> > + mb_c_1_addr = 0; +> > + if ((enc_y_addr == mb_y_addr) +> > + && (enc_c_addr == mb_c_addr) +> > + && (enc_c_1_addr == +> mb_c_1_addr)) { +> > list_del(&mb_entry->list); +> > ctx->src_queue_cnt--; +> > vb2_buffer_done(&mb_entry->b->vb2_buf, +> > @@ -1249,8 +1276,15 @@ static int enc_post_frame_start(struct +> s5p_mfc_ctx *ctx) +> > &mb_entry->b->vb2_buf, 0); +> > mb_c_addr = vb2_dma_contig_plane_dma_addr( +> > &mb_entry->b->vb2_buf, 1); +> > - if ((enc_y_addr == mb_y_addr) && +> > - (enc_c_addr == mb_c_addr)) +> { +> > + if (ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + mb_c_1_addr = +> vb2_dma_contig_plane_dma_addr( +> > + &mb_entry->b->vb2_buf, 2); +> > + else +> > + mb_c_1_addr = 0; +> > + if ((enc_y_addr == mb_y_addr) +> > + && (enc_c_addr == mb_c_addr) +> > + && (enc_c_1_addr == +> mb_c_1_addr)) { +> > list_del(&mb_entry->list); +> > ctx->ref_queue_cnt--; +> > vb2_buffer_done(&mb_entry->b->vb2_buf, +> > @@ -1381,10 +1415,15 @@ static int vidioc_g_fmt(struct file *file, void +> *priv, struct v4l2_format *f) +> > pix_fmt_mp->pixelformat = ctx->src_fmt->fourcc; +> > pix_fmt_mp->num_planes = ctx->src_fmt->num_planes; +> > +> > - pix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width; +> > + pix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0]; +> > pix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size; +> > - pix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width; +> > + pix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1]; +> > pix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size; +> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) { +> > + pix_fmt_mp->plane_fmt[2].bytesperline = ctx- +> >stride[2]; +> > + pix_fmt_mp->plane_fmt[2].sizeimage = ctx- +> >chroma_size_1; +> > + } +> > } else { +> > mfc_err("invalid buf type\n"); +> > return -EINVAL; +> > @@ -1468,9 +1507,14 @@ static int vidioc_s_fmt(struct file *file, void +> > *priv, struct v4l2_format *f) +> > +> > s5p_mfc_hw_call(dev->mfc_ops, enc_calc_src_size, ctx); +> > pix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size; +> > - pix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width; +> > + pix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0]; +> > pix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size; +> > - pix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width; +> > + pix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1]; +> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) { +> > + pix_fmt_mp->plane_fmt[2].bytesperline = ctx- +> >stride[2]; +> > + pix_fmt_mp->plane_fmt[2].sizeimage = ctx- +> >chroma_size_1; +> > + } +> > +> > ctx->src_bufs_cnt = 0; +> > ctx->output_state = QUEUE_FREE; +> > @@ -2414,10 +2458,16 @@ static int s5p_mfc_queue_setup(struct +> > vb2_queue *vq, +> > +> > psize[0] = ctx->luma_size; +> > psize[1] = ctx->chroma_size; +> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + psize[2] = ctx->chroma_size_1; +> > +> > if (IS_MFCV6_PLUS(dev)) { +> > alloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX]; +> > alloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX]; +> > + if (ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + alloc_devs[2] = ctx->dev- +> >mem_dev[BANK_L_CTX]; +> > } else { +> > alloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX]; +> > alloc_devs[1] = ctx->dev->mem_dev[BANK_R_CTX]; +> @@ -2456,6 +2506,10 +> > @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb) +> > +> vb2_dma_contig_plane_dma_addr(vb, 0); +> > ctx->src_bufs[i].cookie.raw.chroma = +> > +> vb2_dma_contig_plane_dma_addr(vb, 1); +> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + ctx->src_bufs[i].cookie.raw.chroma_1 = +> > + +> vb2_dma_contig_plane_dma_addr(vb, 2); +> > ctx->src_bufs_cnt++; +> > } else { +> > mfc_err("invalid queue type: %d\n", vq->type); @@ -2493,6 +> +2547,12 +> > @@ static int s5p_mfc_buf_prepare(struct vb2_buffer *vb) +> > mfc_err("plane size is too small for output\n"); +> > return -EINVAL; +> > } +> > + if ((ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) && +> > + (vb2_plane_size(vb, 2) < ctx->chroma_size_1)) { +> > + mfc_err("plane size is too small for output\n"); +> > + return -EINVAL; +> > + } +> > } else { +> > mfc_err("invalid queue type: %d\n", vq->type); +> > return -EINVAL; +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h +> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h +> > index 87ac56756a16..7c5e851c8191 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h +> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h +> > @@ -293,9 +293,11 @@ struct s5p_mfc_hw_ops { +> > int (*set_enc_stream_buffer)(struct s5p_mfc_ctx *ctx, +> > unsigned long addr, unsigned int size); +> > void (*set_enc_frame_buffer)(struct s5p_mfc_ctx *ctx, +> > - unsigned long y_addr, unsigned long c_addr); +> > + unsigned long y_addr, unsigned long c_addr, +> > + unsigned long c_1_addr); +> > void (*get_enc_frame_buffer)(struct s5p_mfc_ctx *ctx, +> > - unsigned long *y_addr, unsigned long *c_addr); +> > + unsigned long *y_addr, unsigned long *c_addr, +> > + unsigned long *c_1_addr); +> > void (*try_run)(struct s5p_mfc_dev *dev); +> > void (*clear_int_flags)(struct s5p_mfc_dev *dev); +> > int (*get_dspl_y_adr)(struct s5p_mfc_dev *dev); diff --git +> > a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c +> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c +> > index 28a06dc343fd..fcfaf125a5a1 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c +> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c +> > @@ -516,7 +516,8 @@ static int +> s5p_mfc_set_enc_stream_buffer_v5(struct +> > s5p_mfc_ctx *ctx, } +> > +> > static void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx, +> > - unsigned long y_addr, unsigned long c_addr) +> > + unsigned long y_addr, unsigned long c_addr, +> > + unsigned long c_1_addr) +> > { +> > struct s5p_mfc_dev *dev = ctx->dev; +> > +> > @@ -525,7 +526,8 @@ static void +> s5p_mfc_set_enc_frame_buffer_v5(struct +> > s5p_mfc_ctx *ctx, } +> > +> > static void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx, +> > - unsigned long *y_addr, unsigned long *c_addr) +> > + unsigned long *y_addr, unsigned long *c_addr, +> > + unsigned long *c_1_addr) +> > { +> > struct s5p_mfc_dev *dev = ctx->dev; +> > +> > @@ -1210,7 +1212,7 @@ static int s5p_mfc_run_enc_frame(struct +> s5p_mfc_ctx *ctx) +> > if (list_empty(&ctx->src_queue)) { +> > /* send null frame */ +> > s5p_mfc_set_enc_frame_buffer_v5(ctx, dev- +> >dma_base[BANK_R_CTX], +> > - dev- +> >dma_base[BANK_R_CTX]); +> > + dev- +> >dma_base[BANK_R_CTX], 0); +> > src_mb = NULL; +> > } else { +> > src_mb = list_entry(ctx->src_queue.next, struct +> s5p_mfc_buf, @@ +> > -1220,7 +1222,7 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx +> *ctx) +> > /* send null frame */ +> > s5p_mfc_set_enc_frame_buffer_v5(ctx, +> > dev- +> >dma_base[BANK_R_CTX], +> > - dev- +> >dma_base[BANK_R_CTX]); +> > + dev- +> >dma_base[BANK_R_CTX], 0); +> > ctx->state = MFCINST_FINISHING; +> > } else { +> > src_y_addr = vb2_dma_contig_plane_dma_addr( +> @@ -1228,7 +1230,7 @@ +> > static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) +> > src_c_addr = vb2_dma_contig_plane_dma_addr( +> > &src_mb->b->vb2_buf, 1); +> > s5p_mfc_set_enc_frame_buffer_v5(ctx, src_y_addr, +> > - src_c_addr); +> > + src_c_addr, +> 0); +> > if (src_mb->flags & MFC_BUF_FLAG_EOS) +> > ctx->state = MFCINST_FINISHING; +> > } +> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +> > index fb3f0718821d..e579c765e902 100644 +> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c +> > @@ -494,16 +494,43 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct +> s5p_mfc_ctx *ctx) +> > struct s5p_mfc_dev *dev = ctx->dev; +> > ctx->buf_width = ALIGN(ctx->img_width, +> S5P_FIMV_NV12MT_HALIGN_V6); +> > ctx->buf_height = ALIGN(ctx->img_height, +> S5P_FIMV_NV12MT_VALIGN_V6); +> > + ctx->chroma_size_1 = 0; +> > mfc_debug(2, "SEQ Done: Movie dimensions %dx%d,\n" +> > "buffer dimensions: %dx%d\n", ctx->img_width, +> > ctx->img_height, ctx->buf_width, ctx->buf_height); +> > +> > - ctx->luma_size = calc_plane(ctx->img_width, ctx->img_height); +> > - ctx->chroma_size = calc_plane(ctx->img_width, (ctx->img_height >> +> 1)); +> > + switch (ctx->dst_fmt->fourcc) { +> > + case V4L2_PIX_FMT_NV12M: +> > + case V4L2_PIX_FMT_NV21M: +> > + ctx->stride[0] = ALIGN(ctx->img_width, +> > + S5P_FIMV_NV12MT_HALIGN_V6); +> > + ctx->stride[1] = ALIGN(ctx->img_width, +> > + S5P_FIMV_NV12MT_HALIGN_V6); +> > + ctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height); +> > + ctx->chroma_size = calc_plane(ctx->stride[1], +> > + (ctx->img_height / 2)); +> > + break; +> > + case V4L2_PIX_FMT_YUV420M: +> > + case V4L2_PIX_FMT_YVU420M: +> > + ctx->stride[0] = ALIGN(ctx->img_width, +> > + S5P_FIMV_NV12MT_HALIGN_V6); +> > + ctx->stride[1] = ALIGN(ctx->img_width / 2, +> > + S5P_FIMV_NV12MT_HALIGN_V6); +> > + ctx->stride[2] = ALIGN(ctx->img_width / 2, +> > + S5P_FIMV_NV12MT_HALIGN_V6); +> > + ctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height); +> > + ctx->chroma_size = calc_plane(ctx->stride[1], +> > + (ctx->img_height / 2)); +> > + ctx->chroma_size_1 = calc_plane(ctx->stride[2], +> > + (ctx->img_height / 2)); +> > + break; +> > + } +> > + +> > if (IS_MFCV8_PLUS(ctx->dev)) { +> > /* MFCv8 needs additional 64 bytes for luma,chroma dpb*/ +> > ctx->luma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8; +> > ctx->chroma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8; +> > + ctx->chroma_size_1 += +> S5P_FIMV_D_ALIGN_PLANE_SIZE_V8; +> > } +> > +> > if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC || @@ -534,15 +> +561,53 +> > @@ static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx) +> > mb_width = MB_WIDTH(ctx->img_width); +> > mb_height = MB_HEIGHT(ctx->img_height); +> > +> > - ctx->buf_width = ALIGN(ctx->img_width, +> S5P_FIMV_NV12M_HALIGN_V6); +> > - ctx->luma_size = ALIGN((mb_width * mb_height) * 256, 256); +> > - ctx->chroma_size = ALIGN((mb_width * mb_height) * 128, 256); +> > - +> > - /* MFCv7 needs pad bytes for Luma and Chroma */ +> > - if (IS_MFCV7_PLUS(ctx->dev)) { +> > + if (IS_MFCV12(ctx->dev)) { +> > + switch (ctx->src_fmt->fourcc) { +> > + case V4L2_PIX_FMT_NV12M: +> > + case V4L2_PIX_FMT_NV21M: +> > + ctx->stride[0] = ALIGN(ctx->img_width, +> > + +> S5P_FIMV_NV12M_HALIGN_V6); +> > + ctx->stride[1] = ALIGN(ctx->img_width, +> > + +> S5P_FIMV_NV12M_HALIGN_V6); +> > + ctx->luma_size = ctx->stride[0] * +> > + ALIGN(ctx->img_height, 16); +> > + ctx->chroma_size = ctx->stride[0] * +> > + ALIGN(ctx->img_height / 2, +> 16); +> > + break; +> > + case V4L2_PIX_FMT_YUV420M: +> > + case V4L2_PIX_FMT_YVU420M: +> > + ctx->stride[0] = ALIGN(ctx->img_width, +> > + +> S5P_FIMV_NV12M_HALIGN_V6); +> > + ctx->stride[1] = ALIGN(ctx->img_width / 2, +> > + +> S5P_FIMV_NV12M_HALIGN_V6); +> > + ctx->stride[2] = ALIGN(ctx->img_width / 2, +> > + +> S5P_FIMV_NV12M_HALIGN_V6); +> > + ctx->luma_size = ctx->stride[0] * +> > + ALIGN(ctx->img_height, 16); +> > + ctx->chroma_size = ctx->stride[1] * +> > + ALIGN(ctx->img_height / 2, +> 16); +> > + ctx->chroma_size_1 = ctx->stride[2] * +> > + ALIGN(ctx->img_height / 2, +> 16); +> > + break; +> > + } +> > ctx->luma_size += MFC_LUMA_PAD_BYTES_V7; +> > - ctx->chroma_size += MFC_CHROMA_PAD_BYTES_V7; +> > + ctx->chroma_size += MFC_CHROMA_PAD_BYTES_V12; +> > + ctx->chroma_size_1 += MFC_CHROMA_PAD_BYTES_V12; +> > + } else { +> > + ctx->buf_width = ALIGN(ctx->img_width, +> > + S5P_FIMV_NV12M_HALIGN_V6); +> > + ctx->stride[0] = ctx->buf_width; +> > + ctx->stride[1] = ctx->buf_width; +> > + ctx->luma_size = ALIGN((mb_width * mb_height) * 256, +> 256); +> > + ctx->chroma_size = ALIGN((mb_width * mb_height) * 128, +> 256); +> > + ctx->chroma_size_1 = 0; +> > + /* MFCv7 needs pad bytes for Luma and Chroma */ +> > + if (IS_MFCV7_PLUS(ctx->dev)) { +> > + ctx->luma_size += MFC_LUMA_PAD_BYTES_V7; +> > + ctx->chroma_size += MFC_LUMA_PAD_BYTES_V7; +> > + } +> > } +> > + +> > } +> > +> > /* Set registers for decoding stream buffer */ @@ -588,15 +653,21 @@ +> > static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx) +> > writel(ctx->total_dpb_count, mfc_regs->d_num_dpb); +> > writel(ctx->luma_size, mfc_regs->d_first_plane_dpb_size); +> > writel(ctx->chroma_size, mfc_regs->d_second_plane_dpb_size); +> > - +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M) +> > + writel(ctx->chroma_size_1, mfc_regs- +> >d_third_plane_dpb_size); +> > writel(buf_addr1, mfc_regs->d_scratch_buffer_addr); +> > writel(ctx->scratch_buf_size, mfc_regs->d_scratch_buffer_size); +> > +> > if (IS_MFCV8_PLUS(dev)) { +> > - writel(ctx->img_width, +> > + writel(ctx->stride[0], +> > mfc_regs->d_first_plane_dpb_stride_size); +> > - writel(ctx->img_width, +> > + writel(ctx->stride[1], +> > mfc_regs->d_second_plane_dpb_stride_size); +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + writel(ctx->stride[2], +> > + mfc_regs->d_third_plane_dpb_stride_size); +> > } +> > +> > buf_addr1 += ctx->scratch_buf_size; +> > @@ -625,6 +696,13 @@ static int +> s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx) +> > ctx->dst_bufs[i].cookie.raw.chroma); +> > writel(ctx->dst_bufs[i].cookie.raw.chroma, +> > mfc_regs->d_second_plane_dpb + i * 4); +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->dst_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) { +> > + mfc_debug(2, "\tChroma_1 %d: %zx\n", i, +> > + ctx- +> >dst_bufs[i].cookie.raw.chroma_1); +> > + writel(ctx->dst_bufs[i].cookie.raw.chroma_1, +> > + mfc_regs->d_third_plane_dpb + i * +> 4); +> > + } +> > } +> > if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC || +> > ctx->codec_mode == +> S5P_MFC_CODEC_H264_MVC_DEC || @@ -683,20 +> > +761,24 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct +> > s5p_mfc_ctx *ctx, } +> > +> > static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, +> > - unsigned long y_addr, unsigned long c_addr) +> > + unsigned long y_addr, unsigned long c_addr, +> > + unsigned long c_1_addr) +> > { +> > struct s5p_mfc_dev *dev = ctx->dev; +> > const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs; +> > +> > writel(y_addr, mfc_regs->e_source_first_plane_addr); +> > writel(c_addr, mfc_regs->e_source_second_plane_addr); +> > + writel(c_1_addr, mfc_regs->e_source_third_plane_addr); +> > +> > mfc_debug(2, "enc src y buf addr: 0x%08lx\n", y_addr); +> > mfc_debug(2, "enc src c buf addr: 0x%08lx\n", c_addr); +> > + mfc_debug(2, "enc src cr buf addr: 0x%08lx\n", c_1_addr); +> > } +> > +> > static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx, +> > - unsigned long *y_addr, unsigned long *c_addr) +> > + unsigned long *y_addr, unsigned long *c_addr, +> > + unsigned long *c_1_addr) +> > { +> > struct s5p_mfc_dev *dev = ctx->dev; +> > const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs; @@ -704,12 +> > +786,17 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct +> > s5p_mfc_ctx *ctx, +> > +> > *y_addr = readl(mfc_regs->e_encoded_source_first_plane_addr); +> > *c_addr = readl(mfc_regs- +> >e_encoded_source_second_plane_addr); +> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) +> > + *c_1_addr = readl(mfc_regs- +> >e_encoded_source_third_plane_addr); +> > + else +> > + *c_1_addr = 0; +> > +> > enc_recon_y_addr = readl(mfc_regs->e_recon_luma_dpb_addr); +> > enc_recon_c_addr = readl(mfc_regs->e_recon_chroma_dpb_addr); +> > +> > mfc_debug(2, "recon y addr: 0x%08lx y_addr: 0x%08lx\n", +> enc_recon_y_addr, *y_addr); +> > - mfc_debug(2, "recon c addr: 0x%08lx\n", enc_recon_c_addr); +> > + mfc_debug(2, "recon c addr: 0x%08lx c_addr: 0x%08lx\n", +> > +enc_recon_c_addr, *c_addr); +> > } +> > +> > /* Set encoding ref & codec buffer */ @@ -886,6 +973,20 @@ static int +> > s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx) +> > writel(reg, mfc_regs->e_enc_options); +> > /* 0: NV12(CbCr), 1: NV21(CrCb) */ +> > writel(0x0, mfc_regs->pixel_format); +> > + } else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) { +> > + /* 0: Linear, 1: 2D tiled*/ +> > + reg = readl(mfc_regs->e_enc_options); +> > + reg &= ~(0x1 << 7); +> > + writel(reg, mfc_regs->e_enc_options); +> > + /* 2: YV12(CrCb), 3: I420(CrCb) */ +> > + writel(0x2, mfc_regs->pixel_format); +> > + } else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M) { +> > + /* 0: Linear, 1: 2D tiled*/ +> > + reg = readl(mfc_regs->e_enc_options); +> > + reg &= ~(0x1 << 7); +> > + writel(reg, mfc_regs->e_enc_options); +> > + /* 2: YV12(CrCb), 3: I420(CrCb) */ +> > + writel(0x3, mfc_regs->pixel_format); +> > } +> > +> > /* memory structure recon. frame */ +> > @@ -1696,8 +1797,12 @@ static int s5p_mfc_init_decode_v6(struct +> s5p_mfc_ctx *ctx) +> > else +> > writel(reg, mfc_regs->d_dec_options); +> > +> > - /* 0: NV12(CbCr), 1: NV21(CrCb) */ +> > - if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M) +> > + /* 0: NV12(CbCr), 1: NV21(CrCb), 2: YV12(CrCb), 3: I420(CbCr) */ +> > + if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M) +> > + writel(0x3, mfc_regs->pixel_format); +> > + else if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M) +> > + writel(0x2, mfc_regs->pixel_format); +> > + else if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M) +> > writel(0x1, mfc_regs->pixel_format); +> > else +> > writel(0x0, mfc_regs->pixel_format); @@ -1781,8 +1886,12 +> @@ static +> > int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx) +> > +> > /* Set stride lengths for v7 & above */ +> > if (IS_MFCV7_PLUS(dev)) { +> > - writel(ctx->img_width, mfc_regs- +> >e_source_first_plane_stride); +> > - writel(ctx->img_width, mfc_regs- +> >e_source_second_plane_stride); +> > + writel(ctx->stride[0], mfc_regs- +> >e_source_first_plane_stride); +> > + writel(ctx->stride[1], mfc_regs- +> >e_source_second_plane_stride); +> > + if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + writel(ctx->stride[2], +> > + mfc_regs- +> >e_source_third_plane_stride); +> > } +> > +> > writel(ctx->inst_no, mfc_regs->instance_id); @@ -1891,7 +2000,7 +> @@ +> > static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx) +> > struct s5p_mfc_dev *dev = ctx->dev; +> > struct s5p_mfc_buf *dst_mb; +> > struct s5p_mfc_buf *src_mb; +> > - unsigned long src_y_addr, src_c_addr, dst_addr; +> > + unsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr; +> > /* +> > unsigned int src_y_size, src_c_size; +> > */ +> > @@ -1909,22 +2018,29 @@ static inline int s5p_mfc_run_enc_frame(struct +> > s5p_mfc_ctx *ctx) +> > +> > if (list_empty(&ctx->src_queue)) { +> > /* send null frame */ +> > - s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0); +> > + s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0); +> > src_mb = NULL; +> > } else { +> > src_mb = list_entry(ctx->src_queue.next, struct +> s5p_mfc_buf, list); +> > src_mb->flags |= MFC_BUF_FLAG_USED; +> > if (src_mb->b->vb2_buf.planes[0].bytesused == 0) { +> > - s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0); +> > + s5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0); +> > ctx->state = MFCINST_FINISHING; +> > } else { +> > src_y_addr = +> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0); +> > src_c_addr = +> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, +> > 1); +> > + if (ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YUV420M || +> > + ctx->src_fmt->fourcc == +> V4L2_PIX_FMT_YVU420M) +> > + src_c_1_addr = +> vb2_dma_contig_plane_dma_addr +> > + (&src_mb->b->vb2_buf, 2); +> > + else +> > + src_c_1_addr = 0; +> > +> > mfc_debug(2, "enc src y addr: 0x%08lx\n", +> src_y_addr); +> > mfc_debug(2, "enc src c addr: 0x%08lx\n", +> src_c_addr); +> > +> > - s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr, +> src_c_addr); +> > + s5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr, +> > + src_c_addr, src_c_1_addr); +> > if (src_mb->flags & MFC_BUF_FLAG_EOS) +> > ctx->state = MFCINST_FINISHING; +> > } +> > @@ -2450,6 +2566,8 @@ const struct s5p_mfc_regs +> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev) +> > S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7); +> > R(e_encoded_source_second_plane_addr, +> > +> S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7); +> > + R(e_encoded_source_third_plane_addr, +> > + S5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7); +> > R(e_vp8_options, S5P_FIMV_E_VP8_OPTIONS_V7); +> > +> > if (!IS_MFCV8_PLUS(dev)) +> > @@ -2464,16 +2582,20 @@ const struct s5p_mfc_regs +> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev) +> > R(d_cpb_buffer_offset, S5P_FIMV_D_CPB_BUFFER_OFFSET_V8); +> > R(d_first_plane_dpb_size, +> S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8); +> > R(d_second_plane_dpb_size, +> S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8); +> > + R(d_third_plane_dpb_size, +> S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8); +> > R(d_scratch_buffer_addr, +> S5P_FIMV_D_SCRATCH_BUFFER_ADDR_V8); +> > R(d_scratch_buffer_size, S5P_FIMV_D_SCRATCH_BUFFER_SIZE_V8); +> > R(d_first_plane_dpb_stride_size, +> > S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8); +> > R(d_second_plane_dpb_stride_size, +> > +> S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8); +> > + R(d_third_plane_dpb_stride_size, +> > + S5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8); +> > R(d_mv_buffer_size, S5P_FIMV_D_MV_BUFFER_SIZE_V8); +> > R(d_num_mv, S5P_FIMV_D_NUM_MV_V8); +> > R(d_first_plane_dpb, S5P_FIMV_D_FIRST_PLANE_DPB_V8); +> > R(d_second_plane_dpb, S5P_FIMV_D_SECOND_PLANE_DPB_V8); +> > + R(d_third_plane_dpb, S5P_FIMV_D_THIRD_PLANE_DPB_V8); +> > R(d_mv_buffer, S5P_FIMV_D_MV_BUFFER_V8); +> > R(d_init_buffer_options, S5P_FIMV_D_INIT_BUFFER_OPTIONS_V8); +> > R(d_available_dpb_flag_lower, > > S5P_FIMV_D_AVAILABLE_DPB_FLAG_LOWER_V8); + + + + +_______________________________________________ +linux-arm-kernel mailing list +linux-arm-kernel@lists.infradead.org +http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/a/content_digest b/N1/content_digest index b9c15e3..b831066 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -51,928 +51,936 @@ "> Subject: Re: [Patch v4 04/11] media: s5p-mfc: Add YV12 and I420 multiplanar\n" "> format support\n" "> \n" - "> Le mercredi 25 octobre 2023 \303\240 15:52 +0530, Aakarsh Jain a \303\251crit :\r\n" - "> > YV12 and I420 format (3-plane) support is added. Stride information is\r\n" - "> > added to all formats and planes since it is necessary for YV12/I420\r\n" - "> > which are different from width.\r\n" - "> >\r\n" - "> > Cc: linux-fsd@tesla.com\r\n" - "> > Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com>\r\n" - "> > Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>\r\n" - "> > ---\r\n" - "> > .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 2 +\r\n" - "> > .../platform/samsung/s5p-mfc/regs-mfc-v7.h | 1 +\r\n" - "> > .../platform/samsung/s5p-mfc/regs-mfc-v8.h | 3 +\r\n" - "> > .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 4 +\r\n" - "> > .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 45 ++++-\r\n" - "> > .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 86 +++++++--\r\n" - "> > .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 6 +-\r\n" - "> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 12 +-\r\n" - "> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 168\r\n" - "> +++++++++++++++---\r\n" - "> > 9 files changed, 281 insertions(+), 46 deletions(-)\r\n" - "> >\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r\n" - "> > index 6c68a45082d0..70464f47c1f9 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\r\n" - "> > @@ -26,6 +26,8 @@\r\n" - "> > #define MFC_VERSION_V12\t\t\t0xC0\r\n" - "> > #define MFC_NUM_PORTS_V12\t\t1\r\n" - "> > #define S5P_FIMV_CODEC_VP9_ENC\t\t27\r\n" - "> > +#define MFC_CHROMA_PAD_BYTES_V12 256\r\n" - "> > +#define S5P_FIMV_D_ALIGN_PLANE_SIZE_V12 256\r\n" - "> >\r\n" - "> > /* Encoder buffer size for MFCv12 */\r\n" - "> > #define ENC_V120_BASE_SIZE(x, y) \\\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r\n" - "> > index 4a7adfdaa359..50f9bf0603c1 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\r\n" - "> > @@ -24,6 +24,7 @@\r\n" - "> >\r\n" - "> > #define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7\r\n" - "> \t0xfa70\r\n" - "> > #define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7\r\n" - "> \t0xfa74\r\n" - "> > +#define S5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7\r\n" - "> \t0xfa78\r\n" - "> >\r\n" - "> > #define S5P_FIMV_E_VP8_OPTIONS_V7\t\t\t0xfdb0\r\n" - "> > #define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7\t\t0xfdb4\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r\n" - "> > index 162e3c7e920f..0ef9eb2dff22 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\r\n" - "> > @@ -17,13 +17,16 @@\r\n" - "> > #define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8\t0xf108\r\n" - "> > #define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8\t0xf144\r\n" - "> > #define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8\t0xf148\r\n" - "> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8\t0xf14C\r\n" - "> > #define S5P_FIMV_D_MV_BUFFER_SIZE_V8\t\t0xf150\r\n" - "> >\r\n" - "> > #define S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8\t0xf138\r\n" - "> > #define S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8\r\n" - "> \t0xf13c\r\n" - "> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8\r\n" - "> \t0xf140\r\n" - "> >\r\n" - "> > #define S5P_FIMV_D_FIRST_PLANE_DPB_V8\t\t0xf160\r\n" - "> > #define S5P_FIMV_D_SECOND_PLANE_DPB_V8\t\t0xf260\r\n" - "> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_V8\t\t0xf360\r\n" - "> > #define S5P_FIMV_D_MV_BUFFER_V8\t\t\t0xf460\r\n" - "> >\r\n" - "> > #define S5P_FIMV_D_NUM_MV_V8\t\t\t0xf134\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r\n" - "> > index dd2e9f7704ab..9a39cccfe002 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\r\n" - "> > @@ -56,6 +56,7 @@\r\n" - "> > #define MFC_NO_INSTANCE_SET\t-1\r\n" - "> > #define MFC_ENC_CAP_PLANE_COUNT\t1\r\n" - "> > #define MFC_ENC_OUT_PLANE_COUNT\t2\r\n" - "> > +#define VB2_MAX_PLANE_COUNT\t3\r\n" - "> > #define STUFF_BYTE\t\t4\r\n" - "> > #define MFC_MAX_CTRLS\t\t128\r\n" - "> >\r\n" - "> > @@ -181,6 +182,7 @@ struct s5p_mfc_buf {\r\n" - "> > \t\tstruct {\r\n" - "> > \t\t\tsize_t luma;\r\n" - "> > \t\t\tsize_t chroma;\r\n" - "> > +\t\t\tsize_t chroma_1;\r\n" - "> > \t\t} raw;\r\n" - "> > \t\tsize_t stream;\r\n" - "> > \t} cookie;\r\n" - "> > @@ -657,6 +659,7 @@ struct s5p_mfc_ctx {\r\n" - "> >\r\n" - "> > \tint luma_size;\r\n" - "> > \tint chroma_size;\r\n" - "> > +\tint chroma_size_1;\r\n" - "> > \tint mv_size;\r\n" - "> >\r\n" - "> > \tunsigned long consumed_stream;\r\n" - "> > @@ -722,6 +725,7 @@ struct s5p_mfc_ctx {\r\n" - "> > \tsize_t scratch_buf_size;\r\n" - "> > \tint is_10bit;\r\n" - "> > \tint is_422;\r\n" - "> > +\tint stride[VB2_MAX_PLANE_COUNT];\r\n" - "> > };\r\n" - "> >\r\n" - "> > /*\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r\n" - "> > index e219cbcd86d5..317f796fffa1 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\r\n" - "> > @@ -56,6 +56,20 @@ static struct s5p_mfc_fmt formats[] = {\r\n" - "> > \t\t.num_planes\t= 2,\r\n" - "> > \t\t.versions\t= MFC_V6PLUS_BITS,\r\n" - "> > \t},\r\n" - "> > +\t{\r\n" - "> > +\t\t.fourcc = V4L2_PIX_FMT_YUV420M,\r\n" - "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\r\n" - "> > +\t\t.type = MFC_FMT_RAW,\r\n" - "> > +\t\t.num_planes = 3,\r\n" - "> > +\t\t.versions = MFC_V12_BIT,\r\n" - "> > +\t},\r\n" - "> > +\t{\r\n" - "> > +\t\t.fourcc = V4L2_PIX_FMT_YVU420M,\r\n" - "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\r\n" - "> > +\t\t.type = MFC_FMT_RAW,\r\n" - "> > +\t\t.num_planes = 3,\r\n" - "> > +\t\t.versions = MFC_V12_BIT\r\n" - "> > +\t},\r\n" - "> > \t{\r\n" - "> > \t\t.fourcc\t\t= V4L2_PIX_FMT_H264,\r\n" - "> > \t\t.codec_mode\t= S5P_MFC_CODEC_H264_DEC,\r\n" - "> > @@ -359,10 +373,15 @@ static int vidioc_g_fmt(struct file *file, void *priv,\r\n" - "> struct v4l2_format *f)\r\n" - "> > \t\t/* Set pixelformat to the format in which MFC\r\n" - "> > \t\t outputs the decoded frame */\r\n" - "> > \t\tpix_mp->pixelformat = ctx->dst_fmt->fourcc;\r\n" - "> > -\t\tpix_mp->plane_fmt[0].bytesperline = ctx->buf_width;\r\n" - "> > +\t\tpix_mp->plane_fmt[0].bytesperline = ctx->stride[0];\r\n" - "> > \t\tpix_mp->plane_fmt[0].sizeimage = ctx->luma_size;\r\n" - "> > -\t\tpix_mp->plane_fmt[1].bytesperline = ctx->buf_width;\r\n" - "> > +\t\tpix_mp->plane_fmt[1].bytesperline = ctx->stride[1];\r\n" - "> > \t\tpix_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M) {\r\n" - "> > +\t\t\tpix_mp->plane_fmt[2].bytesperline = ctx->stride[2];\r\n" - "> > +\t\t\tpix_mp->plane_fmt[2].sizeimage = ctx-\r\n" - "> >chroma_size_1;\r\n" - "> > +\t\t}\r\n" - "> > \t} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {\r\n" - "> > \t\t/* This is run on OUTPUT\r\n" - "> > \t\t The buffer contains compressed image @@ -937,6 +956,9\r\n" - "> @@ static\r\n" - "> > int s5p_mfc_queue_setup(struct vb2_queue *vq,\r\n" - "> > \t\t vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {\r\n" - "> > \t\t/* Output plane count is 2 - one for Y and one for CbCr */\r\n" - "> > \t\t*plane_count = 2;\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\t*plane_count = 3;\r\n" - "> \r\n" - "> I don't usually interfere, this is your driver to maintain, but this becomes\r\n" - "> horribly messy. Have you consider de-hardcoding a little and encapsulate per\r\n" - "> HW format details into a C structure ? Drivers these days try to make sure of\r\n" - "> v4l2- common library, which as a matter of fact knows that YUV420M and\r\n" - "> YVU420M have 3 places, so that you don't have to duplicate it in your driver.\r\n" - "> \r\n" - "> regards,\r\n" - "> Nicolas\r\n" - "\r\n" - "Thanks for pointing out.\r\n" - "We could have done it in this way ' *plane_count = ctx->dst_fmt->num_planes' also.\r\n" - "Anyway, will make use of ' v4l2- common library ' for getting the planes count here in next series.\r\n" - "\r\n" - "Thanks for the review.\r\n" - "> \r\n" - "> > \t\t/* Setup buffer count */\r\n" - "> > \t\tif (*buf_count < ctx->pb_count)\r\n" - "> > \t\t\t*buf_count = ctx->pb_count;\r\n" - "> > @@ -955,12 +977,17 @@ static int s5p_mfc_queue_setup(struct\r\n" - "> vb2_queue *vq,\r\n" - "> > \t vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {\r\n" - "> > \t\tpsize[0] = ctx->luma_size;\r\n" - "> > \t\tpsize[1] = ctx->chroma_size;\r\n" - "> > -\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\tpsize[2] = ctx->chroma_size_1;\r\n" - "> > \t\tif (IS_MFCV6_PLUS(dev))\r\n" - "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX];\r\n" - "> > \t\telse\r\n" - "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX];\r\n" - "> > \t\talloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX];\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\talloc_devs[2] = ctx->dev->mem_dev[BANK_L_CTX];\r\n" - "> > \t} else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&\r\n" - "> > \t\t ctx->state == MFCINST_INIT) {\r\n" - "> > \t\tpsize[0] = ctx->dec_src_buf_size;\r\n" - "> > @@ -994,12 +1021,24 @@ static int s5p_mfc_buf_init(struct vb2_buffer\r\n" - "> *vb)\r\n" - "> > \t\t\tmfc_err(\"Plane buffer (CAPTURE) is too small\\n\");\r\n" - "> > \t\t\treturn -EINVAL;\r\n" - "> > \t\t}\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M) {\r\n" - "> > +\t\t\tif (vb2_plane_size(vb, 2) < ctx->chroma_size_1) {\r\n" - "> > +\t\t\t\tmfc_err(\"Plane buffer (CAPTURE) is too\r\n" - "> small\\n\");\r\n" - "> > +\t\t\t\treturn -EINVAL;\r\n" - "> > +\t\t\t}\r\n" - "> > +\t\t}\r\n" - "> > \t\ti = vb->index;\r\n" - "> > \t\tctx->dst_bufs[i].b = vbuf;\r\n" - "> > \t\tctx->dst_bufs[i].cookie.raw.luma =\r\n" - "> >\r\n" - "> \tvb2_dma_contig_plane_dma_addr(vb, 0);\r\n" - "> > \t\tctx->dst_bufs[i].cookie.raw.chroma =\r\n" - "> >\r\n" - "> \tvb2_dma_contig_plane_dma_addr(vb, 1);\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M) {\r\n" - "> > +\t\t\tctx->dst_bufs[i].cookie.raw.chroma_1 =\r\n" - "> > +\r\n" - "> \tvb2_dma_contig_plane_dma_addr(vb, 2);\r\n" - "> > +\t\t}\r\n" - "> > \t\tctx->dst_bufs_cnt++;\r\n" - "> > \t} else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {\r\n" - "> > \t\tif (IS_ERR_OR_NULL(ERR_PTR(\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r\n" - "> > index e4d6e7c117b5..0eec04eb3ef3 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\r\n" - "> > @@ -59,6 +59,20 @@ static struct s5p_mfc_fmt formats[] = {\r\n" - "> > \t\t.num_planes\t= 2,\r\n" - "> > \t\t.versions\t= MFC_V6PLUS_BITS,\r\n" - "> > \t},\r\n" - "> > +\t{\r\n" - "> > +\t\t.fourcc = V4L2_PIX_FMT_YUV420M,\r\n" - "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\r\n" - "> > +\t\t.type = MFC_FMT_RAW,\r\n" - "> > +\t\t.num_planes = 3,\r\n" - "> > +\t\t.versions = MFC_V12_BIT,\r\n" - "> > +\t},\r\n" - "> > +\t{\r\n" - "> > +\t\t.fourcc = V4L2_PIX_FMT_YVU420M,\r\n" - "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\r\n" - "> > +\t\t.type = MFC_FMT_RAW,\r\n" - "> > +\t\t.num_planes = 3,\r\n" - "> > +\t\t.versions = MFC_V12_BIT,\r\n" - "> > +\t},\r\n" - "> > \t{\r\n" - "> > \t\t.fourcc\t\t= V4L2_PIX_FMT_H264,\r\n" - "> > \t\t.codec_mode\t= S5P_MFC_CODEC_H264_ENC,\r\n" - "> > @@ -1193,14 +1207,20 @@ static int enc_pre_frame_start(struct\r\n" - "> s5p_mfc_ctx *ctx)\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> > \tstruct s5p_mfc_buf *dst_mb;\r\n" - "> > \tstruct s5p_mfc_buf *src_mb;\r\n" - "> > -\tunsigned long src_y_addr, src_c_addr, dst_addr;\r\n" - "> > +\tunsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr;\r\n" - "> > \tunsigned int dst_size;\r\n" - "> >\r\n" - "> > \tsrc_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);\r\n" - "> > \tsrc_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b-\r\n" - "> >vb2_buf, 0);\r\n" - "> > \tsrc_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b-\r\n" - "> >vb2_buf, 1);\r\n" - "> > +\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\tctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\tsrc_c_1_addr =\r\n" - "> > +\t\t\tvb2_dma_contig_plane_dma_addr(&src_mb->b-\r\n" - "> >vb2_buf, 2);\r\n" - "> > +\telse\r\n" - "> > +\t\tsrc_c_1_addr = 0;\r\n" - "> > \ts5p_mfc_hw_call(dev->mfc_ops, set_enc_frame_buffer, ctx,\r\n" - "> > -\t\t\t\t\t\t\tsrc_y_addr,\r\n" - "> src_c_addr);\r\n" - "> > +\t\t\t\t\tsrc_y_addr, src_c_addr,\r\n" - "> src_c_1_addr);\r\n" - "> >\r\n" - "> > \tdst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);\r\n" - "> > \tdst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b-\r\n" - "> >vb2_buf, 0); @@\r\n" - "> > -1215,8 +1235,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx\r\n" - "> > *ctx) {\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> > \tstruct s5p_mfc_buf *mb_entry;\r\n" - "> > -\tunsigned long enc_y_addr = 0, enc_c_addr = 0;\r\n" - "> > -\tunsigned long mb_y_addr, mb_c_addr;\r\n" - "> > +\tunsigned long enc_y_addr = 0, enc_c_addr = 0, enc_c_1_addr = 0;\r\n" - "> > +\tunsigned long mb_y_addr, mb_c_addr, mb_c_1_addr;\r\n" - "> > \tint slice_type;\r\n" - "> > \tunsigned int strm_size;\r\n" - "> > \tbool src_ready;\r\n" - "> > @@ -1229,14 +1249,21 @@ static int enc_post_frame_start(struct\r\n" - "> s5p_mfc_ctx *ctx)\r\n" - "> > \t\t mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT));\r\n" - "> > \tif (slice_type >= 0) {\r\n" - "> > \t\ts5p_mfc_hw_call(dev->mfc_ops, get_enc_frame_buffer,\r\n" - "> ctx,\r\n" - "> > -\t\t\t\t&enc_y_addr, &enc_c_addr);\r\n" - "> > +\t\t\t\t&enc_y_addr, &enc_c_addr,\r\n" - "> &enc_c_1_addr);\r\n" - "> > \t\tlist_for_each_entry(mb_entry, &ctx->src_queue, list) {\r\n" - "> > \t\t\tmb_y_addr = vb2_dma_contig_plane_dma_addr(\r\n" - "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 0);\r\n" - "> > \t\t\tmb_c_addr = vb2_dma_contig_plane_dma_addr(\r\n" - "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 1);\r\n" - "> > -\t\t\tif ((enc_y_addr == mb_y_addr) &&\r\n" - "> > -\t\t\t\t\t\t(enc_c_addr == mb_c_addr))\r\n" - "> {\r\n" - "> > +\t\t\tif (ctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\t\tmb_c_1_addr =\r\n" - "> vb2_dma_contig_plane_dma_addr\r\n" - "> > +\t\t\t\t\t\t(&mb_entry->b->vb2_buf,\r\n" - "> 2);\r\n" - "> > +\t\t\telse\r\n" - "> > +\t\t\t\tmb_c_1_addr = 0;\r\n" - "> > +\t\t\tif ((enc_y_addr == mb_y_addr)\r\n" - "> > +\t\t\t\t\t&& (enc_c_addr == mb_c_addr)\r\n" - "> > +\t\t\t\t\t&& (enc_c_1_addr ==\r\n" - "> mb_c_1_addr)) {\r\n" - "> > \t\t\t\tlist_del(&mb_entry->list);\r\n" - "> > \t\t\t\tctx->src_queue_cnt--;\r\n" - "> > \t\t\t\tvb2_buffer_done(&mb_entry->b->vb2_buf,\r\n" - "> > @@ -1249,8 +1276,15 @@ static int enc_post_frame_start(struct\r\n" - "> s5p_mfc_ctx *ctx)\r\n" - "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 0);\r\n" - "> > \t\t\tmb_c_addr = vb2_dma_contig_plane_dma_addr(\r\n" - "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 1);\r\n" - "> > -\t\t\tif ((enc_y_addr == mb_y_addr) &&\r\n" - "> > -\t\t\t\t\t\t(enc_c_addr == mb_c_addr))\r\n" - "> {\r\n" - "> > +\t\t\tif (ctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\t\tmb_c_1_addr =\r\n" - "> vb2_dma_contig_plane_dma_addr(\r\n" - "> > +\t\t\t\t\t\t&mb_entry->b->vb2_buf, 2);\r\n" - "> > +\t\t\telse\r\n" - "> > +\t\t\t\tmb_c_1_addr = 0;\r\n" - "> > +\t\t\tif ((enc_y_addr == mb_y_addr)\r\n" - "> > +\t\t\t\t\t&& (enc_c_addr == mb_c_addr)\r\n" - "> > +\t\t\t\t\t&& (enc_c_1_addr ==\r\n" - "> mb_c_1_addr)) {\r\n" - "> > \t\t\t\tlist_del(&mb_entry->list);\r\n" - "> > \t\t\t\tctx->ref_queue_cnt--;\r\n" - "> > \t\t\t\tvb2_buffer_done(&mb_entry->b->vb2_buf,\r\n" - "> > @@ -1381,10 +1415,15 @@ static int vidioc_g_fmt(struct file *file, void\r\n" - "> *priv, struct v4l2_format *f)\r\n" - "> > \t\tpix_fmt_mp->pixelformat = ctx->src_fmt->fourcc;\r\n" - "> > \t\tpix_fmt_mp->num_planes = ctx->src_fmt->num_planes;\r\n" - "> >\r\n" - "> > -\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width;\r\n" - "> > +\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0];\r\n" - "> > \t\tpix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size;\r\n" - "> > -\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width;\r\n" - "> > +\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1];\r\n" - "> > \t\tpix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\r\n" - "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M) {\r\n" - "> > +\t\t\tpix_fmt_mp->plane_fmt[2].bytesperline = ctx-\r\n" - "> >stride[2];\r\n" - "> > +\t\t\tpix_fmt_mp->plane_fmt[2].sizeimage = ctx-\r\n" - "> >chroma_size_1;\r\n" - "> > +\t\t}\r\n" - "> > \t} else {\r\n" - "> > \t\tmfc_err(\"invalid buf type\\n\");\r\n" - "> > \t\treturn -EINVAL;\r\n" - "> > @@ -1468,9 +1507,14 @@ static int vidioc_s_fmt(struct file *file, void\r\n" - "> > *priv, struct v4l2_format *f)\r\n" - "> >\r\n" - "> > \t\ts5p_mfc_hw_call(dev->mfc_ops, enc_calc_src_size, ctx);\r\n" - "> > \t\tpix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size;\r\n" - "> > -\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width;\r\n" - "> > +\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0];\r\n" - "> > \t\tpix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\r\n" - "> > -\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width;\r\n" - "> > +\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1];\r\n" - "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M) {\r\n" - "> > +\t\t\tpix_fmt_mp->plane_fmt[2].bytesperline = ctx-\r\n" - "> >stride[2];\r\n" - "> > +\t\t\tpix_fmt_mp->plane_fmt[2].sizeimage = ctx-\r\n" - "> >chroma_size_1;\r\n" - "> > +\t\t}\r\n" - "> >\r\n" - "> > \t\tctx->src_bufs_cnt = 0;\r\n" - "> > \t\tctx->output_state = QUEUE_FREE;\r\n" - "> > @@ -2414,10 +2458,16 @@ static int s5p_mfc_queue_setup(struct\r\n" - "> > vb2_queue *vq,\r\n" - "> >\r\n" - "> > \t\tpsize[0] = ctx->luma_size;\r\n" - "> > \t\tpsize[1] = ctx->chroma_size;\r\n" - "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\tpsize[2] = ctx->chroma_size_1;\r\n" - "> >\r\n" - "> > \t\tif (IS_MFCV6_PLUS(dev)) {\r\n" - "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX];\r\n" - "> > \t\t\talloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX];\r\n" - "> > +\t\t\tif (ctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\t\talloc_devs[2] = ctx->dev-\r\n" - "> >mem_dev[BANK_L_CTX];\r\n" - "> > \t\t} else {\r\n" - "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX];\r\n" - "> > \t\t\talloc_devs[1] = ctx->dev->mem_dev[BANK_R_CTX];\r\n" - "> @@ -2456,6 +2506,10\r\n" - "> > @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)\r\n" - "> >\r\n" - "> \tvb2_dma_contig_plane_dma_addr(vb, 0);\r\n" - "> > \t\tctx->src_bufs[i].cookie.raw.chroma =\r\n" - "> >\r\n" - "> \tvb2_dma_contig_plane_dma_addr(vb, 1);\r\n" - "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\tctx->src_bufs[i].cookie.raw.chroma_1 =\r\n" - "> > +\r\n" - "> \tvb2_dma_contig_plane_dma_addr(vb, 2);\r\n" - "> > \t\tctx->src_bufs_cnt++;\r\n" - "> > \t} else {\r\n" - "> > \t\tmfc_err(\"invalid queue type: %d\\n\", vq->type); @@ -2493,6\r\n" - "> +2547,12\r\n" - "> > @@ static int s5p_mfc_buf_prepare(struct vb2_buffer *vb)\r\n" - "> > \t\t\tmfc_err(\"plane size is too small for output\\n\");\r\n" - "> > \t\t\treturn -EINVAL;\r\n" - "> > \t\t}\r\n" - "> > +\t\tif ((ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) &&\r\n" - "> > +\t\t (vb2_plane_size(vb, 2) < ctx->chroma_size_1)) {\r\n" - "> > +\t\t\tmfc_err(\"plane size is too small for output\\n\");\r\n" - "> > +\t\t\treturn -EINVAL;\r\n" - "> > +\t\t}\r\n" - "> > \t} else {\r\n" - "> > \t\tmfc_err(\"invalid queue type: %d\\n\", vq->type);\r\n" - "> > \t\treturn -EINVAL;\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r\n" - "> > index 87ac56756a16..7c5e851c8191 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\r\n" - "> > @@ -293,9 +293,11 @@ struct s5p_mfc_hw_ops {\r\n" - "> > \tint (*set_enc_stream_buffer)(struct s5p_mfc_ctx *ctx,\r\n" - "> > \t\t\tunsigned long addr, unsigned int size);\r\n" - "> > \tvoid (*set_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,\r\n" - "> > -\t\t\tunsigned long y_addr, unsigned long c_addr);\r\n" - "> > +\t\t\tunsigned long y_addr, unsigned long c_addr,\r\n" - "> > +\t\t\tunsigned long c_1_addr);\r\n" - "> > \tvoid (*get_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,\r\n" - "> > -\t\t\tunsigned long *y_addr, unsigned long *c_addr);\r\n" - "> > +\t\t\tunsigned long *y_addr, unsigned long *c_addr,\r\n" - "> > +\t\t\tunsigned long *c_1_addr);\r\n" - "> > \tvoid (*try_run)(struct s5p_mfc_dev *dev);\r\n" - "> > \tvoid (*clear_int_flags)(struct s5p_mfc_dev *dev);\r\n" - "> > \tint (*get_dspl_y_adr)(struct s5p_mfc_dev *dev); diff --git\r\n" - "> > a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r\n" - "> > index 28a06dc343fd..fcfaf125a5a1 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\r\n" - "> > @@ -516,7 +516,8 @@ static int\r\n" - "> s5p_mfc_set_enc_stream_buffer_v5(struct\r\n" - "> > s5p_mfc_ctx *ctx, }\r\n" - "> >\r\n" - "> > static void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,\r\n" - "> > -\t\tunsigned long y_addr, unsigned long c_addr)\r\n" - "> > +\t\tunsigned long y_addr, unsigned long c_addr,\r\n" - "> > +\t\tunsigned long c_1_addr)\r\n" - "> > {\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> >\r\n" - "> > @@ -525,7 +526,8 @@ static void\r\n" - "> s5p_mfc_set_enc_frame_buffer_v5(struct\r\n" - "> > s5p_mfc_ctx *ctx, }\r\n" - "> >\r\n" - "> > static void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,\r\n" - "> > -\t\tunsigned long *y_addr, unsigned long *c_addr)\r\n" - "> > +\t\tunsigned long *y_addr, unsigned long *c_addr,\r\n" - "> > +\t\tunsigned long *c_1_addr)\r\n" - "> > {\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> >\r\n" - "> > @@ -1210,7 +1212,7 @@ static int s5p_mfc_run_enc_frame(struct\r\n" - "> s5p_mfc_ctx *ctx)\r\n" - "> > \tif (list_empty(&ctx->src_queue)) {\r\n" - "> > \t\t/* send null frame */\r\n" - "> > \t\ts5p_mfc_set_enc_frame_buffer_v5(ctx, dev-\r\n" - "> >dma_base[BANK_R_CTX],\r\n" - "> > -\t\t\t\t\t\tdev-\r\n" - "> >dma_base[BANK_R_CTX]);\r\n" - "> > +\t\t\t\t\t\tdev-\r\n" - "> >dma_base[BANK_R_CTX], 0);\r\n" - "> > \t\tsrc_mb = NULL;\r\n" - "> > \t} else {\r\n" - "> > \t\tsrc_mb = list_entry(ctx->src_queue.next, struct\r\n" - "> s5p_mfc_buf, @@\r\n" - "> > -1220,7 +1222,7 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx\r\n" - "> *ctx)\r\n" - "> > \t\t\t/* send null frame */\r\n" - "> > \t\t\ts5p_mfc_set_enc_frame_buffer_v5(ctx,\r\n" - "> > \t\t\t\t\t\tdev-\r\n" - "> >dma_base[BANK_R_CTX],\r\n" - "> > -\t\t\t\t\t\tdev-\r\n" - "> >dma_base[BANK_R_CTX]);\r\n" - "> > +\t\t\t\t\t\tdev-\r\n" - "> >dma_base[BANK_R_CTX], 0);\r\n" - "> > \t\t\tctx->state = MFCINST_FINISHING;\r\n" - "> > \t\t} else {\r\n" - "> > \t\t\tsrc_y_addr = vb2_dma_contig_plane_dma_addr(\r\n" - "> @@ -1228,7 +1230,7 @@\r\n" - "> > static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)\r\n" - "> > \t\t\tsrc_c_addr = vb2_dma_contig_plane_dma_addr(\r\n" - "> > \t\t\t\t\t&src_mb->b->vb2_buf, 1);\r\n" - "> > \t\t\ts5p_mfc_set_enc_frame_buffer_v5(ctx, src_y_addr,\r\n" - "> > -\t\t\t\t\t\t\t\tsrc_c_addr);\r\n" - "> > +\t\t\t\t\t\t\t\tsrc_c_addr,\r\n" - "> 0);\r\n" - "> > \t\t\tif (src_mb->flags & MFC_BUF_FLAG_EOS)\r\n" - "> > \t\t\t\tctx->state = MFCINST_FINISHING;\r\n" - "> > \t\t}\r\n" - "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r\n" - "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r\n" - "> > index fb3f0718821d..e579c765e902 100644\r\n" - "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r\n" - "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\r\n" - "> > @@ -494,16 +494,43 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct\r\n" - "> s5p_mfc_ctx *ctx)\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> > \tctx->buf_width = ALIGN(ctx->img_width,\r\n" - "> S5P_FIMV_NV12MT_HALIGN_V6);\r\n" - "> > \tctx->buf_height = ALIGN(ctx->img_height,\r\n" - "> S5P_FIMV_NV12MT_VALIGN_V6);\r\n" - "> > +\tctx->chroma_size_1 = 0;\r\n" - "> > \tmfc_debug(2, \"SEQ Done: Movie dimensions %dx%d,\\n\"\r\n" - "> > \t\t\t\"buffer dimensions: %dx%d\\n\", ctx->img_width,\r\n" - "> > \t\t\tctx->img_height, ctx->buf_width, ctx->buf_height);\r\n" - "> >\r\n" - "> > -\tctx->luma_size = calc_plane(ctx->img_width, ctx->img_height);\r\n" - "> > -\tctx->chroma_size = calc_plane(ctx->img_width, (ctx->img_height >>\r\n" - "> 1));\r\n" - "> > +\tswitch (ctx->dst_fmt->fourcc) {\r\n" - "> > +\tcase V4L2_PIX_FMT_NV12M:\r\n" - "> > +\tcase V4L2_PIX_FMT_NV21M:\r\n" - "> > +\t\tctx->stride[0] = ALIGN(ctx->img_width,\r\n" - "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\r\n" - "> > +\t\tctx->stride[1] = ALIGN(ctx->img_width,\r\n" - "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\r\n" - "> > +\t\tctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height);\r\n" - "> > +\t\tctx->chroma_size = calc_plane(ctx->stride[1],\r\n" - "> > +\t\t\t\t\t(ctx->img_height / 2));\r\n" - "> > +\t\tbreak;\r\n" - "> > +\tcase V4L2_PIX_FMT_YUV420M:\r\n" - "> > +\tcase V4L2_PIX_FMT_YVU420M:\r\n" - "> > +\t\tctx->stride[0] = ALIGN(ctx->img_width,\r\n" - "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\r\n" - "> > +\t\tctx->stride[1] = ALIGN(ctx->img_width / 2,\r\n" - "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\r\n" - "> > +\t\tctx->stride[2] = ALIGN(ctx->img_width / 2,\r\n" - "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\r\n" - "> > +\t\tctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height);\r\n" - "> > +\t\tctx->chroma_size = calc_plane(ctx->stride[1],\r\n" - "> > +\t\t\t\t\t(ctx->img_height / 2));\r\n" - "> > +\t\tctx->chroma_size_1 = calc_plane(ctx->stride[2],\r\n" - "> > +\t\t\t\t\t(ctx->img_height / 2));\r\n" - "> > +\t\tbreak;\r\n" - "> > +\t}\r\n" - "> > +\r\n" - "> > \tif (IS_MFCV8_PLUS(ctx->dev)) {\r\n" - "> > \t\t/* MFCv8 needs additional 64 bytes for luma,chroma dpb*/\r\n" - "> > \t\tctx->luma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\r\n" - "> > \t\tctx->chroma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\r\n" - "> > +\t\tctx->chroma_size_1 +=\r\n" - "> S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\r\n" - "> > \t}\r\n" - "> >\r\n" - "> > \tif (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC || @@ -534,15\r\n" - "> +561,53\r\n" - "> > @@ static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx)\r\n" - "> > \tmb_width = MB_WIDTH(ctx->img_width);\r\n" - "> > \tmb_height = MB_HEIGHT(ctx->img_height);\r\n" - "> >\r\n" - "> > -\tctx->buf_width = ALIGN(ctx->img_width,\r\n" - "> S5P_FIMV_NV12M_HALIGN_V6);\r\n" - "> > -\tctx->luma_size = ALIGN((mb_width * mb_height) * 256, 256);\r\n" - "> > -\tctx->chroma_size = ALIGN((mb_width * mb_height) * 128, 256);\r\n" - "> > -\r\n" - "> > -\t/* MFCv7 needs pad bytes for Luma and Chroma */\r\n" - "> > -\tif (IS_MFCV7_PLUS(ctx->dev)) {\r\n" - "> > +\tif (IS_MFCV12(ctx->dev)) {\r\n" - "> > +\t\tswitch (ctx->src_fmt->fourcc) {\r\n" - "> > +\t\tcase V4L2_PIX_FMT_NV12M:\r\n" - "> > +\t\tcase V4L2_PIX_FMT_NV21M:\r\n" - "> > +\t\t\tctx->stride[0] = ALIGN(ctx->img_width,\r\n" - "> > +\r\n" - "> \tS5P_FIMV_NV12M_HALIGN_V6);\r\n" - "> > +\t\t\tctx->stride[1] = ALIGN(ctx->img_width,\r\n" - "> > +\r\n" - "> \tS5P_FIMV_NV12M_HALIGN_V6);\r\n" - "> > +\t\t\tctx->luma_size = ctx->stride[0] *\r\n" - "> > +\t\t\t\t\t\tALIGN(ctx->img_height, 16);\r\n" - "> > +\t\t\tctx->chroma_size = ctx->stride[0] *\r\n" - "> > +\t\t\t\t\t\tALIGN(ctx->img_height / 2,\r\n" - "> 16);\r\n" - "> > +\t\t\tbreak;\r\n" - "> > +\t\tcase V4L2_PIX_FMT_YUV420M:\r\n" - "> > +\t\tcase V4L2_PIX_FMT_YVU420M:\r\n" - "> > +\t\t\tctx->stride[0] = ALIGN(ctx->img_width,\r\n" - "> > +\r\n" - "> \tS5P_FIMV_NV12M_HALIGN_V6);\r\n" - "> > +\t\t\tctx->stride[1] = ALIGN(ctx->img_width / 2,\r\n" - "> > +\r\n" - "> \tS5P_FIMV_NV12M_HALIGN_V6);\r\n" - "> > +\t\t\tctx->stride[2] = ALIGN(ctx->img_width / 2,\r\n" - "> > +\r\n" - "> \tS5P_FIMV_NV12M_HALIGN_V6);\r\n" - "> > +\t\t\tctx->luma_size = ctx->stride[0] *\r\n" - "> > +\t\t\t\t\t\tALIGN(ctx->img_height, 16);\r\n" - "> > +\t\t\tctx->chroma_size = ctx->stride[1] *\r\n" - "> > +\t\t\t\t\t\tALIGN(ctx->img_height / 2,\r\n" - "> 16);\r\n" - "> > +\t\t\tctx->chroma_size_1 = ctx->stride[2] *\r\n" - "> > +\t\t\t\t\t\tALIGN(ctx->img_height / 2,\r\n" - "> 16);\r\n" - "> > +\t\t\tbreak;\r\n" - "> > +\t\t}\r\n" - "> > \t\tctx->luma_size += MFC_LUMA_PAD_BYTES_V7;\r\n" - "> > -\t\tctx->chroma_size += MFC_CHROMA_PAD_BYTES_V7;\r\n" - "> > +\t\tctx->chroma_size += MFC_CHROMA_PAD_BYTES_V12;\r\n" - "> > +\t\tctx->chroma_size_1 += MFC_CHROMA_PAD_BYTES_V12;\r\n" - "> > +\t} else {\r\n" - "> > +\t\tctx->buf_width = ALIGN(ctx->img_width,\r\n" - "> > +\t\t\t\t\tS5P_FIMV_NV12M_HALIGN_V6);\r\n" - "> > +\t\tctx->stride[0] = ctx->buf_width;\r\n" - "> > +\t\tctx->stride[1] = ctx->buf_width;\r\n" - "> > +\t\tctx->luma_size = ALIGN((mb_width * mb_height) * 256,\r\n" - "> 256);\r\n" - "> > +\t\tctx->chroma_size = ALIGN((mb_width * mb_height) * 128,\r\n" - "> 256);\r\n" - "> > +\t\tctx->chroma_size_1 = 0;\r\n" - "> > +\t\t/* MFCv7 needs pad bytes for Luma and Chroma */\r\n" - "> > +\t\tif (IS_MFCV7_PLUS(ctx->dev)) {\r\n" - "> > +\t\t\tctx->luma_size += MFC_LUMA_PAD_BYTES_V7;\r\n" - "> > +\t\t\tctx->chroma_size += MFC_LUMA_PAD_BYTES_V7;\r\n" - "> > +\t\t}\r\n" - "> > \t}\r\n" - "> > +\r\n" - "> > }\r\n" - "> >\r\n" - "> > /* Set registers for decoding stream buffer */ @@ -588,15 +653,21 @@\r\n" - "> > static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)\r\n" - "> > \twritel(ctx->total_dpb_count, mfc_regs->d_num_dpb);\r\n" - "> > \twritel(ctx->luma_size, mfc_regs->d_first_plane_dpb_size);\r\n" - "> > \twritel(ctx->chroma_size, mfc_regs->d_second_plane_dpb_size);\r\n" - "> > -\r\n" - "> > +\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\tctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\twritel(ctx->chroma_size_1, mfc_regs-\r\n" - "> >d_third_plane_dpb_size);\r\n" - "> > \twritel(buf_addr1, mfc_regs->d_scratch_buffer_addr);\r\n" - "> > \twritel(ctx->scratch_buf_size, mfc_regs->d_scratch_buffer_size);\r\n" - "> >\r\n" - "> > \tif (IS_MFCV8_PLUS(dev)) {\r\n" - "> > -\t\twritel(ctx->img_width,\r\n" - "> > +\t\twritel(ctx->stride[0],\r\n" - "> > \t\t\tmfc_regs->d_first_plane_dpb_stride_size);\r\n" - "> > -\t\twritel(ctx->img_width,\r\n" - "> > +\t\twritel(ctx->stride[1],\r\n" - "> > \t\t\tmfc_regs->d_second_plane_dpb_stride_size);\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\twritel(ctx->stride[2],\r\n" - "> > +\t\t\t\tmfc_regs->d_third_plane_dpb_stride_size);\r\n" - "> > \t}\r\n" - "> >\r\n" - "> > \tbuf_addr1 += ctx->scratch_buf_size;\r\n" - "> > @@ -625,6 +696,13 @@ static int\r\n" - "> s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)\r\n" - "> > \t\t\t\t\tctx->dst_bufs[i].cookie.raw.chroma);\r\n" - "> > \t\twritel(ctx->dst_bufs[i].cookie.raw.chroma,\r\n" - "> > \t\t\t\tmfc_regs->d_second_plane_dpb + i * 4);\r\n" - "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->dst_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M) {\r\n" - "> > +\t\t\tmfc_debug(2, \"\\tChroma_1 %d: %zx\\n\", i,\r\n" - "> > +\t\t\t\t\tctx-\r\n" - "> >dst_bufs[i].cookie.raw.chroma_1);\r\n" - "> > +\t\t\twritel(ctx->dst_bufs[i].cookie.raw.chroma_1,\r\n" - "> > +\t\t\t\t\tmfc_regs->d_third_plane_dpb + i *\r\n" - "> 4);\r\n" - "> > +\t\t}\r\n" - "> > \t}\r\n" - "> > \tif (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC ||\r\n" - "> > \t\t\tctx->codec_mode ==\r\n" - "> S5P_MFC_CODEC_H264_MVC_DEC || @@ -683,20\r\n" - "> > +761,24 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct\r\n" - "> > s5p_mfc_ctx *ctx, }\r\n" - "> >\r\n" - "> > static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,\r\n" - "> > -\t\tunsigned long y_addr, unsigned long c_addr)\r\n" - "> > +\t\tunsigned long y_addr, unsigned long c_addr,\r\n" - "> > +\t\tunsigned long c_1_addr)\r\n" - "> > {\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> > \tconst struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;\r\n" - "> >\r\n" - "> > \twritel(y_addr, mfc_regs->e_source_first_plane_addr);\r\n" - "> > \twritel(c_addr, mfc_regs->e_source_second_plane_addr);\r\n" - "> > +\twritel(c_1_addr, mfc_regs->e_source_third_plane_addr);\r\n" - "> >\r\n" - "> > \tmfc_debug(2, \"enc src y buf addr: 0x%08lx\\n\", y_addr);\r\n" - "> > \tmfc_debug(2, \"enc src c buf addr: 0x%08lx\\n\", c_addr);\r\n" - "> > +\tmfc_debug(2, \"enc src cr buf addr: 0x%08lx\\n\", c_1_addr);\r\n" - "> > }\r\n" - "> >\r\n" - "> > static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,\r\n" - "> > -\t\tunsigned long *y_addr, unsigned long *c_addr)\r\n" - "> > +\t\tunsigned long *y_addr, unsigned long *c_addr,\r\n" - "> > +\t\tunsigned long *c_1_addr)\r\n" - "> > {\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> > \tconst struct s5p_mfc_regs *mfc_regs = dev->mfc_regs; @@ -704,12\r\n" - "> > +786,17 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct\r\n" - "> > s5p_mfc_ctx *ctx,\r\n" - "> >\r\n" - "> > \t*y_addr = readl(mfc_regs->e_encoded_source_first_plane_addr);\r\n" - "> > \t*c_addr = readl(mfc_regs-\r\n" - "> >e_encoded_source_second_plane_addr);\r\n" - "> > +\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\tctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t*c_1_addr = readl(mfc_regs-\r\n" - "> >e_encoded_source_third_plane_addr);\r\n" - "> > +\telse\r\n" - "> > +\t\t*c_1_addr = 0;\r\n" - "> >\r\n" - "> > \tenc_recon_y_addr = readl(mfc_regs->e_recon_luma_dpb_addr);\r\n" - "> > \tenc_recon_c_addr = readl(mfc_regs->e_recon_chroma_dpb_addr);\r\n" - "> >\r\n" - "> > \tmfc_debug(2, \"recon y addr: 0x%08lx y_addr: 0x%08lx\\n\",\r\n" - "> enc_recon_y_addr, *y_addr);\r\n" - "> > -\tmfc_debug(2, \"recon c addr: 0x%08lx\\n\", enc_recon_c_addr);\r\n" - "> > +\tmfc_debug(2, \"recon c addr: 0x%08lx c_addr: 0x%08lx\\n\",\r\n" - "> > +enc_recon_c_addr, *c_addr);\r\n" - "> > }\r\n" - "> >\r\n" - "> > /* Set encoding ref & codec buffer */ @@ -886,6 +973,20 @@ static int\r\n" - "> > s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)\r\n" - "> > \t\twritel(reg, mfc_regs->e_enc_options);\r\n" - "> > \t\t/* 0: NV12(CbCr), 1: NV21(CrCb) */\r\n" - "> > \t\twritel(0x0, mfc_regs->pixel_format);\r\n" - "> > +\t} else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) {\r\n" - "> > +\t\t/* 0: Linear, 1: 2D tiled*/\r\n" - "> > +\t\treg = readl(mfc_regs->e_enc_options);\r\n" - "> > +\t\treg &= ~(0x1 << 7);\r\n" - "> > +\t\twritel(reg, mfc_regs->e_enc_options);\r\n" - "> > +\t\t/* 2: YV12(CrCb), 3: I420(CrCb) */\r\n" - "> > +\t\twritel(0x2, mfc_regs->pixel_format);\r\n" - "> > +\t} else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M) {\r\n" - "> > +\t\t/* 0: Linear, 1: 2D tiled*/\r\n" - "> > +\t\treg = readl(mfc_regs->e_enc_options);\r\n" - "> > +\t\treg &= ~(0x1 << 7);\r\n" - "> > +\t\twritel(reg, mfc_regs->e_enc_options);\r\n" - "> > +\t\t/* 2: YV12(CrCb), 3: I420(CrCb) */\r\n" - "> > +\t\twritel(0x3, mfc_regs->pixel_format);\r\n" - "> > \t}\r\n" - "> >\r\n" - "> > \t/* memory structure recon. frame */\r\n" - "> > @@ -1696,8 +1797,12 @@ static int s5p_mfc_init_decode_v6(struct\r\n" - "> s5p_mfc_ctx *ctx)\r\n" - "> > \telse\r\n" - "> > \t\twritel(reg, mfc_regs->d_dec_options);\r\n" - "> >\r\n" - "> > -\t/* 0: NV12(CbCr), 1: NV21(CrCb) */\r\n" - "> > -\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M)\r\n" - "> > +\t/* 0: NV12(CbCr), 1: NV21(CrCb), 2: YV12(CrCb), 3: I420(CbCr) */\r\n" - "> > +\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M)\r\n" - "> > +\t\twritel(0x3, mfc_regs->pixel_format);\r\n" - "> > +\telse if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\twritel(0x2, mfc_regs->pixel_format);\r\n" - "> > +\telse if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M)\r\n" - "> > \t\twritel(0x1, mfc_regs->pixel_format);\r\n" - "> > \telse\r\n" - "> > \t\twritel(0x0, mfc_regs->pixel_format); @@ -1781,8 +1886,12\r\n" - "> @@ static\r\n" - "> > int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx)\r\n" - "> >\r\n" - "> > \t/* Set stride lengths for v7 & above */\r\n" - "> > \tif (IS_MFCV7_PLUS(dev)) {\r\n" - "> > -\t\twritel(ctx->img_width, mfc_regs-\r\n" - "> >e_source_first_plane_stride);\r\n" - "> > -\t\twritel(ctx->img_width, mfc_regs-\r\n" - "> >e_source_second_plane_stride);\r\n" - "> > +\t\twritel(ctx->stride[0], mfc_regs-\r\n" - "> >e_source_first_plane_stride);\r\n" - "> > +\t\twritel(ctx->stride[1], mfc_regs-\r\n" - "> >e_source_second_plane_stride);\r\n" - "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\twritel(ctx->stride[2],\r\n" - "> > +\t\t\t\t\tmfc_regs-\r\n" - "> >e_source_third_plane_stride);\r\n" - "> > \t}\r\n" - "> >\r\n" - "> > \twritel(ctx->inst_no, mfc_regs->instance_id); @@ -1891,7 +2000,7\r\n" - "> @@\r\n" - "> > static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)\r\n" - "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\r\n" - "> > \tstruct s5p_mfc_buf *dst_mb;\r\n" - "> > \tstruct s5p_mfc_buf *src_mb;\r\n" - "> > -\tunsigned long src_y_addr, src_c_addr, dst_addr;\r\n" - "> > +\tunsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr;\r\n" - "> > \t/*\r\n" - "> > \tunsigned int src_y_size, src_c_size;\r\n" - "> > \t*/\r\n" - "> > @@ -1909,22 +2018,29 @@ static inline int s5p_mfc_run_enc_frame(struct\r\n" - "> > s5p_mfc_ctx *ctx)\r\n" - "> >\r\n" - "> > \tif (list_empty(&ctx->src_queue)) {\r\n" - "> > \t\t/* send null frame */\r\n" - "> > -\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0);\r\n" - "> > +\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0);\r\n" - "> > \t\tsrc_mb = NULL;\r\n" - "> > \t} else {\r\n" - "> > \t\tsrc_mb = list_entry(ctx->src_queue.next, struct\r\n" - "> s5p_mfc_buf, list);\r\n" - "> > \t\tsrc_mb->flags |= MFC_BUF_FLAG_USED;\r\n" - "> > \t\tif (src_mb->b->vb2_buf.planes[0].bytesused == 0) {\r\n" - "> > -\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0);\r\n" - "> > +\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0);\r\n" - "> > \t\t\tctx->state = MFCINST_FINISHING;\r\n" - "> > \t\t} else {\r\n" - "> > \t\t\tsrc_y_addr =\r\n" - "> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0);\r\n" - "> > \t\t\tsrc_c_addr =\r\n" - "> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf,\r\n" - "> > 1);\r\n" - "> > +\t\t\tif (ctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YUV420M ||\r\n" - "> > +\t\t\t\tctx->src_fmt->fourcc ==\r\n" - "> V4L2_PIX_FMT_YVU420M)\r\n" - "> > +\t\t\t\tsrc_c_1_addr =\r\n" - "> vb2_dma_contig_plane_dma_addr\r\n" - "> > +\t\t\t\t\t\t(&src_mb->b->vb2_buf, 2);\r\n" - "> > +\t\t\telse\r\n" - "> > +\t\t\t\tsrc_c_1_addr = 0;\r\n" - "> >\r\n" - "> > \t\t\tmfc_debug(2, \"enc src y addr: 0x%08lx\\n\",\r\n" - "> src_y_addr);\r\n" - "> > \t\t\tmfc_debug(2, \"enc src c addr: 0x%08lx\\n\",\r\n" - "> src_c_addr);\r\n" - "> >\r\n" - "> > -\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr,\r\n" - "> src_c_addr);\r\n" - "> > +\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr,\r\n" - "> > +\t\t\t\t\t\tsrc_c_addr, src_c_1_addr);\r\n" - "> > \t\t\tif (src_mb->flags & MFC_BUF_FLAG_EOS)\r\n" - "> > \t\t\t\tctx->state = MFCINST_FINISHING;\r\n" - "> > \t\t}\r\n" - "> > @@ -2450,6 +2566,8 @@ const struct s5p_mfc_regs\r\n" - "> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)\r\n" - "> > \t\t\tS5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7);\r\n" - "> > \tR(e_encoded_source_second_plane_addr,\r\n" - "> >\r\n" - "> \tS5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7);\r\n" - "> > +\tR(e_encoded_source_third_plane_addr,\r\n" - "> > +\t\t\tS5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7);\r\n" - "> > \tR(e_vp8_options, S5P_FIMV_E_VP8_OPTIONS_V7);\r\n" - "> >\r\n" - "> > \tif (!IS_MFCV8_PLUS(dev))\r\n" - "> > @@ -2464,16 +2582,20 @@ const struct s5p_mfc_regs\r\n" - "> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)\r\n" - "> > \tR(d_cpb_buffer_offset, S5P_FIMV_D_CPB_BUFFER_OFFSET_V8);\r\n" - "> > \tR(d_first_plane_dpb_size,\r\n" - "> S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8);\r\n" - "> > \tR(d_second_plane_dpb_size,\r\n" - "> S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8);\r\n" - "> > +\tR(d_third_plane_dpb_size,\r\n" - "> S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8);\r\n" - "> > \tR(d_scratch_buffer_addr,\r\n" - "> S5P_FIMV_D_SCRATCH_BUFFER_ADDR_V8);\r\n" - "> > \tR(d_scratch_buffer_size, S5P_FIMV_D_SCRATCH_BUFFER_SIZE_V8);\r\n" - "> > \tR(d_first_plane_dpb_stride_size,\r\n" - "> > \t\t\tS5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8);\r\n" - "> > \tR(d_second_plane_dpb_stride_size,\r\n" - "> >\r\n" - "> \tS5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8);\r\n" - "> > +\tR(d_third_plane_dpb_stride_size,\r\n" - "> > +\t\t\tS5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8);\r\n" - "> > \tR(d_mv_buffer_size, S5P_FIMV_D_MV_BUFFER_SIZE_V8);\r\n" - "> > \tR(d_num_mv, S5P_FIMV_D_NUM_MV_V8);\r\n" - "> > \tR(d_first_plane_dpb, S5P_FIMV_D_FIRST_PLANE_DPB_V8);\r\n" - "> > \tR(d_second_plane_dpb, S5P_FIMV_D_SECOND_PLANE_DPB_V8);\r\n" - "> > +\tR(d_third_plane_dpb, S5P_FIMV_D_THIRD_PLANE_DPB_V8);\r\n" - "> > \tR(d_mv_buffer, S5P_FIMV_D_MV_BUFFER_V8);\r\n" - "> > \tR(d_init_buffer_options, S5P_FIMV_D_INIT_BUFFER_OPTIONS_V8);\r\n" - "> > \tR(d_available_dpb_flag_lower,\r\n" - > > S5P_FIMV_D_AVAILABLE_DPB_FLAG_LOWER_V8); + "> Le mercredi 25 octobre 2023 \303\240 15:52 +0530, Aakarsh Jain a \303\251crit :\n" + "> > YV12 and I420 format (3-plane) support is added. Stride information is\n" + "> > added to all formats and planes since it is necessary for YV12/I420\n" + "> > which are different from width.\n" + "> >\n" + "> > Cc: linux-fsd@tesla.com\n" + "> > Signed-off-by: Smitha T Murthy <smithatmurthy@gmail.com>\n" + "> > Signed-off-by: Aakarsh Jain <aakarsh.jain@samsung.com>\n" + "> > ---\n" + "> > .../platform/samsung/s5p-mfc/regs-mfc-v12.h | 2 +\n" + "> > .../platform/samsung/s5p-mfc/regs-mfc-v7.h | 1 +\n" + "> > .../platform/samsung/s5p-mfc/regs-mfc-v8.h | 3 +\n" + "> > .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 4 +\n" + "> > .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 45 ++++-\n" + "> > .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 86 +++++++--\n" + "> > .../platform/samsung/s5p-mfc/s5p_mfc_opr.h | 6 +-\n" + "> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c | 12 +-\n" + "> > .../platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c | 168\n" + "> +++++++++++++++---\n" + "> > 9 files changed, 281 insertions(+), 46 deletions(-)\n" + "> >\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\n" + "> > index 6c68a45082d0..70464f47c1f9 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v12.h\n" + "> > @@ -26,6 +26,8 @@\n" + "> > #define MFC_VERSION_V12\t\t\t0xC0\n" + "> > #define MFC_NUM_PORTS_V12\t\t1\n" + "> > #define S5P_FIMV_CODEC_VP9_ENC\t\t27\n" + "> > +#define MFC_CHROMA_PAD_BYTES_V12 256\n" + "> > +#define S5P_FIMV_D_ALIGN_PLANE_SIZE_V12 256\n" + "> >\n" + "> > /* Encoder buffer size for MFCv12 */\n" + "> > #define ENC_V120_BASE_SIZE(x, y) \\\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\n" + "> > index 4a7adfdaa359..50f9bf0603c1 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v7.h\n" + "> > @@ -24,6 +24,7 @@\n" + "> >\n" + "> > #define S5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7\n" + "> \t0xfa70\n" + "> > #define S5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7\n" + "> \t0xfa74\n" + "> > +#define S5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7\n" + "> \t0xfa78\n" + "> >\n" + "> > #define S5P_FIMV_E_VP8_OPTIONS_V7\t\t\t0xfdb0\n" + "> > #define S5P_FIMV_E_VP8_FILTER_OPTIONS_V7\t\t0xfdb4\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\n" + "> > index 162e3c7e920f..0ef9eb2dff22 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/regs-mfc-v8.h\n" + "> > @@ -17,13 +17,16 @@\n" + "> > #define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8\t0xf108\n" + "> > #define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8\t0xf144\n" + "> > #define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8\t0xf148\n" + "> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8\t0xf14C\n" + "> > #define S5P_FIMV_D_MV_BUFFER_SIZE_V8\t\t0xf150\n" + "> >\n" + "> > #define S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8\t0xf138\n" + "> > #define S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8\n" + "> \t0xf13c\n" + "> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8\n" + "> \t0xf140\n" + "> >\n" + "> > #define S5P_FIMV_D_FIRST_PLANE_DPB_V8\t\t0xf160\n" + "> > #define S5P_FIMV_D_SECOND_PLANE_DPB_V8\t\t0xf260\n" + "> > +#define S5P_FIMV_D_THIRD_PLANE_DPB_V8\t\t0xf360\n" + "> > #define S5P_FIMV_D_MV_BUFFER_V8\t\t\t0xf460\n" + "> >\n" + "> > #define S5P_FIMV_D_NUM_MV_V8\t\t\t0xf134\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\n" + "> > index dd2e9f7704ab..9a39cccfe002 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h\n" + "> > @@ -56,6 +56,7 @@\n" + "> > #define MFC_NO_INSTANCE_SET\t-1\n" + "> > #define MFC_ENC_CAP_PLANE_COUNT\t1\n" + "> > #define MFC_ENC_OUT_PLANE_COUNT\t2\n" + "> > +#define VB2_MAX_PLANE_COUNT\t3\n" + "> > #define STUFF_BYTE\t\t4\n" + "> > #define MFC_MAX_CTRLS\t\t128\n" + "> >\n" + "> > @@ -181,6 +182,7 @@ struct s5p_mfc_buf {\n" + "> > \t\tstruct {\n" + "> > \t\t\tsize_t luma;\n" + "> > \t\t\tsize_t chroma;\n" + "> > +\t\t\tsize_t chroma_1;\n" + "> > \t\t} raw;\n" + "> > \t\tsize_t stream;\n" + "> > \t} cookie;\n" + "> > @@ -657,6 +659,7 @@ struct s5p_mfc_ctx {\n" + "> >\n" + "> > \tint luma_size;\n" + "> > \tint chroma_size;\n" + "> > +\tint chroma_size_1;\n" + "> > \tint mv_size;\n" + "> >\n" + "> > \tunsigned long consumed_stream;\n" + "> > @@ -722,6 +725,7 @@ struct s5p_mfc_ctx {\n" + "> > \tsize_t scratch_buf_size;\n" + "> > \tint is_10bit;\n" + "> > \tint is_422;\n" + "> > +\tint stride[VB2_MAX_PLANE_COUNT];\n" + "> > };\n" + "> >\n" + "> > /*\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\n" + "> > index e219cbcd86d5..317f796fffa1 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_dec.c\n" + "> > @@ -56,6 +56,20 @@ static struct s5p_mfc_fmt formats[] = {\n" + "> > \t\t.num_planes\t= 2,\n" + "> > \t\t.versions\t= MFC_V6PLUS_BITS,\n" + "> > \t},\n" + "> > +\t{\n" + "> > +\t\t.fourcc = V4L2_PIX_FMT_YUV420M,\n" + "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\n" + "> > +\t\t.type = MFC_FMT_RAW,\n" + "> > +\t\t.num_planes = 3,\n" + "> > +\t\t.versions = MFC_V12_BIT,\n" + "> > +\t},\n" + "> > +\t{\n" + "> > +\t\t.fourcc = V4L2_PIX_FMT_YVU420M,\n" + "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\n" + "> > +\t\t.type = MFC_FMT_RAW,\n" + "> > +\t\t.num_planes = 3,\n" + "> > +\t\t.versions = MFC_V12_BIT\n" + "> > +\t},\n" + "> > \t{\n" + "> > \t\t.fourcc\t\t= V4L2_PIX_FMT_H264,\n" + "> > \t\t.codec_mode\t= S5P_MFC_CODEC_H264_DEC,\n" + "> > @@ -359,10 +373,15 @@ static int vidioc_g_fmt(struct file *file, void *priv,\n" + "> struct v4l2_format *f)\n" + "> > \t\t/* Set pixelformat to the format in which MFC\n" + "> > \t\t outputs the decoded frame */\n" + "> > \t\tpix_mp->pixelformat = ctx->dst_fmt->fourcc;\n" + "> > -\t\tpix_mp->plane_fmt[0].bytesperline = ctx->buf_width;\n" + "> > +\t\tpix_mp->plane_fmt[0].bytesperline = ctx->stride[0];\n" + "> > \t\tpix_mp->plane_fmt[0].sizeimage = ctx->luma_size;\n" + "> > -\t\tpix_mp->plane_fmt[1].bytesperline = ctx->buf_width;\n" + "> > +\t\tpix_mp->plane_fmt[1].bytesperline = ctx->stride[1];\n" + "> > \t\tpix_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M) {\n" + "> > +\t\t\tpix_mp->plane_fmt[2].bytesperline = ctx->stride[2];\n" + "> > +\t\t\tpix_mp->plane_fmt[2].sizeimage = ctx-\n" + "> >chroma_size_1;\n" + "> > +\t\t}\n" + "> > \t} else if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {\n" + "> > \t\t/* This is run on OUTPUT\n" + "> > \t\t The buffer contains compressed image @@ -937,6 +956,9\n" + "> @@ static\n" + "> > int s5p_mfc_queue_setup(struct vb2_queue *vq,\n" + "> > \t\t vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {\n" + "> > \t\t/* Output plane count is 2 - one for Y and one for CbCr */\n" + "> > \t\t*plane_count = 2;\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\t*plane_count = 3;\n" + "> \n" + "> I don't usually interfere, this is your driver to maintain, but this becomes\n" + "> horribly messy. Have you consider de-hardcoding a little and encapsulate per\n" + "> HW format details into a C structure ? Drivers these days try to make sure of\n" + "> v4l2- common library, which as a matter of fact knows that YUV420M and\n" + "> YVU420M have 3 places, so that you don't have to duplicate it in your driver.\n" + "> \n" + "> regards,\n" + "> Nicolas\n" + "\n" + "Thanks for pointing out.\n" + "We could have done it in this way ' *plane_count = ctx->dst_fmt->num_planes' also.\n" + "Anyway, will make use of ' v4l2- common library ' for getting the planes count here in next series.\n" + "\n" + "Thanks for the review.\n" + "> \n" + "> > \t\t/* Setup buffer count */\n" + "> > \t\tif (*buf_count < ctx->pb_count)\n" + "> > \t\t\t*buf_count = ctx->pb_count;\n" + "> > @@ -955,12 +977,17 @@ static int s5p_mfc_queue_setup(struct\n" + "> vb2_queue *vq,\n" + "> > \t vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {\n" + "> > \t\tpsize[0] = ctx->luma_size;\n" + "> > \t\tpsize[1] = ctx->chroma_size;\n" + "> > -\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\tpsize[2] = ctx->chroma_size_1;\n" + "> > \t\tif (IS_MFCV6_PLUS(dev))\n" + "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX];\n" + "> > \t\telse\n" + "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX];\n" + "> > \t\talloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX];\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\talloc_devs[2] = ctx->dev->mem_dev[BANK_L_CTX];\n" + "> > \t} else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&\n" + "> > \t\t ctx->state == MFCINST_INIT) {\n" + "> > \t\tpsize[0] = ctx->dec_src_buf_size;\n" + "> > @@ -994,12 +1021,24 @@ static int s5p_mfc_buf_init(struct vb2_buffer\n" + "> *vb)\n" + "> > \t\t\tmfc_err(\"Plane buffer (CAPTURE) is too small\\n\");\n" + "> > \t\t\treturn -EINVAL;\n" + "> > \t\t}\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M) {\n" + "> > +\t\t\tif (vb2_plane_size(vb, 2) < ctx->chroma_size_1) {\n" + "> > +\t\t\t\tmfc_err(\"Plane buffer (CAPTURE) is too\n" + "> small\\n\");\n" + "> > +\t\t\t\treturn -EINVAL;\n" + "> > +\t\t\t}\n" + "> > +\t\t}\n" + "> > \t\ti = vb->index;\n" + "> > \t\tctx->dst_bufs[i].b = vbuf;\n" + "> > \t\tctx->dst_bufs[i].cookie.raw.luma =\n" + "> >\n" + "> \tvb2_dma_contig_plane_dma_addr(vb, 0);\n" + "> > \t\tctx->dst_bufs[i].cookie.raw.chroma =\n" + "> >\n" + "> \tvb2_dma_contig_plane_dma_addr(vb, 1);\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M) {\n" + "> > +\t\t\tctx->dst_bufs[i].cookie.raw.chroma_1 =\n" + "> > +\n" + "> \tvb2_dma_contig_plane_dma_addr(vb, 2);\n" + "> > +\t\t}\n" + "> > \t\tctx->dst_bufs_cnt++;\n" + "> > \t} else if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {\n" + "> > \t\tif (IS_ERR_OR_NULL(ERR_PTR(\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\n" + "> > index e4d6e7c117b5..0eec04eb3ef3 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c\n" + "> > @@ -59,6 +59,20 @@ static struct s5p_mfc_fmt formats[] = {\n" + "> > \t\t.num_planes\t= 2,\n" + "> > \t\t.versions\t= MFC_V6PLUS_BITS,\n" + "> > \t},\n" + "> > +\t{\n" + "> > +\t\t.fourcc = V4L2_PIX_FMT_YUV420M,\n" + "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\n" + "> > +\t\t.type = MFC_FMT_RAW,\n" + "> > +\t\t.num_planes = 3,\n" + "> > +\t\t.versions = MFC_V12_BIT,\n" + "> > +\t},\n" + "> > +\t{\n" + "> > +\t\t.fourcc = V4L2_PIX_FMT_YVU420M,\n" + "> > +\t\t.codec_mode = S5P_MFC_CODEC_NONE,\n" + "> > +\t\t.type = MFC_FMT_RAW,\n" + "> > +\t\t.num_planes = 3,\n" + "> > +\t\t.versions = MFC_V12_BIT,\n" + "> > +\t},\n" + "> > \t{\n" + "> > \t\t.fourcc\t\t= V4L2_PIX_FMT_H264,\n" + "> > \t\t.codec_mode\t= S5P_MFC_CODEC_H264_ENC,\n" + "> > @@ -1193,14 +1207,20 @@ static int enc_pre_frame_start(struct\n" + "> s5p_mfc_ctx *ctx)\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> > \tstruct s5p_mfc_buf *dst_mb;\n" + "> > \tstruct s5p_mfc_buf *src_mb;\n" + "> > -\tunsigned long src_y_addr, src_c_addr, dst_addr;\n" + "> > +\tunsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr;\n" + "> > \tunsigned int dst_size;\n" + "> >\n" + "> > \tsrc_mb = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);\n" + "> > \tsrc_y_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b-\n" + "> >vb2_buf, 0);\n" + "> > \tsrc_c_addr = vb2_dma_contig_plane_dma_addr(&src_mb->b-\n" + "> >vb2_buf, 1);\n" + "> > +\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\tctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\tsrc_c_1_addr =\n" + "> > +\t\t\tvb2_dma_contig_plane_dma_addr(&src_mb->b-\n" + "> >vb2_buf, 2);\n" + "> > +\telse\n" + "> > +\t\tsrc_c_1_addr = 0;\n" + "> > \ts5p_mfc_hw_call(dev->mfc_ops, set_enc_frame_buffer, ctx,\n" + "> > -\t\t\t\t\t\t\tsrc_y_addr,\n" + "> src_c_addr);\n" + "> > +\t\t\t\t\tsrc_y_addr, src_c_addr,\n" + "> src_c_1_addr);\n" + "> >\n" + "> > \tdst_mb = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf, list);\n" + "> > \tdst_addr = vb2_dma_contig_plane_dma_addr(&dst_mb->b-\n" + "> >vb2_buf, 0); @@\n" + "> > -1215,8 +1235,8 @@ static int enc_post_frame_start(struct s5p_mfc_ctx\n" + "> > *ctx) {\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> > \tstruct s5p_mfc_buf *mb_entry;\n" + "> > -\tunsigned long enc_y_addr = 0, enc_c_addr = 0;\n" + "> > -\tunsigned long mb_y_addr, mb_c_addr;\n" + "> > +\tunsigned long enc_y_addr = 0, enc_c_addr = 0, enc_c_1_addr = 0;\n" + "> > +\tunsigned long mb_y_addr, mb_c_addr, mb_c_1_addr;\n" + "> > \tint slice_type;\n" + "> > \tunsigned int strm_size;\n" + "> > \tbool src_ready;\n" + "> > @@ -1229,14 +1249,21 @@ static int enc_post_frame_start(struct\n" + "> s5p_mfc_ctx *ctx)\n" + "> > \t\t mfc_read(dev, S5P_FIMV_ENC_SI_PIC_CNT));\n" + "> > \tif (slice_type >= 0) {\n" + "> > \t\ts5p_mfc_hw_call(dev->mfc_ops, get_enc_frame_buffer,\n" + "> ctx,\n" + "> > -\t\t\t\t&enc_y_addr, &enc_c_addr);\n" + "> > +\t\t\t\t&enc_y_addr, &enc_c_addr,\n" + "> &enc_c_1_addr);\n" + "> > \t\tlist_for_each_entry(mb_entry, &ctx->src_queue, list) {\n" + "> > \t\t\tmb_y_addr = vb2_dma_contig_plane_dma_addr(\n" + "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 0);\n" + "> > \t\t\tmb_c_addr = vb2_dma_contig_plane_dma_addr(\n" + "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 1);\n" + "> > -\t\t\tif ((enc_y_addr == mb_y_addr) &&\n" + "> > -\t\t\t\t\t\t(enc_c_addr == mb_c_addr))\n" + "> {\n" + "> > +\t\t\tif (ctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\t\tmb_c_1_addr =\n" + "> vb2_dma_contig_plane_dma_addr\n" + "> > +\t\t\t\t\t\t(&mb_entry->b->vb2_buf,\n" + "> 2);\n" + "> > +\t\t\telse\n" + "> > +\t\t\t\tmb_c_1_addr = 0;\n" + "> > +\t\t\tif ((enc_y_addr == mb_y_addr)\n" + "> > +\t\t\t\t\t&& (enc_c_addr == mb_c_addr)\n" + "> > +\t\t\t\t\t&& (enc_c_1_addr ==\n" + "> mb_c_1_addr)) {\n" + "> > \t\t\t\tlist_del(&mb_entry->list);\n" + "> > \t\t\t\tctx->src_queue_cnt--;\n" + "> > \t\t\t\tvb2_buffer_done(&mb_entry->b->vb2_buf,\n" + "> > @@ -1249,8 +1276,15 @@ static int enc_post_frame_start(struct\n" + "> s5p_mfc_ctx *ctx)\n" + "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 0);\n" + "> > \t\t\tmb_c_addr = vb2_dma_contig_plane_dma_addr(\n" + "> > \t\t\t\t\t&mb_entry->b->vb2_buf, 1);\n" + "> > -\t\t\tif ((enc_y_addr == mb_y_addr) &&\n" + "> > -\t\t\t\t\t\t(enc_c_addr == mb_c_addr))\n" + "> {\n" + "> > +\t\t\tif (ctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\t\tmb_c_1_addr =\n" + "> vb2_dma_contig_plane_dma_addr(\n" + "> > +\t\t\t\t\t\t&mb_entry->b->vb2_buf, 2);\n" + "> > +\t\t\telse\n" + "> > +\t\t\t\tmb_c_1_addr = 0;\n" + "> > +\t\t\tif ((enc_y_addr == mb_y_addr)\n" + "> > +\t\t\t\t\t&& (enc_c_addr == mb_c_addr)\n" + "> > +\t\t\t\t\t&& (enc_c_1_addr ==\n" + "> mb_c_1_addr)) {\n" + "> > \t\t\t\tlist_del(&mb_entry->list);\n" + "> > \t\t\t\tctx->ref_queue_cnt--;\n" + "> > \t\t\t\tvb2_buffer_done(&mb_entry->b->vb2_buf,\n" + "> > @@ -1381,10 +1415,15 @@ static int vidioc_g_fmt(struct file *file, void\n" + "> *priv, struct v4l2_format *f)\n" + "> > \t\tpix_fmt_mp->pixelformat = ctx->src_fmt->fourcc;\n" + "> > \t\tpix_fmt_mp->num_planes = ctx->src_fmt->num_planes;\n" + "> >\n" + "> > -\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width;\n" + "> > +\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0];\n" + "> > \t\tpix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size;\n" + "> > -\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width;\n" + "> > +\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1];\n" + "> > \t\tpix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\n" + "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M) {\n" + "> > +\t\t\tpix_fmt_mp->plane_fmt[2].bytesperline = ctx-\n" + "> >stride[2];\n" + "> > +\t\t\tpix_fmt_mp->plane_fmt[2].sizeimage = ctx-\n" + "> >chroma_size_1;\n" + "> > +\t\t}\n" + "> > \t} else {\n" + "> > \t\tmfc_err(\"invalid buf type\\n\");\n" + "> > \t\treturn -EINVAL;\n" + "> > @@ -1468,9 +1507,14 @@ static int vidioc_s_fmt(struct file *file, void\n" + "> > *priv, struct v4l2_format *f)\n" + "> >\n" + "> > \t\ts5p_mfc_hw_call(dev->mfc_ops, enc_calc_src_size, ctx);\n" + "> > \t\tpix_fmt_mp->plane_fmt[0].sizeimage = ctx->luma_size;\n" + "> > -\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->buf_width;\n" + "> > +\t\tpix_fmt_mp->plane_fmt[0].bytesperline = ctx->stride[0];\n" + "> > \t\tpix_fmt_mp->plane_fmt[1].sizeimage = ctx->chroma_size;\n" + "> > -\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->buf_width;\n" + "> > +\t\tpix_fmt_mp->plane_fmt[1].bytesperline = ctx->stride[1];\n" + "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M) {\n" + "> > +\t\t\tpix_fmt_mp->plane_fmt[2].bytesperline = ctx-\n" + "> >stride[2];\n" + "> > +\t\t\tpix_fmt_mp->plane_fmt[2].sizeimage = ctx-\n" + "> >chroma_size_1;\n" + "> > +\t\t}\n" + "> >\n" + "> > \t\tctx->src_bufs_cnt = 0;\n" + "> > \t\tctx->output_state = QUEUE_FREE;\n" + "> > @@ -2414,10 +2458,16 @@ static int s5p_mfc_queue_setup(struct\n" + "> > vb2_queue *vq,\n" + "> >\n" + "> > \t\tpsize[0] = ctx->luma_size;\n" + "> > \t\tpsize[1] = ctx->chroma_size;\n" + "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\tpsize[2] = ctx->chroma_size_1;\n" + "> >\n" + "> > \t\tif (IS_MFCV6_PLUS(dev)) {\n" + "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_L_CTX];\n" + "> > \t\t\talloc_devs[1] = ctx->dev->mem_dev[BANK_L_CTX];\n" + "> > +\t\t\tif (ctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\t\talloc_devs[2] = ctx->dev-\n" + "> >mem_dev[BANK_L_CTX];\n" + "> > \t\t} else {\n" + "> > \t\t\talloc_devs[0] = ctx->dev->mem_dev[BANK_R_CTX];\n" + "> > \t\t\talloc_devs[1] = ctx->dev->mem_dev[BANK_R_CTX];\n" + "> @@ -2456,6 +2506,10\n" + "> > @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)\n" + "> >\n" + "> \tvb2_dma_contig_plane_dma_addr(vb, 0);\n" + "> > \t\tctx->src_bufs[i].cookie.raw.chroma =\n" + "> >\n" + "> \tvb2_dma_contig_plane_dma_addr(vb, 1);\n" + "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\tctx->src_bufs[i].cookie.raw.chroma_1 =\n" + "> > +\n" + "> \tvb2_dma_contig_plane_dma_addr(vb, 2);\n" + "> > \t\tctx->src_bufs_cnt++;\n" + "> > \t} else {\n" + "> > \t\tmfc_err(\"invalid queue type: %d\\n\", vq->type); @@ -2493,6\n" + "> +2547,12\n" + "> > @@ static int s5p_mfc_buf_prepare(struct vb2_buffer *vb)\n" + "> > \t\t\tmfc_err(\"plane size is too small for output\\n\");\n" + "> > \t\t\treturn -EINVAL;\n" + "> > \t\t}\n" + "> > +\t\tif ((ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) &&\n" + "> > +\t\t (vb2_plane_size(vb, 2) < ctx->chroma_size_1)) {\n" + "> > +\t\t\tmfc_err(\"plane size is too small for output\\n\");\n" + "> > +\t\t\treturn -EINVAL;\n" + "> > +\t\t}\n" + "> > \t} else {\n" + "> > \t\tmfc_err(\"invalid queue type: %d\\n\", vq->type);\n" + "> > \t\treturn -EINVAL;\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\n" + "> > index 87ac56756a16..7c5e851c8191 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr.h\n" + "> > @@ -293,9 +293,11 @@ struct s5p_mfc_hw_ops {\n" + "> > \tint (*set_enc_stream_buffer)(struct s5p_mfc_ctx *ctx,\n" + "> > \t\t\tunsigned long addr, unsigned int size);\n" + "> > \tvoid (*set_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,\n" + "> > -\t\t\tunsigned long y_addr, unsigned long c_addr);\n" + "> > +\t\t\tunsigned long y_addr, unsigned long c_addr,\n" + "> > +\t\t\tunsigned long c_1_addr);\n" + "> > \tvoid (*get_enc_frame_buffer)(struct s5p_mfc_ctx *ctx,\n" + "> > -\t\t\tunsigned long *y_addr, unsigned long *c_addr);\n" + "> > +\t\t\tunsigned long *y_addr, unsigned long *c_addr,\n" + "> > +\t\t\tunsigned long *c_1_addr);\n" + "> > \tvoid (*try_run)(struct s5p_mfc_dev *dev);\n" + "> > \tvoid (*clear_int_flags)(struct s5p_mfc_dev *dev);\n" + "> > \tint (*get_dspl_y_adr)(struct s5p_mfc_dev *dev); diff --git\n" + "> > a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\n" + "> > index 28a06dc343fd..fcfaf125a5a1 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v5.c\n" + "> > @@ -516,7 +516,8 @@ static int\n" + "> s5p_mfc_set_enc_stream_buffer_v5(struct\n" + "> > s5p_mfc_ctx *ctx, }\n" + "> >\n" + "> > static void s5p_mfc_set_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,\n" + "> > -\t\tunsigned long y_addr, unsigned long c_addr)\n" + "> > +\t\tunsigned long y_addr, unsigned long c_addr,\n" + "> > +\t\tunsigned long c_1_addr)\n" + "> > {\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> >\n" + "> > @@ -525,7 +526,8 @@ static void\n" + "> s5p_mfc_set_enc_frame_buffer_v5(struct\n" + "> > s5p_mfc_ctx *ctx, }\n" + "> >\n" + "> > static void s5p_mfc_get_enc_frame_buffer_v5(struct s5p_mfc_ctx *ctx,\n" + "> > -\t\tunsigned long *y_addr, unsigned long *c_addr)\n" + "> > +\t\tunsigned long *y_addr, unsigned long *c_addr,\n" + "> > +\t\tunsigned long *c_1_addr)\n" + "> > {\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> >\n" + "> > @@ -1210,7 +1212,7 @@ static int s5p_mfc_run_enc_frame(struct\n" + "> s5p_mfc_ctx *ctx)\n" + "> > \tif (list_empty(&ctx->src_queue)) {\n" + "> > \t\t/* send null frame */\n" + "> > \t\ts5p_mfc_set_enc_frame_buffer_v5(ctx, dev-\n" + "> >dma_base[BANK_R_CTX],\n" + "> > -\t\t\t\t\t\tdev-\n" + "> >dma_base[BANK_R_CTX]);\n" + "> > +\t\t\t\t\t\tdev-\n" + "> >dma_base[BANK_R_CTX], 0);\n" + "> > \t\tsrc_mb = NULL;\n" + "> > \t} else {\n" + "> > \t\tsrc_mb = list_entry(ctx->src_queue.next, struct\n" + "> s5p_mfc_buf, @@\n" + "> > -1220,7 +1222,7 @@ static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx\n" + "> *ctx)\n" + "> > \t\t\t/* send null frame */\n" + "> > \t\t\ts5p_mfc_set_enc_frame_buffer_v5(ctx,\n" + "> > \t\t\t\t\t\tdev-\n" + "> >dma_base[BANK_R_CTX],\n" + "> > -\t\t\t\t\t\tdev-\n" + "> >dma_base[BANK_R_CTX]);\n" + "> > +\t\t\t\t\t\tdev-\n" + "> >dma_base[BANK_R_CTX], 0);\n" + "> > \t\t\tctx->state = MFCINST_FINISHING;\n" + "> > \t\t} else {\n" + "> > \t\t\tsrc_y_addr = vb2_dma_contig_plane_dma_addr(\n" + "> @@ -1228,7 +1230,7 @@\n" + "> > static int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)\n" + "> > \t\t\tsrc_c_addr = vb2_dma_contig_plane_dma_addr(\n" + "> > \t\t\t\t\t&src_mb->b->vb2_buf, 1);\n" + "> > \t\t\ts5p_mfc_set_enc_frame_buffer_v5(ctx, src_y_addr,\n" + "> > -\t\t\t\t\t\t\t\tsrc_c_addr);\n" + "> > +\t\t\t\t\t\t\t\tsrc_c_addr,\n" + "> 0);\n" + "> > \t\t\tif (src_mb->flags & MFC_BUF_FLAG_EOS)\n" + "> > \t\t\t\tctx->state = MFCINST_FINISHING;\n" + "> > \t\t}\n" + "> > diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\n" + "> > b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\n" + "> > index fb3f0718821d..e579c765e902 100644\n" + "> > --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\n" + "> > +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c\n" + "> > @@ -494,16 +494,43 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct\n" + "> s5p_mfc_ctx *ctx)\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> > \tctx->buf_width = ALIGN(ctx->img_width,\n" + "> S5P_FIMV_NV12MT_HALIGN_V6);\n" + "> > \tctx->buf_height = ALIGN(ctx->img_height,\n" + "> S5P_FIMV_NV12MT_VALIGN_V6);\n" + "> > +\tctx->chroma_size_1 = 0;\n" + "> > \tmfc_debug(2, \"SEQ Done: Movie dimensions %dx%d,\\n\"\n" + "> > \t\t\t\"buffer dimensions: %dx%d\\n\", ctx->img_width,\n" + "> > \t\t\tctx->img_height, ctx->buf_width, ctx->buf_height);\n" + "> >\n" + "> > -\tctx->luma_size = calc_plane(ctx->img_width, ctx->img_height);\n" + "> > -\tctx->chroma_size = calc_plane(ctx->img_width, (ctx->img_height >>\n" + "> 1));\n" + "> > +\tswitch (ctx->dst_fmt->fourcc) {\n" + "> > +\tcase V4L2_PIX_FMT_NV12M:\n" + "> > +\tcase V4L2_PIX_FMT_NV21M:\n" + "> > +\t\tctx->stride[0] = ALIGN(ctx->img_width,\n" + "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\n" + "> > +\t\tctx->stride[1] = ALIGN(ctx->img_width,\n" + "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\n" + "> > +\t\tctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height);\n" + "> > +\t\tctx->chroma_size = calc_plane(ctx->stride[1],\n" + "> > +\t\t\t\t\t(ctx->img_height / 2));\n" + "> > +\t\tbreak;\n" + "> > +\tcase V4L2_PIX_FMT_YUV420M:\n" + "> > +\tcase V4L2_PIX_FMT_YVU420M:\n" + "> > +\t\tctx->stride[0] = ALIGN(ctx->img_width,\n" + "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\n" + "> > +\t\tctx->stride[1] = ALIGN(ctx->img_width / 2,\n" + "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\n" + "> > +\t\tctx->stride[2] = ALIGN(ctx->img_width / 2,\n" + "> > +\t\t\t\t\tS5P_FIMV_NV12MT_HALIGN_V6);\n" + "> > +\t\tctx->luma_size = calc_plane(ctx->stride[0], ctx->img_height);\n" + "> > +\t\tctx->chroma_size = calc_plane(ctx->stride[1],\n" + "> > +\t\t\t\t\t(ctx->img_height / 2));\n" + "> > +\t\tctx->chroma_size_1 = calc_plane(ctx->stride[2],\n" + "> > +\t\t\t\t\t(ctx->img_height / 2));\n" + "> > +\t\tbreak;\n" + "> > +\t}\n" + "> > +\n" + "> > \tif (IS_MFCV8_PLUS(ctx->dev)) {\n" + "> > \t\t/* MFCv8 needs additional 64 bytes for luma,chroma dpb*/\n" + "> > \t\tctx->luma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\n" + "> > \t\tctx->chroma_size += S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\n" + "> > +\t\tctx->chroma_size_1 +=\n" + "> S5P_FIMV_D_ALIGN_PLANE_SIZE_V8;\n" + "> > \t}\n" + "> >\n" + "> > \tif (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC || @@ -534,15\n" + "> +561,53\n" + "> > @@ static void s5p_mfc_enc_calc_src_size_v6(struct s5p_mfc_ctx *ctx)\n" + "> > \tmb_width = MB_WIDTH(ctx->img_width);\n" + "> > \tmb_height = MB_HEIGHT(ctx->img_height);\n" + "> >\n" + "> > -\tctx->buf_width = ALIGN(ctx->img_width,\n" + "> S5P_FIMV_NV12M_HALIGN_V6);\n" + "> > -\tctx->luma_size = ALIGN((mb_width * mb_height) * 256, 256);\n" + "> > -\tctx->chroma_size = ALIGN((mb_width * mb_height) * 128, 256);\n" + "> > -\n" + "> > -\t/* MFCv7 needs pad bytes for Luma and Chroma */\n" + "> > -\tif (IS_MFCV7_PLUS(ctx->dev)) {\n" + "> > +\tif (IS_MFCV12(ctx->dev)) {\n" + "> > +\t\tswitch (ctx->src_fmt->fourcc) {\n" + "> > +\t\tcase V4L2_PIX_FMT_NV12M:\n" + "> > +\t\tcase V4L2_PIX_FMT_NV21M:\n" + "> > +\t\t\tctx->stride[0] = ALIGN(ctx->img_width,\n" + "> > +\n" + "> \tS5P_FIMV_NV12M_HALIGN_V6);\n" + "> > +\t\t\tctx->stride[1] = ALIGN(ctx->img_width,\n" + "> > +\n" + "> \tS5P_FIMV_NV12M_HALIGN_V6);\n" + "> > +\t\t\tctx->luma_size = ctx->stride[0] *\n" + "> > +\t\t\t\t\t\tALIGN(ctx->img_height, 16);\n" + "> > +\t\t\tctx->chroma_size = ctx->stride[0] *\n" + "> > +\t\t\t\t\t\tALIGN(ctx->img_height / 2,\n" + "> 16);\n" + "> > +\t\t\tbreak;\n" + "> > +\t\tcase V4L2_PIX_FMT_YUV420M:\n" + "> > +\t\tcase V4L2_PIX_FMT_YVU420M:\n" + "> > +\t\t\tctx->stride[0] = ALIGN(ctx->img_width,\n" + "> > +\n" + "> \tS5P_FIMV_NV12M_HALIGN_V6);\n" + "> > +\t\t\tctx->stride[1] = ALIGN(ctx->img_width / 2,\n" + "> > +\n" + "> \tS5P_FIMV_NV12M_HALIGN_V6);\n" + "> > +\t\t\tctx->stride[2] = ALIGN(ctx->img_width / 2,\n" + "> > +\n" + "> \tS5P_FIMV_NV12M_HALIGN_V6);\n" + "> > +\t\t\tctx->luma_size = ctx->stride[0] *\n" + "> > +\t\t\t\t\t\tALIGN(ctx->img_height, 16);\n" + "> > +\t\t\tctx->chroma_size = ctx->stride[1] *\n" + "> > +\t\t\t\t\t\tALIGN(ctx->img_height / 2,\n" + "> 16);\n" + "> > +\t\t\tctx->chroma_size_1 = ctx->stride[2] *\n" + "> > +\t\t\t\t\t\tALIGN(ctx->img_height / 2,\n" + "> 16);\n" + "> > +\t\t\tbreak;\n" + "> > +\t\t}\n" + "> > \t\tctx->luma_size += MFC_LUMA_PAD_BYTES_V7;\n" + "> > -\t\tctx->chroma_size += MFC_CHROMA_PAD_BYTES_V7;\n" + "> > +\t\tctx->chroma_size += MFC_CHROMA_PAD_BYTES_V12;\n" + "> > +\t\tctx->chroma_size_1 += MFC_CHROMA_PAD_BYTES_V12;\n" + "> > +\t} else {\n" + "> > +\t\tctx->buf_width = ALIGN(ctx->img_width,\n" + "> > +\t\t\t\t\tS5P_FIMV_NV12M_HALIGN_V6);\n" + "> > +\t\tctx->stride[0] = ctx->buf_width;\n" + "> > +\t\tctx->stride[1] = ctx->buf_width;\n" + "> > +\t\tctx->luma_size = ALIGN((mb_width * mb_height) * 256,\n" + "> 256);\n" + "> > +\t\tctx->chroma_size = ALIGN((mb_width * mb_height) * 128,\n" + "> 256);\n" + "> > +\t\tctx->chroma_size_1 = 0;\n" + "> > +\t\t/* MFCv7 needs pad bytes for Luma and Chroma */\n" + "> > +\t\tif (IS_MFCV7_PLUS(ctx->dev)) {\n" + "> > +\t\t\tctx->luma_size += MFC_LUMA_PAD_BYTES_V7;\n" + "> > +\t\t\tctx->chroma_size += MFC_LUMA_PAD_BYTES_V7;\n" + "> > +\t\t}\n" + "> > \t}\n" + "> > +\n" + "> > }\n" + "> >\n" + "> > /* Set registers for decoding stream buffer */ @@ -588,15 +653,21 @@\n" + "> > static int s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)\n" + "> > \twritel(ctx->total_dpb_count, mfc_regs->d_num_dpb);\n" + "> > \twritel(ctx->luma_size, mfc_regs->d_first_plane_dpb_size);\n" + "> > \twritel(ctx->chroma_size, mfc_regs->d_second_plane_dpb_size);\n" + "> > -\n" + "> > +\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\tctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\twritel(ctx->chroma_size_1, mfc_regs-\n" + "> >d_third_plane_dpb_size);\n" + "> > \twritel(buf_addr1, mfc_regs->d_scratch_buffer_addr);\n" + "> > \twritel(ctx->scratch_buf_size, mfc_regs->d_scratch_buffer_size);\n" + "> >\n" + "> > \tif (IS_MFCV8_PLUS(dev)) {\n" + "> > -\t\twritel(ctx->img_width,\n" + "> > +\t\twritel(ctx->stride[0],\n" + "> > \t\t\tmfc_regs->d_first_plane_dpb_stride_size);\n" + "> > -\t\twritel(ctx->img_width,\n" + "> > +\t\twritel(ctx->stride[1],\n" + "> > \t\t\tmfc_regs->d_second_plane_dpb_stride_size);\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\twritel(ctx->stride[2],\n" + "> > +\t\t\t\tmfc_regs->d_third_plane_dpb_stride_size);\n" + "> > \t}\n" + "> >\n" + "> > \tbuf_addr1 += ctx->scratch_buf_size;\n" + "> > @@ -625,6 +696,13 @@ static int\n" + "> s5p_mfc_set_dec_frame_buffer_v6(struct s5p_mfc_ctx *ctx)\n" + "> > \t\t\t\t\tctx->dst_bufs[i].cookie.raw.chroma);\n" + "> > \t\twritel(ctx->dst_bufs[i].cookie.raw.chroma,\n" + "> > \t\t\t\tmfc_regs->d_second_plane_dpb + i * 4);\n" + "> > +\t\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->dst_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M) {\n" + "> > +\t\t\tmfc_debug(2, \"\\tChroma_1 %d: %zx\\n\", i,\n" + "> > +\t\t\t\t\tctx-\n" + "> >dst_bufs[i].cookie.raw.chroma_1);\n" + "> > +\t\t\twritel(ctx->dst_bufs[i].cookie.raw.chroma_1,\n" + "> > +\t\t\t\t\tmfc_regs->d_third_plane_dpb + i *\n" + "> 4);\n" + "> > +\t\t}\n" + "> > \t}\n" + "> > \tif (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC ||\n" + "> > \t\t\tctx->codec_mode ==\n" + "> S5P_MFC_CODEC_H264_MVC_DEC || @@ -683,20\n" + "> > +761,24 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct\n" + "> > s5p_mfc_ctx *ctx, }\n" + "> >\n" + "> > static void s5p_mfc_set_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,\n" + "> > -\t\tunsigned long y_addr, unsigned long c_addr)\n" + "> > +\t\tunsigned long y_addr, unsigned long c_addr,\n" + "> > +\t\tunsigned long c_1_addr)\n" + "> > {\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> > \tconst struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;\n" + "> >\n" + "> > \twritel(y_addr, mfc_regs->e_source_first_plane_addr);\n" + "> > \twritel(c_addr, mfc_regs->e_source_second_plane_addr);\n" + "> > +\twritel(c_1_addr, mfc_regs->e_source_third_plane_addr);\n" + "> >\n" + "> > \tmfc_debug(2, \"enc src y buf addr: 0x%08lx\\n\", y_addr);\n" + "> > \tmfc_debug(2, \"enc src c buf addr: 0x%08lx\\n\", c_addr);\n" + "> > +\tmfc_debug(2, \"enc src cr buf addr: 0x%08lx\\n\", c_1_addr);\n" + "> > }\n" + "> >\n" + "> > static void s5p_mfc_get_enc_frame_buffer_v6(struct s5p_mfc_ctx *ctx,\n" + "> > -\t\tunsigned long *y_addr, unsigned long *c_addr)\n" + "> > +\t\tunsigned long *y_addr, unsigned long *c_addr,\n" + "> > +\t\tunsigned long *c_1_addr)\n" + "> > {\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> > \tconst struct s5p_mfc_regs *mfc_regs = dev->mfc_regs; @@ -704,12\n" + "> > +786,17 @@ static void s5p_mfc_get_enc_frame_buffer_v6(struct\n" + "> > s5p_mfc_ctx *ctx,\n" + "> >\n" + "> > \t*y_addr = readl(mfc_regs->e_encoded_source_first_plane_addr);\n" + "> > \t*c_addr = readl(mfc_regs-\n" + "> >e_encoded_source_second_plane_addr);\n" + "> > +\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\tctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t*c_1_addr = readl(mfc_regs-\n" + "> >e_encoded_source_third_plane_addr);\n" + "> > +\telse\n" + "> > +\t\t*c_1_addr = 0;\n" + "> >\n" + "> > \tenc_recon_y_addr = readl(mfc_regs->e_recon_luma_dpb_addr);\n" + "> > \tenc_recon_c_addr = readl(mfc_regs->e_recon_chroma_dpb_addr);\n" + "> >\n" + "> > \tmfc_debug(2, \"recon y addr: 0x%08lx y_addr: 0x%08lx\\n\",\n" + "> enc_recon_y_addr, *y_addr);\n" + "> > -\tmfc_debug(2, \"recon c addr: 0x%08lx\\n\", enc_recon_c_addr);\n" + "> > +\tmfc_debug(2, \"recon c addr: 0x%08lx c_addr: 0x%08lx\\n\",\n" + "> > +enc_recon_c_addr, *c_addr);\n" + "> > }\n" + "> >\n" + "> > /* Set encoding ref & codec buffer */ @@ -886,6 +973,20 @@ static int\n" + "> > s5p_mfc_set_enc_params(struct s5p_mfc_ctx *ctx)\n" + "> > \t\twritel(reg, mfc_regs->e_enc_options);\n" + "> > \t\t/* 0: NV12(CbCr), 1: NV21(CrCb) */\n" + "> > \t\twritel(0x0, mfc_regs->pixel_format);\n" + "> > +\t} else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YVU420M) {\n" + "> > +\t\t/* 0: Linear, 1: 2D tiled*/\n" + "> > +\t\treg = readl(mfc_regs->e_enc_options);\n" + "> > +\t\treg &= ~(0x1 << 7);\n" + "> > +\t\twritel(reg, mfc_regs->e_enc_options);\n" + "> > +\t\t/* 2: YV12(CrCb), 3: I420(CrCb) */\n" + "> > +\t\twritel(0x2, mfc_regs->pixel_format);\n" + "> > +\t} else if (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M) {\n" + "> > +\t\t/* 0: Linear, 1: 2D tiled*/\n" + "> > +\t\treg = readl(mfc_regs->e_enc_options);\n" + "> > +\t\treg &= ~(0x1 << 7);\n" + "> > +\t\twritel(reg, mfc_regs->e_enc_options);\n" + "> > +\t\t/* 2: YV12(CrCb), 3: I420(CrCb) */\n" + "> > +\t\twritel(0x3, mfc_regs->pixel_format);\n" + "> > \t}\n" + "> >\n" + "> > \t/* memory structure recon. frame */\n" + "> > @@ -1696,8 +1797,12 @@ static int s5p_mfc_init_decode_v6(struct\n" + "> s5p_mfc_ctx *ctx)\n" + "> > \telse\n" + "> > \t\twritel(reg, mfc_regs->d_dec_options);\n" + "> >\n" + "> > -\t/* 0: NV12(CbCr), 1: NV21(CrCb) */\n" + "> > -\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M)\n" + "> > +\t/* 0: NV12(CbCr), 1: NV21(CrCb), 2: YV12(CrCb), 3: I420(CbCr) */\n" + "> > +\tif (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YUV420M)\n" + "> > +\t\twritel(0x3, mfc_regs->pixel_format);\n" + "> > +\telse if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\twritel(0x2, mfc_regs->pixel_format);\n" + "> > +\telse if (ctx->dst_fmt->fourcc == V4L2_PIX_FMT_NV21M)\n" + "> > \t\twritel(0x1, mfc_regs->pixel_format);\n" + "> > \telse\n" + "> > \t\twritel(0x0, mfc_regs->pixel_format); @@ -1781,8 +1886,12\n" + "> @@ static\n" + "> > int s5p_mfc_init_encode_v6(struct s5p_mfc_ctx *ctx)\n" + "> >\n" + "> > \t/* Set stride lengths for v7 & above */\n" + "> > \tif (IS_MFCV7_PLUS(dev)) {\n" + "> > -\t\twritel(ctx->img_width, mfc_regs-\n" + "> >e_source_first_plane_stride);\n" + "> > -\t\twritel(ctx->img_width, mfc_regs-\n" + "> >e_source_second_plane_stride);\n" + "> > +\t\twritel(ctx->stride[0], mfc_regs-\n" + "> >e_source_first_plane_stride);\n" + "> > +\t\twritel(ctx->stride[1], mfc_regs-\n" + "> >e_source_second_plane_stride);\n" + "> > +\t\tif (ctx->src_fmt->fourcc == V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\twritel(ctx->stride[2],\n" + "> > +\t\t\t\t\tmfc_regs-\n" + "> >e_source_third_plane_stride);\n" + "> > \t}\n" + "> >\n" + "> > \twritel(ctx->inst_no, mfc_regs->instance_id); @@ -1891,7 +2000,7\n" + "> @@\n" + "> > static inline int s5p_mfc_run_enc_frame(struct s5p_mfc_ctx *ctx)\n" + "> > \tstruct s5p_mfc_dev *dev = ctx->dev;\n" + "> > \tstruct s5p_mfc_buf *dst_mb;\n" + "> > \tstruct s5p_mfc_buf *src_mb;\n" + "> > -\tunsigned long src_y_addr, src_c_addr, dst_addr;\n" + "> > +\tunsigned long src_y_addr, src_c_addr, src_c_1_addr, dst_addr;\n" + "> > \t/*\n" + "> > \tunsigned int src_y_size, src_c_size;\n" + "> > \t*/\n" + "> > @@ -1909,22 +2018,29 @@ static inline int s5p_mfc_run_enc_frame(struct\n" + "> > s5p_mfc_ctx *ctx)\n" + "> >\n" + "> > \tif (list_empty(&ctx->src_queue)) {\n" + "> > \t\t/* send null frame */\n" + "> > -\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0);\n" + "> > +\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0);\n" + "> > \t\tsrc_mb = NULL;\n" + "> > \t} else {\n" + "> > \t\tsrc_mb = list_entry(ctx->src_queue.next, struct\n" + "> s5p_mfc_buf, list);\n" + "> > \t\tsrc_mb->flags |= MFC_BUF_FLAG_USED;\n" + "> > \t\tif (src_mb->b->vb2_buf.planes[0].bytesused == 0) {\n" + "> > -\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0);\n" + "> > +\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, 0, 0, 0);\n" + "> > \t\t\tctx->state = MFCINST_FINISHING;\n" + "> > \t\t} else {\n" + "> > \t\t\tsrc_y_addr =\n" + "> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf, 0);\n" + "> > \t\t\tsrc_c_addr =\n" + "> vb2_dma_contig_plane_dma_addr(&src_mb->b->vb2_buf,\n" + "> > 1);\n" + "> > +\t\t\tif (ctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YUV420M ||\n" + "> > +\t\t\t\tctx->src_fmt->fourcc ==\n" + "> V4L2_PIX_FMT_YVU420M)\n" + "> > +\t\t\t\tsrc_c_1_addr =\n" + "> vb2_dma_contig_plane_dma_addr\n" + "> > +\t\t\t\t\t\t(&src_mb->b->vb2_buf, 2);\n" + "> > +\t\t\telse\n" + "> > +\t\t\t\tsrc_c_1_addr = 0;\n" + "> >\n" + "> > \t\t\tmfc_debug(2, \"enc src y addr: 0x%08lx\\n\",\n" + "> src_y_addr);\n" + "> > \t\t\tmfc_debug(2, \"enc src c addr: 0x%08lx\\n\",\n" + "> src_c_addr);\n" + "> >\n" + "> > -\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr,\n" + "> src_c_addr);\n" + "> > +\t\t\ts5p_mfc_set_enc_frame_buffer_v6(ctx, src_y_addr,\n" + "> > +\t\t\t\t\t\tsrc_c_addr, src_c_1_addr);\n" + "> > \t\t\tif (src_mb->flags & MFC_BUF_FLAG_EOS)\n" + "> > \t\t\t\tctx->state = MFCINST_FINISHING;\n" + "> > \t\t}\n" + "> > @@ -2450,6 +2566,8 @@ const struct s5p_mfc_regs\n" + "> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)\n" + "> > \t\t\tS5P_FIMV_E_ENCODED_SOURCE_FIRST_ADDR_V7);\n" + "> > \tR(e_encoded_source_second_plane_addr,\n" + "> >\n" + "> \tS5P_FIMV_E_ENCODED_SOURCE_SECOND_ADDR_V7);\n" + "> > +\tR(e_encoded_source_third_plane_addr,\n" + "> > +\t\t\tS5P_FIMV_E_ENCODED_SOURCE_THIRD_ADDR_V7);\n" + "> > \tR(e_vp8_options, S5P_FIMV_E_VP8_OPTIONS_V7);\n" + "> >\n" + "> > \tif (!IS_MFCV8_PLUS(dev))\n" + "> > @@ -2464,16 +2582,20 @@ const struct s5p_mfc_regs\n" + "> *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev)\n" + "> > \tR(d_cpb_buffer_offset, S5P_FIMV_D_CPB_BUFFER_OFFSET_V8);\n" + "> > \tR(d_first_plane_dpb_size,\n" + "> S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8);\n" + "> > \tR(d_second_plane_dpb_size,\n" + "> S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8);\n" + "> > +\tR(d_third_plane_dpb_size,\n" + "> S5P_FIMV_D_THIRD_PLANE_DPB_SIZE_V8);\n" + "> > \tR(d_scratch_buffer_addr,\n" + "> S5P_FIMV_D_SCRATCH_BUFFER_ADDR_V8);\n" + "> > \tR(d_scratch_buffer_size, S5P_FIMV_D_SCRATCH_BUFFER_SIZE_V8);\n" + "> > \tR(d_first_plane_dpb_stride_size,\n" + "> > \t\t\tS5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8);\n" + "> > \tR(d_second_plane_dpb_stride_size,\n" + "> >\n" + "> \tS5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8);\n" + "> > +\tR(d_third_plane_dpb_stride_size,\n" + "> > +\t\t\tS5P_FIMV_D_THIRD_PLANE_DPB_STRIDE_SIZE_V8);\n" + "> > \tR(d_mv_buffer_size, S5P_FIMV_D_MV_BUFFER_SIZE_V8);\n" + "> > \tR(d_num_mv, S5P_FIMV_D_NUM_MV_V8);\n" + "> > \tR(d_first_plane_dpb, S5P_FIMV_D_FIRST_PLANE_DPB_V8);\n" + "> > \tR(d_second_plane_dpb, S5P_FIMV_D_SECOND_PLANE_DPB_V8);\n" + "> > +\tR(d_third_plane_dpb, S5P_FIMV_D_THIRD_PLANE_DPB_V8);\n" + "> > \tR(d_mv_buffer, S5P_FIMV_D_MV_BUFFER_V8);\n" + "> > \tR(d_init_buffer_options, S5P_FIMV_D_INIT_BUFFER_OPTIONS_V8);\n" + "> > \tR(d_available_dpb_flag_lower,\n" + "> > S5P_FIMV_D_AVAILABLE_DPB_FLAG_LOWER_V8);\n" + "\n" + "\n" + "\n" + "\n" + "_______________________________________________\n" + "linux-arm-kernel mailing list\n" + "linux-arm-kernel@lists.infradead.org\n" + http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -c5eda922925e9b2485ca8bd062862f1daccb11ca8fcb4a43d4481bd612d7fa70 +1fa5a13469d79c4c03839d9a6026de8dd6fe9392a405d4b23a76b89272472d42
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.