summaryrefslogtreecommitdiff
path: root/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
diff options
context:
space:
mode:
authorTiffany Lin <tiffany.lin@mediatek.com>2016-12-02 05:38:34 +0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-02-03 12:49:24 +0300
commit4865fffa834884ffc49a551bb3c7ac8a76e8585d (patch)
treeca8a6b1351a2173816eb87de722917fd0c773c4d /drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
parent974eadf1fc4f9bd0e9da686e7ba6c3e4e708fc45 (diff)
downloadlinux-4865fffa834884ffc49a551bb3c7ac8a76e8585d.tar.xz
[media] mtk-vcodec: use V4L2_DEC_CMD_STOP to implement flush
Also remove the code using size-0 OUTPUT buffer to flush. Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com> Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org> Reviewed-by: Kuang-che Wu <kcwu@chromium.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c')
-rw-r--r--drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
index d48287c727f4..4334b7394861 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
@@ -105,13 +105,21 @@ static int fops_vcodec_open(struct file *file)
{
struct mtk_vcodec_dev *dev = video_drvdata(file);
struct mtk_vcodec_ctx *ctx = NULL;
+ struct mtk_video_dec_buf *mtk_buf = NULL;
int ret = 0;
+ struct vb2_queue *src_vq;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
+ mtk_buf = kzalloc(sizeof(*mtk_buf), GFP_KERNEL);
+ if (!mtk_buf) {
+ kfree(ctx);
+ return -ENOMEM;
+ }
mutex_lock(&dev->dev_mutex);
+ ctx->empty_flush_buf = mtk_buf;
ctx->id = dev->id_counter++;
v4l2_fh_init(&ctx->fh, video_devdata(file));
file->private_data = &ctx->fh;
@@ -135,6 +143,10 @@ static int fops_vcodec_open(struct file *file)
ret);
goto err_m2m_ctx_init;
}
+ src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx,
+ V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
+ ctx->empty_flush_buf->vb.vb2_buf.vb2_queue = src_vq;
+ ctx->empty_flush_buf->lastframe = true;
mtk_vcodec_dec_set_default_params(ctx);
if (v4l2_fh_is_singular(&ctx->fh)) {
@@ -173,6 +185,7 @@ err_m2m_ctx_init:
err_ctrls_setup:
v4l2_fh_del(&ctx->fh);
v4l2_fh_exit(&ctx->fh);
+ kfree(ctx->empty_flush_buf);
kfree(ctx);
mutex_unlock(&dev->dev_mutex);
@@ -203,6 +216,7 @@ static int fops_vcodec_release(struct file *file)
v4l2_ctrl_handler_free(&ctx->ctrl_hdl);
list_del_init(&ctx->list);
+ kfree(ctx->empty_flush_buf);
kfree(ctx);
mutex_unlock(&dev->dev_mutex);
return 0;