* [PATCH 0/2] mtk-vcodec fixups
@ 2016-07-08 19:11 Hans Verkuil
2016-07-08 19:11 ` [PATCH 1/2] mtk-vcodec: convert driver to use the new vb2_queue dev field Hans Verkuil
2016-07-08 19:11 ` [PATCH 2/2] drivers/media/platform/Kconfig: fix VIDEO_MEDIATEK_VCODEC dependency Hans Verkuil
0 siblings, 2 replies; 6+ messages in thread
From: Hans Verkuil @ 2016-07-08 19:11 UTC (permalink / raw)
To: linux-media; +Cc: tiffany.lin
From: Hans Verkuil <hans.verkuil@cisco.com>
Two patches: the first converts the driver to use the new vb2_queue dev
field (this came in after the pull request of this driver was posted).
The second allows this driver to be built when COMPILE_TEST is set and
MTK_IOMMU is not set.
Regards,
Hans
Hans Verkuil (2):
mtk-vcodec: convert driver to use the new vb2_queue dev field
drivers/media/platform/Kconfig: fix VIDEO_MEDIATEK_VCODEC dependency
drivers/media/platform/Kconfig | 2 +-
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 3 ---
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 13 ++++++-------
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 12 ------------
4 files changed, 7 insertions(+), 23 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] mtk-vcodec: convert driver to use the new vb2_queue dev field
2016-07-08 19:11 [PATCH 0/2] mtk-vcodec fixups Hans Verkuil
@ 2016-07-08 19:11 ` Hans Verkuil
2016-07-11 3:48 ` tiffany lin
2016-07-08 19:11 ` [PATCH 2/2] drivers/media/platform/Kconfig: fix VIDEO_MEDIATEK_VCODEC dependency Hans Verkuil
1 sibling, 1 reply; 6+ messages in thread
From: Hans Verkuil @ 2016-07-08 19:11 UTC (permalink / raw)
To: linux-media; +Cc: tiffany.lin, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
The patch dropping the vb2_dma_contig_init_ctx() and _cleanup_ctx()
functions was already applied before this driver was added. So convert
this driver as well.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 3 ---
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 13 ++++++-------
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 12 ------------
3 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
index 78eee50..94f0a42 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -265,8 +265,6 @@ struct mtk_vcodec_ctx {
* @m2m_dev_enc: m2m device for encoder.
* @plat_dev: platform device
* @vpu_plat_dev: mtk vpu platform device
- * @alloc_ctx: VB2 allocator context
- * (for allocations without kernel mapping).
* @ctx_list: list of struct mtk_vcodec_ctx
* @irqlock: protect data access by irq handler and work thread
* @curr_ctx: The context that is waiting for codec hardware
@@ -299,7 +297,6 @@ struct mtk_vcodec_dev {
struct v4l2_m2m_dev *m2m_dev_enc;
struct platform_device *plat_dev;
struct platform_device *vpu_plat_dev;
- struct vb2_alloc_ctx *alloc_ctx;
struct list_head ctx_list;
spinlock_t irqlock;
struct mtk_vcodec_ctx *curr_ctx;
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
index 6e72d73..6dcae0a 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
@@ -693,7 +693,8 @@ const struct v4l2_ioctl_ops mtk_venc_ioctl_ops = {
static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers,
unsigned int *nplanes,
- unsigned int sizes[], void *alloc_ctxs[])
+ unsigned int sizes[],
+ struct device *alloc_devs[])
{
struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(vq);
struct mtk_q_data *q_data;
@@ -705,17 +706,13 @@ static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
return -EINVAL;
if (*nplanes) {
- for (i = 0; i < *nplanes; i++) {
+ for (i = 0; i < *nplanes; i++)
if (sizes[i] < q_data->sizeimage[i])
return -EINVAL;
- alloc_ctxs[i] = ctx->dev->alloc_ctx;
- }
} else {
*nplanes = q_data->fmt->num_planes;
- for (i = 0; i < *nplanes; i++) {
+ for (i = 0; i < *nplanes; i++)
sizes[i] = q_data->sizeimage[i];
- alloc_ctxs[i] = ctx->dev->alloc_ctx;
- }
}
return 0;
@@ -1249,6 +1246,7 @@ int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
src_vq->mem_ops = &vb2_dma_contig_memops;
src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
src_vq->lock = &ctx->dev->dev_mutex;
+ src_vq->dev = &ctx->dev->plat_dev->dev;
ret = vb2_queue_init(src_vq);
if (ret)
@@ -1262,6 +1260,7 @@ int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
dst_vq->mem_ops = &vb2_dma_contig_memops;
dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
dst_vq->lock = &ctx->dev->dev_mutex;
+ dst_vq->dev = &ctx->dev->plat_dev->dev;
return vb2_queue_init(dst_vq);
}
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
index 06105e9..9c10cc2 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
@@ -357,14 +357,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
dev->vfd_enc = vfd_enc;
platform_set_drvdata(pdev, dev);
- dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
- if (IS_ERR((__force void *)dev->alloc_ctx)) {
- mtk_v4l2_err("Failed to alloc vb2 dma context 0");
- ret = PTR_ERR((__force void *)dev->alloc_ctx);
- dev->alloc_ctx = NULL;
- goto err_vb2_ctx_init;
- }
-
dev->m2m_dev_enc = v4l2_m2m_init(&mtk_venc_m2m_ops);
if (IS_ERR((__force void *)dev->m2m_dev_enc)) {
mtk_v4l2_err("Failed to init mem2mem enc device");
@@ -401,8 +393,6 @@ err_enc_reg:
err_event_workq:
v4l2_m2m_release(dev->m2m_dev_enc);
err_enc_mem_init:
- vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
-err_vb2_ctx_init:
video_unregister_device(vfd_enc);
err_enc_alloc:
v4l2_device_unregister(&dev->v4l2_dev);
@@ -426,8 +416,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
destroy_workqueue(dev->encode_workqueue);
if (dev->m2m_dev_enc)
v4l2_m2m_release(dev->m2m_dev_enc);
- if (dev->alloc_ctx)
- vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
if (dev->vfd_enc)
video_unregister_device(dev->vfd_enc);
--
2.8.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drivers/media/platform/Kconfig: fix VIDEO_MEDIATEK_VCODEC dependency
2016-07-08 19:11 [PATCH 0/2] mtk-vcodec fixups Hans Verkuil
2016-07-08 19:11 ` [PATCH 1/2] mtk-vcodec: convert driver to use the new vb2_queue dev field Hans Verkuil
@ 2016-07-08 19:11 ` Hans Verkuil
2016-07-11 3:08 ` tiffany lin
1 sibling, 1 reply; 6+ messages in thread
From: Hans Verkuil @ 2016-07-08 19:11 UTC (permalink / raw)
To: linux-media; +Cc: tiffany.lin, Hans Verkuil
From: Hans Verkuil <hans.verkuil@cisco.com>
Allow VIDEO_MEDIATEK_VCODEC to build when COMPILE_TEST is set (even
without MTK_IOMMU).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
drivers/media/platform/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 3231b25..2c2670c 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -168,7 +168,7 @@ config VIDEO_MEDIATEK_VPU
config VIDEO_MEDIATEK_VCODEC
tristate "Mediatek Video Codec driver"
- depends on MTK_IOMMU
+ depends on MTK_IOMMU || COMPILE_TEST
depends on VIDEO_DEV && VIDEO_V4L2
depends on ARCH_MEDIATEK || COMPILE_TEST
select VIDEOBUF2_DMA_CONTIG
--
2.8.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drivers/media/platform/Kconfig: fix VIDEO_MEDIATEK_VCODEC dependency
2016-07-08 19:11 ` [PATCH 2/2] drivers/media/platform/Kconfig: fix VIDEO_MEDIATEK_VCODEC dependency Hans Verkuil
@ 2016-07-11 3:08 ` tiffany lin
0 siblings, 0 replies; 6+ messages in thread
From: tiffany lin @ 2016-07-11 3:08 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Hans Verkuil
On Fri, 2016-07-08 at 21:11 +0200, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> Allow VIDEO_MEDIATEK_VCODEC to build when COMPILE_TEST is set (even
> without MTK_IOMMU).
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> drivers/media/platform/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
> index 3231b25..2c2670c 100644
> --- a/drivers/media/platform/Kconfig
> +++ b/drivers/media/platform/Kconfig
> @@ -168,7 +168,7 @@ config VIDEO_MEDIATEK_VPU
>
> config VIDEO_MEDIATEK_VCODEC
> tristate "Mediatek Video Codec driver"
> - depends on MTK_IOMMU
> + depends on MTK_IOMMU || COMPILE_TEST
> depends on VIDEO_DEV && VIDEO_V4L2
> depends on ARCH_MEDIATEK || COMPILE_TEST
> select VIDEOBUF2_DMA_CONTIG
reviewed-by: Tiffany Lin <tiffany.lin@mediatek.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mtk-vcodec: convert driver to use the new vb2_queue dev field
2016-07-08 19:11 ` [PATCH 1/2] mtk-vcodec: convert driver to use the new vb2_queue dev field Hans Verkuil
@ 2016-07-11 3:48 ` tiffany lin
2016-07-11 4:00 ` Hans Verkuil
0 siblings, 1 reply; 6+ messages in thread
From: tiffany lin @ 2016-07-11 3:48 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Hans Verkuil
reviewed-by: Tiffany Lin <tiffany.lin@mediatek.com>
May I know why and how we use struct device *alloc_devs[] in queue_setup
callback function?
best regards,
Tiffany
On Fri, 2016-07-08 at 21:11 +0200, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> The patch dropping the vb2_dma_contig_init_ctx() and _cleanup_ctx()
> functions was already applied before this driver was added. So convert
> this driver as well.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> ---
> drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 3 ---
> drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 13 ++++++-------
> drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 12 ------------
> 3 files changed, 6 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> index 78eee50..94f0a42 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
> @@ -265,8 +265,6 @@ struct mtk_vcodec_ctx {
> * @m2m_dev_enc: m2m device for encoder.
> * @plat_dev: platform device
> * @vpu_plat_dev: mtk vpu platform device
> - * @alloc_ctx: VB2 allocator context
> - * (for allocations without kernel mapping).
> * @ctx_list: list of struct mtk_vcodec_ctx
> * @irqlock: protect data access by irq handler and work thread
> * @curr_ctx: The context that is waiting for codec hardware
> @@ -299,7 +297,6 @@ struct mtk_vcodec_dev {
> struct v4l2_m2m_dev *m2m_dev_enc;
> struct platform_device *plat_dev;
> struct platform_device *vpu_plat_dev;
> - struct vb2_alloc_ctx *alloc_ctx;
> struct list_head ctx_list;
> spinlock_t irqlock;
> struct mtk_vcodec_ctx *curr_ctx;
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> index 6e72d73..6dcae0a 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
> @@ -693,7 +693,8 @@ const struct v4l2_ioctl_ops mtk_venc_ioctl_ops = {
> static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
> unsigned int *nbuffers,
> unsigned int *nplanes,
> - unsigned int sizes[], void *alloc_ctxs[])
> + unsigned int sizes[],
> + struct device *alloc_devs[])
> {
> struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(vq);
> struct mtk_q_data *q_data;
> @@ -705,17 +706,13 @@ static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
> return -EINVAL;
>
> if (*nplanes) {
> - for (i = 0; i < *nplanes; i++) {
> + for (i = 0; i < *nplanes; i++)
> if (sizes[i] < q_data->sizeimage[i])
> return -EINVAL;
> - alloc_ctxs[i] = ctx->dev->alloc_ctx;
> - }
> } else {
> *nplanes = q_data->fmt->num_planes;
> - for (i = 0; i < *nplanes; i++) {
> + for (i = 0; i < *nplanes; i++)
> sizes[i] = q_data->sizeimage[i];
> - alloc_ctxs[i] = ctx->dev->alloc_ctx;
> - }
> }
>
> return 0;
> @@ -1249,6 +1246,7 @@ int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
> src_vq->mem_ops = &vb2_dma_contig_memops;
> src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
> src_vq->lock = &ctx->dev->dev_mutex;
> + src_vq->dev = &ctx->dev->plat_dev->dev;
>
> ret = vb2_queue_init(src_vq);
> if (ret)
> @@ -1262,6 +1260,7 @@ int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
> dst_vq->mem_ops = &vb2_dma_contig_memops;
> dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
> dst_vq->lock = &ctx->dev->dev_mutex;
> + dst_vq->dev = &ctx->dev->plat_dev->dev;
>
> return vb2_queue_init(dst_vq);
> }
> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> index 06105e9..9c10cc2 100644
> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
> @@ -357,14 +357,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
> dev->vfd_enc = vfd_enc;
> platform_set_drvdata(pdev, dev);
>
> - dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
> - if (IS_ERR((__force void *)dev->alloc_ctx)) {
> - mtk_v4l2_err("Failed to alloc vb2 dma context 0");
> - ret = PTR_ERR((__force void *)dev->alloc_ctx);
> - dev->alloc_ctx = NULL;
> - goto err_vb2_ctx_init;
> - }
> -
> dev->m2m_dev_enc = v4l2_m2m_init(&mtk_venc_m2m_ops);
> if (IS_ERR((__force void *)dev->m2m_dev_enc)) {
> mtk_v4l2_err("Failed to init mem2mem enc device");
> @@ -401,8 +393,6 @@ err_enc_reg:
> err_event_workq:
> v4l2_m2m_release(dev->m2m_dev_enc);
> err_enc_mem_init:
> - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
> -err_vb2_ctx_init:
> video_unregister_device(vfd_enc);
> err_enc_alloc:
> v4l2_device_unregister(&dev->v4l2_dev);
> @@ -426,8 +416,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
> destroy_workqueue(dev->encode_workqueue);
> if (dev->m2m_dev_enc)
> v4l2_m2m_release(dev->m2m_dev_enc);
> - if (dev->alloc_ctx)
> - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
>
> if (dev->vfd_enc)
> video_unregister_device(dev->vfd_enc);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] mtk-vcodec: convert driver to use the new vb2_queue dev field
2016-07-11 3:48 ` tiffany lin
@ 2016-07-11 4:00 ` Hans Verkuil
0 siblings, 0 replies; 6+ messages in thread
From: Hans Verkuil @ 2016-07-11 4:00 UTC (permalink / raw)
To: tiffany lin; +Cc: linux-media, Hans Verkuil
On 07/11/2016 05:48 AM, tiffany lin wrote:
>
> reviewed-by: Tiffany Lin <tiffany.lin@mediatek.com>
>
>
> May I know why and how we use struct device *alloc_devs[] in queue_setup
> callback function?
That's only needed if the hardware has to allocate each plane buffer from a
different memory bank. That's important for the exynos4 SoCs. All other devices
just need a single device struct which you set in the vb2_queue dev field.
The alloc_devs array is prefilled with that dev pointer and drivers can override
it here is they need to (as mentioned, currently only exynos4 needs that).
Regards,
Hans
>
>
> best regards,
> Tiffany
>
> On Fri, 2016-07-08 at 21:11 +0200, Hans Verkuil wrote:
>> From: Hans Verkuil <hans.verkuil@cisco.com>
>>
>> The patch dropping the vb2_dma_contig_init_ctx() and _cleanup_ctx()
>> functions was already applied before this driver was added. So convert
>> this driver as well.
>>
>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>> ---
>> drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 3 ---
>> drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 13 ++++++-------
>> drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 12 ------------
>> 3 files changed, 6 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>> index 78eee50..94f0a42 100644
>> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
>> @@ -265,8 +265,6 @@ struct mtk_vcodec_ctx {
>> * @m2m_dev_enc: m2m device for encoder.
>> * @plat_dev: platform device
>> * @vpu_plat_dev: mtk vpu platform device
>> - * @alloc_ctx: VB2 allocator context
>> - * (for allocations without kernel mapping).
>> * @ctx_list: list of struct mtk_vcodec_ctx
>> * @irqlock: protect data access by irq handler and work thread
>> * @curr_ctx: The context that is waiting for codec hardware
>> @@ -299,7 +297,6 @@ struct mtk_vcodec_dev {
>> struct v4l2_m2m_dev *m2m_dev_enc;
>> struct platform_device *plat_dev;
>> struct platform_device *vpu_plat_dev;
>> - struct vb2_alloc_ctx *alloc_ctx;
>> struct list_head ctx_list;
>> spinlock_t irqlock;
>> struct mtk_vcodec_ctx *curr_ctx;
>> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>> index 6e72d73..6dcae0a 100644
>> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
>> @@ -693,7 +693,8 @@ const struct v4l2_ioctl_ops mtk_venc_ioctl_ops = {
>> static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
>> unsigned int *nbuffers,
>> unsigned int *nplanes,
>> - unsigned int sizes[], void *alloc_ctxs[])
>> + unsigned int sizes[],
>> + struct device *alloc_devs[])
>> {
>> struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(vq);
>> struct mtk_q_data *q_data;
>> @@ -705,17 +706,13 @@ static int vb2ops_venc_queue_setup(struct vb2_queue *vq,
>> return -EINVAL;
>>
>> if (*nplanes) {
>> - for (i = 0; i < *nplanes; i++) {
>> + for (i = 0; i < *nplanes; i++)
>> if (sizes[i] < q_data->sizeimage[i])
>> return -EINVAL;
>> - alloc_ctxs[i] = ctx->dev->alloc_ctx;
>> - }
>> } else {
>> *nplanes = q_data->fmt->num_planes;
>> - for (i = 0; i < *nplanes; i++) {
>> + for (i = 0; i < *nplanes; i++)
>> sizes[i] = q_data->sizeimage[i];
>> - alloc_ctxs[i] = ctx->dev->alloc_ctx;
>> - }
>> }
>>
>> return 0;
>> @@ -1249,6 +1246,7 @@ int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
>> src_vq->mem_ops = &vb2_dma_contig_memops;
>> src_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
>> src_vq->lock = &ctx->dev->dev_mutex;
>> + src_vq->dev = &ctx->dev->plat_dev->dev;
>>
>> ret = vb2_queue_init(src_vq);
>> if (ret)
>> @@ -1262,6 +1260,7 @@ int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
>> dst_vq->mem_ops = &vb2_dma_contig_memops;
>> dst_vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
>> dst_vq->lock = &ctx->dev->dev_mutex;
>> + dst_vq->dev = &ctx->dev->plat_dev->dev;
>>
>> return vb2_queue_init(dst_vq);
>> }
>> diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>> index 06105e9..9c10cc2 100644
>> --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>> +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
>> @@ -357,14 +357,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
>> dev->vfd_enc = vfd_enc;
>> platform_set_drvdata(pdev, dev);
>>
>> - dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
>> - if (IS_ERR((__force void *)dev->alloc_ctx)) {
>> - mtk_v4l2_err("Failed to alloc vb2 dma context 0");
>> - ret = PTR_ERR((__force void *)dev->alloc_ctx);
>> - dev->alloc_ctx = NULL;
>> - goto err_vb2_ctx_init;
>> - }
>> -
>> dev->m2m_dev_enc = v4l2_m2m_init(&mtk_venc_m2m_ops);
>> if (IS_ERR((__force void *)dev->m2m_dev_enc)) {
>> mtk_v4l2_err("Failed to init mem2mem enc device");
>> @@ -401,8 +393,6 @@ err_enc_reg:
>> err_event_workq:
>> v4l2_m2m_release(dev->m2m_dev_enc);
>> err_enc_mem_init:
>> - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
>> -err_vb2_ctx_init:
>> video_unregister_device(vfd_enc);
>> err_enc_alloc:
>> v4l2_device_unregister(&dev->v4l2_dev);
>> @@ -426,8 +416,6 @@ static int mtk_vcodec_enc_remove(struct platform_device *pdev)
>> destroy_workqueue(dev->encode_workqueue);
>> if (dev->m2m_dev_enc)
>> v4l2_m2m_release(dev->m2m_dev_enc);
>> - if (dev->alloc_ctx)
>> - vb2_dma_contig_cleanup_ctx(dev->alloc_ctx);
>>
>> if (dev->vfd_enc)
>> video_unregister_device(dev->vfd_enc);
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-11 4:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-08 19:11 [PATCH 0/2] mtk-vcodec fixups Hans Verkuil
2016-07-08 19:11 ` [PATCH 1/2] mtk-vcodec: convert driver to use the new vb2_queue dev field Hans Verkuil
2016-07-11 3:48 ` tiffany lin
2016-07-11 4:00 ` Hans Verkuil
2016-07-08 19:11 ` [PATCH 2/2] drivers/media/platform/Kconfig: fix VIDEO_MEDIATEK_VCODEC dependency Hans Verkuil
2016-07-11 3:08 ` tiffany lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox