linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: mediatek: vcodec: Initialize decoder parameters for each instance
@ 2022-07-04  8:49 Chen-Yu Tsai
  2022-07-08  5:35 ` yunfei.dong
  0 siblings, 1 reply; 2+ messages in thread
From: Chen-Yu Tsai @ 2022-07-04  8:49 UTC (permalink / raw)
  To: Tiffany Lin, Andrew-CT Chen, Yunfei Dong, Mauro Carvalho Chehab,
	Hans Verkuil
  Cc: Chen-Yu Tsai, linux-media, linux-kernel, linux-mediatek,
	Matthias Brugger

The decoder parameters are stored in each instance's context data. This
needs to be initialized per-instance, but a previous fix incorrectly
changed it to only be initialized for the first opened instance. This
resulted in subsequent instances not correctly signaling the requirement
for the Requests API.

Fix this by calling the initializing function outside of the
v4l2_fh_is_singular() conditional block.

Fixes: faddaa735c20 ("media: mediatek: vcodec: Initialize decoder parameters after getting dec_capability")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
This was found during backport of mtk-vcodec patches onto the ChromeOS
v5.10 kernel, which caused one of our tests that does multiple concurrent
decodes to fail, as some decoder instances didn't have their
requires_requests and supports_requests flags marked correctly.
Evidently my previous testing of culprit patch was not thorough enough.

This fixes commit faddaa735c20 ("media: mediatek: vcodec: Initialize decoder
parameters after getting dec_capability") in the media stage repo. This
could either be queued up after it, or squashed into it.

 drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
index 55dffb61e58c..e0b6ae9d6caa 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
@@ -208,11 +208,12 @@ static int fops_vcodec_open(struct file *file)
 
 		dev->dec_capability =
 			mtk_vcodec_fw_get_vdec_capa(dev->fw_handler);
-		ctx->dev->vdec_pdata->init_vdec_params(ctx);
 
 		mtk_v4l2_debug(0, "decoder capability %x", dev->dec_capability);
 	}
 
+	ctx->dev->vdec_pdata->init_vdec_params(ctx);
+
 	list_add(&ctx->list, &dev->ctx_list);
 
 	mutex_unlock(&dev->dev_mutex);
-- 
2.37.0.rc0.161.g10f37bed90-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: mediatek: vcodec: Initialize decoder parameters for each instance
  2022-07-04  8:49 [PATCH] media: mediatek: vcodec: Initialize decoder parameters for each instance Chen-Yu Tsai
@ 2022-07-08  5:35 ` yunfei.dong
  0 siblings, 0 replies; 2+ messages in thread
From: yunfei.dong @ 2022-07-08  5:35 UTC (permalink / raw)
  To: Chen-Yu Tsai, Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab,
	Hans Verkuil
  Cc: linux-media, linux-kernel, linux-mediatek, Matthias Brugger

Hi Chen-Yu,

Thanks for your patch.

Reviewed-by: Yunfei Dong <yunfei.dong@mediatek.com>

Best Regards,
Yunfei Dong

On Mon, 2022-07-04 at 16:49 +0800, Chen-Yu Tsai wrote:
> The decoder parameters are stored in each instance's context data.
> This
> needs to be initialized per-instance, but a previous fix incorrectly
> changed it to only be initialized for the first opened instance. This
> resulted in subsequent instances not correctly signaling the
> requirement
> for the Requests API.
> 
> Fix this by calling the initializing function outside of the
> v4l2_fh_is_singular() conditional block.
> 
> Fixes: faddaa735c20 ("media: mediatek: vcodec: Initialize decoder
> parameters after getting dec_capability")
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> This was found during backport of mtk-vcodec patches onto the
> ChromeOS
> v5.10 kernel, which caused one of our tests that does multiple
> concurrent
> decodes to fail, as some decoder instances didn't have their
> requires_requests and supports_requests flags marked correctly.
> Evidently my previous testing of culprit patch was not thorough
> enough.
> 
> This fixes commit faddaa735c20 ("media: mediatek: vcodec: Initialize
> decoder
> parameters after getting dec_capability") in the media stage repo.
> This
> could either be queued up after it, or squashed into it.
> 
>  drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git
> a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
> b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
> index 55dffb61e58c..e0b6ae9d6caa 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c
> @@ -208,11 +208,12 @@ static int fops_vcodec_open(struct file *file)
>  
>  		dev->dec_capability =
>  			mtk_vcodec_fw_get_vdec_capa(dev->fw_handler);
> -		ctx->dev->vdec_pdata->init_vdec_params(ctx);
>  
>  		mtk_v4l2_debug(0, "decoder capability %x", dev-
> >dec_capability);
>  	}
>  
> +	ctx->dev->vdec_pdata->init_vdec_params(ctx);
> +
>  	list_add(&ctx->list, &dev->ctx_list);
>  
>  	mutex_unlock(&dev->dev_mutex);


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-08  5:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04  8:49 [PATCH] media: mediatek: vcodec: Initialize decoder parameters for each instance Chen-Yu Tsai
2022-07-08  5:35 ` yunfei.dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).