Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-16 Thread tiffany lin
On Wed, 2015-12-16 at 14:47 +0100, Hans Verkuil wrote:
> On 12/16/15 14:17, tiffany lin wrote:
> > Hi Hans,
> > 
> > 
> > On Tue, 2015-12-15 at 15:17 +0100, Hans Verkuil wrote:
> >>
> >> On 12/15/15 14:51, tiffany lin wrote:
> >>> We are not familiar with v4l2-compliance utility, we will check how to
> >>> use it.
> >>
> >> It's part of v4l-utils.git (http://git.linuxtv.org/v4l-utils.git/). There 
> >> is a
> >> fairly decent man page. It does exhaustive compliance tests for V4L2 
> >> devices.
> >>
> >> That said, the support for memory-to-memory codec devices is not great, so 
> >> I wouldn't
> >> trust any failures it reports when using the streaming tests (i.e. the 
> >> --stream*
> >> options). By default just run 'v4l2-compliance -d /dev/videoX' to do the 
> >> compliance
> >> test.
> >>
> >> Note: before I accept this driver I do want to see that compliance test 
> >> output!
> >>
> > Got it. We will provide it in next version.
> > Now our driver is developed and run base on kernel v3.18.
> > V4L2 and vb2 have some difference between Linux 4.4-rc1 and 3.18 kernel.
> > Is it ok we provided test output base on v3.18 or we need to base on
> > 4.4-rc1?
> 
> I'm actually not sure if the latest v4l2-compliance test suite will work with 
> a 3.18
> kernel. so either you have to go back to an older version of v4l2-compliance 
> that
> works with 3.18 (go back to commit 4a57509a8334aca6ca8e81cd3beb08d5be397dac, 
> that
> might do the trick) or (and that's what I recommend) go with the latest 
> kernel.
> 
> For the media tree that is http://git.linuxtv.org/media_tree.git/log/.
> 
> The final version of the patch has to be against that kernel anyway.
> 
Got it. Thanks for your help, we will try it. ^_^

> > +}
> > +
> > +int m2mctx_venc_queue_init(void *priv, struct vb2_queue *src_vq,
> > +  struct vb2_queue *dst_vq)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = priv;
> > +   int ret;
> > +
> > +   src_vq->type= V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> > +   src_vq->io_modes= VB2_DMABUF | VB2_MMAP | VB2_USERPTR;
> 
>  You're using videobuf2-dma-contig, so VB2_USERPTR is generally useless 
>  in that
>  case. I would drop it.
> 
> >>> Sorry, I don't get it. 
> >>> We are using videobuf2-dma-contig, but we also using VB2_USERPTR.
> >>
> >>  In that case the user pointer you pass in must point to physically 
> >> contiguous
> >> memory. Which means you got it through some magic. Typically what should 
> >> be used
> >> are dmabuf handles to pass buffers around between different subsystems.
> >>
> >> The use of VB2_USERPTR for that purpose is deprecated.
> >>
> >> Or am I misunderstanding you as well?
> >>
> > Our encoder support all three modes.
> > In case that A driver + Encode driver flow, OUTPUT buffer will be
> > VB2_DMABUF from A driver.
> > In case that read YCbCr frame data from file and encode them to bit
> > stream flow, we use VB2_USERPTR and VB2_MMAP.
> > In VB2_USERPTR case, videobuf2-dma-contig will help us get continuous
> > dma address.
> > Our chip has IOMMU and M4U that help us get continuous phy address for
> > encode HW.
> > 
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-October/002525.html
> 
> Ah, OK. Have you tested this with malloc()ed buffers? Just asking :-)
> 
Yes. Actually we tested this with new()ed buffers. I think it default
call malloc.

> Regards,
> 
>   Hans

best regards,
Tiffany

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-16 Thread Hans Verkuil
On 12/16/15 14:17, tiffany lin wrote:
> Hi Hans,
> 
> 
> On Tue, 2015-12-15 at 15:17 +0100, Hans Verkuil wrote:
>>
>> On 12/15/15 14:51, tiffany lin wrote:
>>> We are not familiar with v4l2-compliance utility, we will check how to
>>> use it.
>>
>> It's part of v4l-utils.git (http://git.linuxtv.org/v4l-utils.git/). There is 
>> a
>> fairly decent man page. It does exhaustive compliance tests for V4L2 devices.
>>
>> That said, the support for memory-to-memory codec devices is not great, so I 
>> wouldn't
>> trust any failures it reports when using the streaming tests (i.e. the 
>> --stream*
>> options). By default just run 'v4l2-compliance -d /dev/videoX' to do the 
>> compliance
>> test.
>>
>> Note: before I accept this driver I do want to see that compliance test 
>> output!
>>
> Got it. We will provide it in next version.
> Now our driver is developed and run base on kernel v3.18.
> V4L2 and vb2 have some difference between Linux 4.4-rc1 and 3.18 kernel.
> Is it ok we provided test output base on v3.18 or we need to base on
> 4.4-rc1?

I'm actually not sure if the latest v4l2-compliance test suite will work with a 
3.18
kernel. so either you have to go back to an older version of v4l2-compliance 
that
works with 3.18 (go back to commit 4a57509a8334aca6ca8e81cd3beb08d5be397dac, 
that
might do the trick) or (and that's what I recommend) go with the latest kernel.

For the media tree that is http://git.linuxtv.org/media_tree.git/log/.

The final version of the patch has to be against that kernel anyway.

> +}
> +
> +int m2mctx_venc_queue_init(void *priv, struct vb2_queue *src_vq,
> +struct vb2_queue *dst_vq)
> +{
> + struct mtk_vcodec_ctx *ctx = priv;
> + int ret;
> +
> + src_vq->type= V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> + src_vq->io_modes= VB2_DMABUF | VB2_MMAP | VB2_USERPTR;

 You're using videobuf2-dma-contig, so VB2_USERPTR is generally useless in 
 that
 case. I would drop it.

>>> Sorry, I don't get it. 
>>> We are using videobuf2-dma-contig, but we also using VB2_USERPTR.
>>
>>  In that case the user pointer you pass in must point to physically 
>> contiguous
>> memory. Which means you got it through some magic. Typically what should be 
>> used
>> are dmabuf handles to pass buffers around between different subsystems.
>>
>> The use of VB2_USERPTR for that purpose is deprecated.
>>
>> Or am I misunderstanding you as well?
>>
> Our encoder support all three modes.
> In case that A driver + Encode driver flow, OUTPUT buffer will be
> VB2_DMABUF from A driver.
> In case that read YCbCr frame data from file and encode them to bit
> stream flow, we use VB2_USERPTR and VB2_MMAP.
> In VB2_USERPTR case, videobuf2-dma-contig will help us get continuous
> dma address.
> Our chip has IOMMU and M4U that help us get continuous phy address for
> encode HW.
> 
> http://lists.infradead.org/pipermail/linux-mediatek/2015-October/002525.html

Ah, OK. Have you tested this with malloc()ed buffers? Just asking :-)

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-16 Thread tiffany lin
Hi Hans,


On Tue, 2015-12-15 at 15:17 +0100, Hans Verkuil wrote:
> 
> On 12/15/15 14:51, tiffany lin wrote:
> > Hi Hans,
> > 
> > Thanks for your time.
> > 
> > On Mon, 2015-12-14 at 13:50 +0100, Hans Verkuil wrote:
> >> Hi Tiffany,
> >>
> >> My apologies for the long delay, but I finally have time to do a review of 
> >> this
> >> code.
> >>
> >> On 12/11/2015 10:55 AM, Tiffany Lin wrote:
> >>> From: Andrew-CT Chen 
> >>>
> >>> Add v4l2 layer encoder driver for MT8173
> >>>
> >>> Signed-off-by: Tiffany Lin 
> >>> ---
> >>>  drivers/media/platform/Kconfig |   11 +
> >>>  drivers/media/platform/Makefile|2 +
> >>>  drivers/media/platform/mtk-vcodec/Makefile |8 +
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
> >>> 
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
> >>>  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
> >>>  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
> >>>  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
> >>>  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
> >>>  17 files changed, 3637 insertions(+)
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
> >>>
> >>
> >> 
> >>
> >>> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
> >>> b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >>> new file mode 100644
> >>> index 000..d59064d
> >>> --- /dev/null
> >>> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >>> @@ -0,0 +1,1670 @@
> >>> +/*
> >>> +* Copyright (c) 2015 MediaTek Inc.
> >>> +* Author: PC Chen 
> >>> +* Tiffany Lin 
> >>> +*
> >>> +* This program is free software; you can redistribute it and/or modify
> >>> +* it under the terms of the GNU General Public License version 2 as
> >>> +* published by the Free Software Foundation.
> >>> +*
> >>> +* This program is distributed in the hope that it will be useful,
> >>> +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> >>> +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >>> +* GNU General Public License for more details.
> >>> +*/
> >>> +
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +
> >>> +#include "mtk_vcodec_drv.h"
> >>> +#include "mtk_vcodec_enc.h"
> >>> +#include "mtk_vcodec_intr.h"
> >>> +#include "mtk_vcodec_util.h"
> >>> +#include "venc_drv_if.h"
> >>> +
> >>> +static void mtk_venc_worker(struct work_struct *work);
> >>> +
> >>> +static struct mtk_video_fmt mtk_video_formats[] = {
> >>> + {
> >>> + .name   = "4:2:0 3 Planes Y/Cb/Cr",
> >>
> >> Don't add the name. The v4l2 core will set that for you. This ensures that 
> >> the name is
> >> always the same for the format, instead of being driver dependent.
> >>
> > We will remove it in next version.
> > 
> >>> + .fourcc = V4L2_PIX_FMT_YUV420,
> >>> + .type   = MTK_FMT_FRAME,
> >>> + .num_planes = 3,
> >>> + },
> >>> + {
> >>> + .name   = "4:2:0 3 Planes Y/Cr/Cb",
> >>> + .fourcc = V4L2_PIX_FMT_YVU420,
> >>> + .type   = MTK_FMT_FRAME,
> >>> + .num_planes = 3,
> >>> + },
> >>> + {
> >>> + .name   = "4:2:0 2 Planes Y/CbCr",
> >>> + .fourcc = V4L2_PIX_FMT_NV12,
> >>> 

Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-16 Thread tiffany lin
On Wed, 2015-12-16 at 14:47 +0100, Hans Verkuil wrote:
> On 12/16/15 14:17, tiffany lin wrote:
> > Hi Hans,
> > 
> > 
> > On Tue, 2015-12-15 at 15:17 +0100, Hans Verkuil wrote:
> >>
> >> On 12/15/15 14:51, tiffany lin wrote:
> >>> We are not familiar with v4l2-compliance utility, we will check how to
> >>> use it.
> >>
> >> It's part of v4l-utils.git (http://git.linuxtv.org/v4l-utils.git/). There 
> >> is a
> >> fairly decent man page. It does exhaustive compliance tests for V4L2 
> >> devices.
> >>
> >> That said, the support for memory-to-memory codec devices is not great, so 
> >> I wouldn't
> >> trust any failures it reports when using the streaming tests (i.e. the 
> >> --stream*
> >> options). By default just run 'v4l2-compliance -d /dev/videoX' to do the 
> >> compliance
> >> test.
> >>
> >> Note: before I accept this driver I do want to see that compliance test 
> >> output!
> >>
> > Got it. We will provide it in next version.
> > Now our driver is developed and run base on kernel v3.18.
> > V4L2 and vb2 have some difference between Linux 4.4-rc1 and 3.18 kernel.
> > Is it ok we provided test output base on v3.18 or we need to base on
> > 4.4-rc1?
> 
> I'm actually not sure if the latest v4l2-compliance test suite will work with 
> a 3.18
> kernel. so either you have to go back to an older version of v4l2-compliance 
> that
> works with 3.18 (go back to commit 4a57509a8334aca6ca8e81cd3beb08d5be397dac, 
> that
> might do the trick) or (and that's what I recommend) go with the latest 
> kernel.
> 
> For the media tree that is http://git.linuxtv.org/media_tree.git/log/.
> 
> The final version of the patch has to be against that kernel anyway.
> 
Got it. Thanks for your help, we will try it. ^_^

> > +}
> > +
> > +int m2mctx_venc_queue_init(void *priv, struct vb2_queue *src_vq,
> > +  struct vb2_queue *dst_vq)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = priv;
> > +   int ret;
> > +
> > +   src_vq->type= V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> > +   src_vq->io_modes= VB2_DMABUF | VB2_MMAP | VB2_USERPTR;
> 
>  You're using videobuf2-dma-contig, so VB2_USERPTR is generally useless 
>  in that
>  case. I would drop it.
> 
> >>> Sorry, I don't get it. 
> >>> We are using videobuf2-dma-contig, but we also using VB2_USERPTR.
> >>
> >>  In that case the user pointer you pass in must point to physically 
> >> contiguous
> >> memory. Which means you got it through some magic. Typically what should 
> >> be used
> >> are dmabuf handles to pass buffers around between different subsystems.
> >>
> >> The use of VB2_USERPTR for that purpose is deprecated.
> >>
> >> Or am I misunderstanding you as well?
> >>
> > Our encoder support all three modes.
> > In case that A driver + Encode driver flow, OUTPUT buffer will be
> > VB2_DMABUF from A driver.
> > In case that read YCbCr frame data from file and encode them to bit
> > stream flow, we use VB2_USERPTR and VB2_MMAP.
> > In VB2_USERPTR case, videobuf2-dma-contig will help us get continuous
> > dma address.
> > Our chip has IOMMU and M4U that help us get continuous phy address for
> > encode HW.
> > 
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-October/002525.html
> 
> Ah, OK. Have you tested this with malloc()ed buffers? Just asking :-)
> 
Yes. Actually we tested this with new()ed buffers. I think it default
call malloc.

> Regards,
> 
>   Hans

best regards,
Tiffany

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-16 Thread Hans Verkuil
On 12/16/15 14:17, tiffany lin wrote:
> Hi Hans,
> 
> 
> On Tue, 2015-12-15 at 15:17 +0100, Hans Verkuil wrote:
>>
>> On 12/15/15 14:51, tiffany lin wrote:
>>> We are not familiar with v4l2-compliance utility, we will check how to
>>> use it.
>>
>> It's part of v4l-utils.git (http://git.linuxtv.org/v4l-utils.git/). There is 
>> a
>> fairly decent man page. It does exhaustive compliance tests for V4L2 devices.
>>
>> That said, the support for memory-to-memory codec devices is not great, so I 
>> wouldn't
>> trust any failures it reports when using the streaming tests (i.e. the 
>> --stream*
>> options). By default just run 'v4l2-compliance -d /dev/videoX' to do the 
>> compliance
>> test.
>>
>> Note: before I accept this driver I do want to see that compliance test 
>> output!
>>
> Got it. We will provide it in next version.
> Now our driver is developed and run base on kernel v3.18.
> V4L2 and vb2 have some difference between Linux 4.4-rc1 and 3.18 kernel.
> Is it ok we provided test output base on v3.18 or we need to base on
> 4.4-rc1?

I'm actually not sure if the latest v4l2-compliance test suite will work with a 
3.18
kernel. so either you have to go back to an older version of v4l2-compliance 
that
works with 3.18 (go back to commit 4a57509a8334aca6ca8e81cd3beb08d5be397dac, 
that
might do the trick) or (and that's what I recommend) go with the latest kernel.

For the media tree that is http://git.linuxtv.org/media_tree.git/log/.

The final version of the patch has to be against that kernel anyway.

> +}
> +
> +int m2mctx_venc_queue_init(void *priv, struct vb2_queue *src_vq,
> +struct vb2_queue *dst_vq)
> +{
> + struct mtk_vcodec_ctx *ctx = priv;
> + int ret;
> +
> + src_vq->type= V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
> + src_vq->io_modes= VB2_DMABUF | VB2_MMAP | VB2_USERPTR;

 You're using videobuf2-dma-contig, so VB2_USERPTR is generally useless in 
 that
 case. I would drop it.

>>> Sorry, I don't get it. 
>>> We are using videobuf2-dma-contig, but we also using VB2_USERPTR.
>>
>>  In that case the user pointer you pass in must point to physically 
>> contiguous
>> memory. Which means you got it through some magic. Typically what should be 
>> used
>> are dmabuf handles to pass buffers around between different subsystems.
>>
>> The use of VB2_USERPTR for that purpose is deprecated.
>>
>> Or am I misunderstanding you as well?
>>
> Our encoder support all three modes.
> In case that A driver + Encode driver flow, OUTPUT buffer will be
> VB2_DMABUF from A driver.
> In case that read YCbCr frame data from file and encode them to bit
> stream flow, we use VB2_USERPTR and VB2_MMAP.
> In VB2_USERPTR case, videobuf2-dma-contig will help us get continuous
> dma address.
> Our chip has IOMMU and M4U that help us get continuous phy address for
> encode HW.
> 
> http://lists.infradead.org/pipermail/linux-mediatek/2015-October/002525.html

Ah, OK. Have you tested this with malloc()ed buffers? Just asking :-)

Regards,

Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-16 Thread tiffany lin
Hi Hans,


On Tue, 2015-12-15 at 15:17 +0100, Hans Verkuil wrote:
> 
> On 12/15/15 14:51, tiffany lin wrote:
> > Hi Hans,
> > 
> > Thanks for your time.
> > 
> > On Mon, 2015-12-14 at 13:50 +0100, Hans Verkuil wrote:
> >> Hi Tiffany,
> >>
> >> My apologies for the long delay, but I finally have time to do a review of 
> >> this
> >> code.
> >>
> >> On 12/11/2015 10:55 AM, Tiffany Lin wrote:
> >>> From: Andrew-CT Chen 
> >>>
> >>> Add v4l2 layer encoder driver for MT8173
> >>>
> >>> Signed-off-by: Tiffany Lin 
> >>> ---
> >>>  drivers/media/platform/Kconfig |   11 +
> >>>  drivers/media/platform/Makefile|2 +
> >>>  drivers/media/platform/mtk-vcodec/Makefile |8 +
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
> >>> 
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
> >>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
> >>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
> >>>  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
> >>>  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
> >>>  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
> >>>  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
> >>>  17 files changed, 3637 insertions(+)
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
> >>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
> >>>
> >>
> >> 
> >>
> >>> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
> >>> b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >>> new file mode 100644
> >>> index 000..d59064d
> >>> --- /dev/null
> >>> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >>> @@ -0,0 +1,1670 @@
> >>> +/*
> >>> +* Copyright (c) 2015 MediaTek Inc.
> >>> +* Author: PC Chen 
> >>> +* Tiffany Lin 
> >>> +*
> >>> +* This program is free software; you can redistribute it and/or modify
> >>> +* it under the terms of the GNU General Public License version 2 as
> >>> +* published by the Free Software Foundation.
> >>> +*
> >>> +* This program is distributed in the hope that it will be useful,
> >>> +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> >>> +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >>> +* GNU General Public License for more details.
> >>> +*/
> >>> +
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +
> >>> +#include "mtk_vcodec_drv.h"
> >>> +#include "mtk_vcodec_enc.h"
> >>> +#include "mtk_vcodec_intr.h"
> >>> +#include "mtk_vcodec_util.h"
> >>> +#include "venc_drv_if.h"
> >>> +
> >>> +static void mtk_venc_worker(struct work_struct *work);
> >>> +
> >>> +static struct mtk_video_fmt mtk_video_formats[] = {
> >>> + {
> >>> + .name   = "4:2:0 3 Planes Y/Cb/Cr",
> >>
> >> Don't add the name. The v4l2 core will set that for you. This ensures that 
> >> the name is
> >> always the same for the format, instead of being driver dependent.
> >>
> > We will remove it in next version.
> > 
> >>> + .fourcc = V4L2_PIX_FMT_YUV420,
> >>> + .type   = MTK_FMT_FRAME,
> >>> + .num_planes = 3,
> >>> + },
> >>> + {
> >>> + .name   = "4:2:0 3 Planes Y/Cr/Cb",
> >>> + .fourcc = V4L2_PIX_FMT_YVU420,
> >>> + .type   = MTK_FMT_FRAME,
> >>> + .num_planes = 3,
> >>> + },
> >>> + {
> >>> +

Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-15 Thread Hans Verkuil


On 12/15/15 14:51, tiffany lin wrote:
> Hi Hans,
> 
> Thanks for your time.
> 
> On Mon, 2015-12-14 at 13:50 +0100, Hans Verkuil wrote:
>> Hi Tiffany,
>>
>> My apologies for the long delay, but I finally have time to do a review of 
>> this
>> code.
>>
>> On 12/11/2015 10:55 AM, Tiffany Lin wrote:
>>> From: Andrew-CT Chen 
>>>
>>> Add v4l2 layer encoder driver for MT8173
>>>
>>> Signed-off-by: Tiffany Lin 
>>> ---
>>>  drivers/media/platform/Kconfig |   11 +
>>>  drivers/media/platform/Makefile|2 +
>>>  drivers/media/platform/mtk-vcodec/Makefile |8 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
>>> 
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
>>>  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
>>>  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
>>>  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
>>>  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
>>>  17 files changed, 3637 insertions(+)
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
>>>
>>
>> 
>>
>>> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
>>> b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>>> new file mode 100644
>>> index 000..d59064d
>>> --- /dev/null
>>> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>>> @@ -0,0 +1,1670 @@
>>> +/*
>>> +* Copyright (c) 2015 MediaTek Inc.
>>> +* Author: PC Chen 
>>> +* Tiffany Lin 
>>> +*
>>> +* This program is free software; you can redistribute it and/or modify
>>> +* it under the terms of the GNU General Public License version 2 as
>>> +* published by the Free Software Foundation.
>>> +*
>>> +* This program is distributed in the hope that it will be useful,
>>> +* but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> +* GNU General Public License for more details.
>>> +*/
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +#include "mtk_vcodec_drv.h"
>>> +#include "mtk_vcodec_enc.h"
>>> +#include "mtk_vcodec_intr.h"
>>> +#include "mtk_vcodec_util.h"
>>> +#include "venc_drv_if.h"
>>> +
>>> +static void mtk_venc_worker(struct work_struct *work);
>>> +
>>> +static struct mtk_video_fmt mtk_video_formats[] = {
>>> +   {
>>> +   .name   = "4:2:0 3 Planes Y/Cb/Cr",
>>
>> Don't add the name. The v4l2 core will set that for you. This ensures that 
>> the name is
>> always the same for the format, instead of being driver dependent.
>>
> We will remove it in next version.
> 
>>> +   .fourcc = V4L2_PIX_FMT_YUV420,
>>> +   .type   = MTK_FMT_FRAME,
>>> +   .num_planes = 3,
>>> +   },
>>> +   {
>>> +   .name   = "4:2:0 3 Planes Y/Cr/Cb",
>>> +   .fourcc = V4L2_PIX_FMT_YVU420,
>>> +   .type   = MTK_FMT_FRAME,
>>> +   .num_planes = 3,
>>> +   },
>>> +   {
>>> +   .name   = "4:2:0 2 Planes Y/CbCr",
>>> +   .fourcc = V4L2_PIX_FMT_NV12,
>>> +   .type   = MTK_FMT_FRAME,
>>> +   .num_planes = 2,
>>> +   },
>>> +   {
>>> +   .name   = "4:2:0 2 Planes Y/CrCb",
>>> +   .fourcc = V4L2_PIX_FMT_NV21,
>>> +   .type   = MTK_FMT_FRAME,

Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-15 Thread tiffany lin
Hi Hans,

Thanks for your time.

On Mon, 2015-12-14 at 13:50 +0100, Hans Verkuil wrote:
> Hi Tiffany,
> 
> My apologies for the long delay, but I finally have time to do a review of 
> this
> code.
> 
> On 12/11/2015 10:55 AM, Tiffany Lin wrote:
> > From: Andrew-CT Chen 
> > 
> > Add v4l2 layer encoder driver for MT8173
> > 
> > Signed-off-by: Tiffany Lin 
> > ---
> >  drivers/media/platform/Kconfig |   11 +
> >  drivers/media/platform/Makefile|2 +
> >  drivers/media/platform/mtk-vcodec/Makefile |8 +
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
> > 
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
> >  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
> >  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
> >  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
> >  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
> >  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
> >  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
> >  17 files changed, 3637 insertions(+)
> >  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
> > 
> 
> 
> 
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
> > b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> > new file mode 100644
> > index 000..d59064d
> > --- /dev/null
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> > @@ -0,0 +1,1670 @@
> > +/*
> > +* Copyright (c) 2015 MediaTek Inc.
> > +* Author: PC Chen 
> > +* Tiffany Lin 
> > +*
> > +* This program is free software; you can redistribute it and/or modify
> > +* it under the terms of the GNU General Public License version 2 as
> > +* published by the Free Software Foundation.
> > +*
> > +* This program is distributed in the hope that it will be useful,
> > +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +* GNU General Public License for more details.
> > +*/
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "mtk_vcodec_drv.h"
> > +#include "mtk_vcodec_enc.h"
> > +#include "mtk_vcodec_intr.h"
> > +#include "mtk_vcodec_util.h"
> > +#include "venc_drv_if.h"
> > +
> > +static void mtk_venc_worker(struct work_struct *work);
> > +
> > +static struct mtk_video_fmt mtk_video_formats[] = {
> > +   {
> > +   .name   = "4:2:0 3 Planes Y/Cb/Cr",
> 
> Don't add the name. The v4l2 core will set that for you. This ensures that 
> the name is
> always the same for the format, instead of being driver dependent.
> 
We will remove it in next version.

> > +   .fourcc = V4L2_PIX_FMT_YUV420,
> > +   .type   = MTK_FMT_FRAME,
> > +   .num_planes = 3,
> > +   },
> > +   {
> > +   .name   = "4:2:0 3 Planes Y/Cr/Cb",
> > +   .fourcc = V4L2_PIX_FMT_YVU420,
> > +   .type   = MTK_FMT_FRAME,
> > +   .num_planes = 3,
> > +   },
> > +   {
> > +   .name   = "4:2:0 2 Planes Y/CbCr",
> > +   .fourcc = V4L2_PIX_FMT_NV12,
> > +   .type   = MTK_FMT_FRAME,
> > +   .num_planes = 2,
> > +   },
> > +   {
> > +   .name   = "4:2:0 2 Planes Y/CrCb",
> > +   .fourcc = V4L2_PIX_FMT_NV21,
> > +   .type   = MTK_FMT_FRAME,
> > +   .num_planes = 2,
> > +   },
> > +   {
> > 

Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-15 Thread tiffany lin
Hi Hans,

Thanks for your time.

On Mon, 2015-12-14 at 13:50 +0100, Hans Verkuil wrote:
> Hi Tiffany,
> 
> My apologies for the long delay, but I finally have time to do a review of 
> this
> code.
> 
> On 12/11/2015 10:55 AM, Tiffany Lin wrote:
> > From: Andrew-CT Chen 
> > 
> > Add v4l2 layer encoder driver for MT8173
> > 
> > Signed-off-by: Tiffany Lin 
> > ---
> >  drivers/media/platform/Kconfig |   11 +
> >  drivers/media/platform/Makefile|2 +
> >  drivers/media/platform/mtk-vcodec/Makefile |8 +
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
> > 
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
> >  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
> >  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
> >  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
> >  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
> >  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
> >  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
> >  17 files changed, 3637 insertions(+)
> >  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
> > 
> 
> 
> 
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
> > b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> > new file mode 100644
> > index 000..d59064d
> > --- /dev/null
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> > @@ -0,0 +1,1670 @@
> > +/*
> > +* Copyright (c) 2015 MediaTek Inc.
> > +* Author: PC Chen 
> > +* Tiffany Lin 
> > +*
> > +* This program is free software; you can redistribute it and/or modify
> > +* it under the terms of the GNU General Public License version 2 as
> > +* published by the Free Software Foundation.
> > +*
> > +* This program is distributed in the hope that it will be useful,
> > +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +* GNU General Public License for more details.
> > +*/
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "mtk_vcodec_drv.h"
> > +#include "mtk_vcodec_enc.h"
> > +#include "mtk_vcodec_intr.h"
> > +#include "mtk_vcodec_util.h"
> > +#include "venc_drv_if.h"
> > +
> > +static void mtk_venc_worker(struct work_struct *work);
> > +
> > +static struct mtk_video_fmt mtk_video_formats[] = {
> > +   {
> > +   .name   = "4:2:0 3 Planes Y/Cb/Cr",
> 
> Don't add the name. The v4l2 core will set that for you. This ensures that 
> the name is
> always the same for the format, instead of being driver dependent.
> 
We will remove it in next version.

> > +   .fourcc = V4L2_PIX_FMT_YUV420,
> > +   .type   = MTK_FMT_FRAME,
> > +   .num_planes = 3,
> > +   },
> > +   {
> > +   .name   = "4:2:0 3 Planes Y/Cr/Cb",
> > +   .fourcc = V4L2_PIX_FMT_YVU420,
> > +   .type   = MTK_FMT_FRAME,
> > +   .num_planes = 3,
> > +   },
> > +   {
> > +   .name   = "4:2:0 2 Planes Y/CbCr",
> > +   .fourcc = V4L2_PIX_FMT_NV12,
> > +   .type   = MTK_FMT_FRAME,
> > +   .num_planes = 2,
> > +   },
> > +   {
> > +   .name   = "4:2:0 2 Planes Y/CrCb",
> > +   .fourcc = V4L2_PIX_FMT_NV21,
> > +

Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-15 Thread Hans Verkuil


On 12/15/15 14:51, tiffany lin wrote:
> Hi Hans,
> 
> Thanks for your time.
> 
> On Mon, 2015-12-14 at 13:50 +0100, Hans Verkuil wrote:
>> Hi Tiffany,
>>
>> My apologies for the long delay, but I finally have time to do a review of 
>> this
>> code.
>>
>> On 12/11/2015 10:55 AM, Tiffany Lin wrote:
>>> From: Andrew-CT Chen 
>>>
>>> Add v4l2 layer encoder driver for MT8173
>>>
>>> Signed-off-by: Tiffany Lin 
>>> ---
>>>  drivers/media/platform/Kconfig |   11 +
>>>  drivers/media/platform/Makefile|2 +
>>>  drivers/media/platform/mtk-vcodec/Makefile |8 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
>>> 
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
>>>  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
>>>  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
>>>  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
>>>  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
>>>  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
>>>  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
>>>  17 files changed, 3637 insertions(+)
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
>>>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
>>>
>>
>> 
>>
>>> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
>>> b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>>> new file mode 100644
>>> index 000..d59064d
>>> --- /dev/null
>>> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>>> @@ -0,0 +1,1670 @@
>>> +/*
>>> +* Copyright (c) 2015 MediaTek Inc.
>>> +* Author: PC Chen 
>>> +* Tiffany Lin 
>>> +*
>>> +* This program is free software; you can redistribute it and/or modify
>>> +* it under the terms of the GNU General Public License version 2 as
>>> +* published by the Free Software Foundation.
>>> +*
>>> +* This program is distributed in the hope that it will be useful,
>>> +* but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>> +* GNU General Public License for more details.
>>> +*/
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +#include "mtk_vcodec_drv.h"
>>> +#include "mtk_vcodec_enc.h"
>>> +#include "mtk_vcodec_intr.h"
>>> +#include "mtk_vcodec_util.h"
>>> +#include "venc_drv_if.h"
>>> +
>>> +static void mtk_venc_worker(struct work_struct *work);
>>> +
>>> +static struct mtk_video_fmt mtk_video_formats[] = {
>>> +   {
>>> +   .name   = "4:2:0 3 Planes Y/Cb/Cr",
>>
>> Don't add the name. The v4l2 core will set that for you. This ensures that 
>> the name is
>> always the same for the format, instead of being driver dependent.
>>
> We will remove it in next version.
> 
>>> +   .fourcc = V4L2_PIX_FMT_YUV420,
>>> +   .type   = MTK_FMT_FRAME,
>>> +   .num_planes = 3,
>>> +   },
>>> +   {
>>> +   .name   = "4:2:0 3 Planes Y/Cr/Cb",
>>> +   .fourcc = V4L2_PIX_FMT_YVU420,
>>> +   .type   = MTK_FMT_FRAME,
>>> +   .num_planes = 3,
>>> +   },
>>> +   {
>>> +   .name   = "4:2:0 2 Planes Y/CbCr",
>>> +   .fourcc = V4L2_PIX_FMT_NV12,
>>> +   .type   = MTK_FMT_FRAME,
>>> +   .num_planes = 2,
>>> +   },
>>> +   {
>>> +   .name   = "4:2:0 2 Planes Y/CrCb",

Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-14 Thread Hans Verkuil
Hi Tiffany,

My apologies for the long delay, but I finally have time to do a review of this
code.

On 12/11/2015 10:55 AM, Tiffany Lin wrote:
> From: Andrew-CT Chen 
> 
> Add v4l2 layer encoder driver for MT8173
> 
> Signed-off-by: Tiffany Lin 
> ---
>  drivers/media/platform/Kconfig |   11 +
>  drivers/media/platform/Makefile|2 +
>  drivers/media/platform/mtk-vcodec/Makefile |8 +
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
> 
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
>  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
>  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
>  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
>  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
>  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
>  17 files changed, 3637 insertions(+)
>  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
> 



> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
> b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> new file mode 100644
> index 000..d59064d
> --- /dev/null
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> @@ -0,0 +1,1670 @@
> +/*
> +* Copyright (c) 2015 MediaTek Inc.
> +* Author: PC Chen 
> +* Tiffany Lin 
> +*
> +* This program is free software; you can redistribute it and/or modify
> +* it under the terms of the GNU General Public License version 2 as
> +* published by the Free Software Foundation.
> +*
> +* This program is distributed in the hope that it will be useful,
> +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +* GNU General Public License for more details.
> +*/
> +
> +#include 
> +#include 
> +#include 
> +
> +#include "mtk_vcodec_drv.h"
> +#include "mtk_vcodec_enc.h"
> +#include "mtk_vcodec_intr.h"
> +#include "mtk_vcodec_util.h"
> +#include "venc_drv_if.h"
> +
> +static void mtk_venc_worker(struct work_struct *work);
> +
> +static struct mtk_video_fmt mtk_video_formats[] = {
> + {
> + .name   = "4:2:0 3 Planes Y/Cb/Cr",

Don't add the name. The v4l2 core will set that for you. This ensures that the 
name is
always the same for the format, instead of being driver dependent.

> + .fourcc = V4L2_PIX_FMT_YUV420,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 3,
> + },
> + {
> + .name   = "4:2:0 3 Planes Y/Cr/Cb",
> + .fourcc = V4L2_PIX_FMT_YVU420,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 3,
> + },
> + {
> + .name   = "4:2:0 2 Planes Y/CbCr",
> + .fourcc = V4L2_PIX_FMT_NV12,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 2,
> + },
> + {
> + .name   = "4:2:0 2 Planes Y/CrCb",
> + .fourcc = V4L2_PIX_FMT_NV21,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 2,
> + },
> + {
> + .name   = "4:2:0 3 none contiguous Planes Y/Cb/Cr",
> + .fourcc = V4L2_PIX_FMT_YUV420M,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 3,
> + },
> + {
> + .name   = "4:2:0 3 none contiguous Planes 

Re: [PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-14 Thread Hans Verkuil
Hi Tiffany,

My apologies for the long delay, but I finally have time to do a review of this
code.

On 12/11/2015 10:55 AM, Tiffany Lin wrote:
> From: Andrew-CT Chen 
> 
> Add v4l2 layer encoder driver for MT8173
> 
> Signed-off-by: Tiffany Lin 
> ---
>  drivers/media/platform/Kconfig |   11 +
>  drivers/media/platform/Makefile|2 +
>  drivers/media/platform/mtk-vcodec/Makefile |8 +
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
> 
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
>  drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
>  .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
>  .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
>  drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
>  drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
>  drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
>  drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
>  17 files changed, 3637 insertions(+)
>  create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
>  create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h
> 



> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c 
> b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> new file mode 100644
> index 000..d59064d
> --- /dev/null
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> @@ -0,0 +1,1670 @@
> +/*
> +* Copyright (c) 2015 MediaTek Inc.
> +* Author: PC Chen 
> +* Tiffany Lin 
> +*
> +* This program is free software; you can redistribute it and/or modify
> +* it under the terms of the GNU General Public License version 2 as
> +* published by the Free Software Foundation.
> +*
> +* This program is distributed in the hope that it will be useful,
> +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +* GNU General Public License for more details.
> +*/
> +
> +#include 
> +#include 
> +#include 
> +
> +#include "mtk_vcodec_drv.h"
> +#include "mtk_vcodec_enc.h"
> +#include "mtk_vcodec_intr.h"
> +#include "mtk_vcodec_util.h"
> +#include "venc_drv_if.h"
> +
> +static void mtk_venc_worker(struct work_struct *work);
> +
> +static struct mtk_video_fmt mtk_video_formats[] = {
> + {
> + .name   = "4:2:0 3 Planes Y/Cb/Cr",

Don't add the name. The v4l2 core will set that for you. This ensures that the 
name is
always the same for the format, instead of being driver dependent.

> + .fourcc = V4L2_PIX_FMT_YUV420,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 3,
> + },
> + {
> + .name   = "4:2:0 3 Planes Y/Cr/Cb",
> + .fourcc = V4L2_PIX_FMT_YVU420,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 3,
> + },
> + {
> + .name   = "4:2:0 2 Planes Y/CbCr",
> + .fourcc = V4L2_PIX_FMT_NV12,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 2,
> + },
> + {
> + .name   = "4:2:0 2 Planes Y/CrCb",
> + .fourcc = V4L2_PIX_FMT_NV21,
> + .type   = MTK_FMT_FRAME,
> + .num_planes = 2,
> + },
> + {
> + .name   = "4:2:0 3 none contiguous Planes Y/Cb/Cr",
> + .fourcc = V4L2_PIX_FMT_YUV420M,
> + .type   = MTK_FMT_FRAME,
> + .num_planes 

[PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-11 Thread Tiffany Lin
From: Andrew-CT Chen 

Add v4l2 layer encoder driver for MT8173

Signed-off-by: Tiffany Lin 
---
 drivers/media/platform/Kconfig |   11 +
 drivers/media/platform/Makefile|2 +
 drivers/media/platform/mtk-vcodec/Makefile |8 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
 .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
 drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
 drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
 17 files changed, 3637 insertions(+)
 create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index f3776f5..c80ca5c 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -158,6 +158,17 @@ config VIDEO_MEDIATEK_VPU
codec embedded in new Mediatek's SOCs. It is able
to handle video decoding/encoding in a range of formats.
 
+config VIDEO_MEDIATEK_VCODEC
+tristate "Mediatek Video Codec driver"
+depends on VIDEO_DEV && VIDEO_V4L2
+depends on ARCH_MEDIATEK || COMPILE_TEST
+select VIDEOBUF2_DMA_CONTIG
+select V4L2_MEM2MEM_DEV
+select MEDIATEK_VPU
+default n
+---help---
+Mediatek video codec driver for V4L2
+
 config VIDEO_MEM2MEM_DEINTERLACE
tristate "Deinterlace support"
depends on VIDEO_DEV && VIDEO_V4L2 && DMA_ENGINE
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index e5b19c6..510e06b 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -57,3 +57,5 @@ obj-$(CONFIG_VIDEO_XILINX)+= xilinx/
 ccflags-y += -I$(srctree)/drivers/media/i2c
 
 obj-$(CONFIG_VIDEO_MEDIATEK_VPU)   += mtk-vpu/
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC)+= mtk-vcodec/
diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
new file mode 100644
index 000..ce38689
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -0,0 +1,8 @@
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk_vcodec_intr.o \
+  mtk_vcodec_util.o \
+  mtk_vcodec_enc_drv.o \
+  mtk_vcodec_enc.o \
+  mtk_vcodec_enc_pm.o \
+  venc_drv_if.o
+
+ccflags-y += -I$(srctree)/drivers/media/platform/mtk-vpu
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
new file mode 100644
index 000..1d6adde
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -0,0 +1,412 @@
+/*
+* Copyright (c) 2015 MediaTek Inc.
+* Author: PC Chen 
+* Tiffany Lin 
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*/
+
+#ifndef _MTK_VCODEC_DRV_H_
+#define 

[PATCH v2 6/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2015-12-11 Thread Tiffany Lin
From: Andrew-CT Chen 

Add v4l2 layer encoder driver for MT8173

Signed-off-by: Tiffany Lin 
---
 drivers/media/platform/Kconfig |   11 +
 drivers/media/platform/Makefile|2 +
 drivers/media/platform/mtk-vcodec/Makefile |8 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  412 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1670 
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   45 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  469 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  122 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|  102 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   29 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h  |   26 +
 .../media/platform/mtk-vcodec/mtk_vcodec_util.c|  106 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   85 +
 drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|  102 ++
 drivers/media/platform/mtk-vcodec/venc_drv_if.h|  174 ++
 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  212 +++
 17 files changed, 3637 insertions(+)
 create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_pm.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index f3776f5..c80ca5c 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -158,6 +158,17 @@ config VIDEO_MEDIATEK_VPU
codec embedded in new Mediatek's SOCs. It is able
to handle video decoding/encoding in a range of formats.
 
+config VIDEO_MEDIATEK_VCODEC
+tristate "Mediatek Video Codec driver"
+depends on VIDEO_DEV && VIDEO_V4L2
+depends on ARCH_MEDIATEK || COMPILE_TEST
+select VIDEOBUF2_DMA_CONTIG
+select V4L2_MEM2MEM_DEV
+select MEDIATEK_VPU
+default n
+---help---
+Mediatek video codec driver for V4L2
+
 config VIDEO_MEM2MEM_DEINTERLACE
tristate "Deinterlace support"
depends on VIDEO_DEV && VIDEO_V4L2 && DMA_ENGINE
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index e5b19c6..510e06b 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -57,3 +57,5 @@ obj-$(CONFIG_VIDEO_XILINX)+= xilinx/
 ccflags-y += -I$(srctree)/drivers/media/i2c
 
 obj-$(CONFIG_VIDEO_MEDIATEK_VPU)   += mtk-vpu/
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC)+= mtk-vcodec/
diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
new file mode 100644
index 000..ce38689
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -0,0 +1,8 @@
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk_vcodec_intr.o \
+  mtk_vcodec_util.o \
+  mtk_vcodec_enc_drv.o \
+  mtk_vcodec_enc.o \
+  mtk_vcodec_enc_pm.o \
+  venc_drv_if.o
+
+ccflags-y += -I$(srctree)/drivers/media/platform/mtk-vpu
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
new file mode 100644
index 000..1d6adde
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -0,0 +1,412 @@
+/*
+* Copyright (c) 2015 MediaTek Inc.
+* Author: PC Chen 
+* Tiffany Lin 
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License version 2 as
+* published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*