linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: mediatek: vcodec: Skip SOURCE_CHANGE & EOS events for stateless
@ 2022-06-20  6:33 Chen-Yu Tsai
  2022-06-21 14:22 ` Nicolas Dufresne
  2022-06-23  9:22 ` AngeloGioacchino Del Regno
  0 siblings, 2 replies; 3+ messages in thread
From: Chen-Yu Tsai @ 2022-06-20  6:33 UTC (permalink / raw)
  To: Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab, Hans Verkuil
  Cc: Chen-Yu Tsai, linux-media, linux-mediatek, linux-kernel,
	Nicolas Dufresne, AngeloGioacchino Del Regno, Yunfei Dong

The stateless decoder API does not specify the usage of SOURCE_CHANGE
and EOF events. These events are used by stateful decoders to signal
changes in the bitstream. They do not make sense for stateless decoders.

Do not handle subscription for these two types of events for stateless
decoder instances. This fixes the last v4l2-compliance error:

Control ioctls:
		fail: v4l2-test-controls.cpp(946): have_source_change || have_eos
	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL

Fixes: 8cdc3794b2e3 ("media: mtk-vcodec: vdec: support stateless API")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---

This should apply cleanly on next-20220617. The other media patches I
have on my branch:

media: mediatek: vcodec: Initialize decoder parameters after getting dec_capability
media: mediatek: vcodec: Fix non subdev architecture open power fail

should not interfere, though the second is required for proper operation
of the decoder on MT8183.

 drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
index 62f29b6fa104..a5fbc0a1c6bc 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
@@ -234,6 +234,11 @@ static int vidioc_vdec_querycap(struct file *file, void *priv,
 static int vidioc_vdec_subscribe_evt(struct v4l2_fh *fh,
 				     const struct v4l2_event_subscription *sub)
 {
+	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
+
+	if (ctx->dev->vdec_pdata->uses_stateless_api)
+		return v4l2_ctrl_subscribe_event(fh, sub);
+
 	switch (sub->type) {
 	case V4L2_EVENT_EOS:
 		return v4l2_event_subscribe(fh, sub, 2, NULL);
-- 
2.36.1.476.g0c4daa206d-goog


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

* Re: [PATCH] media: mediatek: vcodec: Skip SOURCE_CHANGE & EOS events for stateless
  2022-06-20  6:33 [PATCH] media: mediatek: vcodec: Skip SOURCE_CHANGE & EOS events for stateless Chen-Yu Tsai
@ 2022-06-21 14:22 ` Nicolas Dufresne
  2022-06-23  9:22 ` AngeloGioacchino Del Regno
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Dufresne @ 2022-06-21 14:22 UTC (permalink / raw)
  To: Chen-Yu Tsai, Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab,
	Hans Verkuil
  Cc: linux-media, linux-mediatek, linux-kernel,
	AngeloGioacchino Del Regno, Yunfei Dong

Le lundi 20 juin 2022 à 14:33 +0800, Chen-Yu Tsai a écrit :
> The stateless decoder API does not specify the usage of SOURCE_CHANGE
> and EOF events. These events are used by stateful decoders to signal
> changes in the bitstream. They do not make sense for stateless decoders.
> 
> Do not handle subscription for these two types of events for stateless
> decoder instances. This fixes the last v4l2-compliance error:
> 
> Control ioctls:
> 		fail: v4l2-test-controls.cpp(946): have_source_change || have_eos
> 	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
> 
> Fixes: 8cdc3794b2e3 ("media: mtk-vcodec: vdec: support stateless API")
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>

Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

> ---
> 
> This should apply cleanly on next-20220617. The other media patches I
> have on my branch:
> 
> media: mediatek: vcodec: Initialize decoder parameters after getting dec_capability
> media: mediatek: vcodec: Fix non subdev architecture open power fail
> 
> should not interfere, though the second is required for proper operation
> of the decoder on MT8183.
> 
>  drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
> index 62f29b6fa104..a5fbc0a1c6bc 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c
> @@ -234,6 +234,11 @@ static int vidioc_vdec_querycap(struct file *file, void *priv,
>  static int vidioc_vdec_subscribe_evt(struct v4l2_fh *fh,
>  				     const struct v4l2_event_subscription *sub)
>  {
> +	struct mtk_vcodec_ctx *ctx = fh_to_ctx(fh);
> +
> +	if (ctx->dev->vdec_pdata->uses_stateless_api)
> +		return v4l2_ctrl_subscribe_event(fh, sub);
> +
>  	switch (sub->type) {
>  	case V4L2_EVENT_EOS:
>  		return v4l2_event_subscribe(fh, sub, 2, NULL);


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

* Re: [PATCH] media: mediatek: vcodec: Skip SOURCE_CHANGE & EOS events for stateless
  2022-06-20  6:33 [PATCH] media: mediatek: vcodec: Skip SOURCE_CHANGE & EOS events for stateless Chen-Yu Tsai
  2022-06-21 14:22 ` Nicolas Dufresne
@ 2022-06-23  9:22 ` AngeloGioacchino Del Regno
  1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-06-23  9:22 UTC (permalink / raw)
  To: Chen-Yu Tsai, Tiffany Lin, Andrew-CT Chen, Mauro Carvalho Chehab,
	Hans Verkuil
  Cc: linux-media, linux-mediatek, linux-kernel, Nicolas Dufresne, Yunfei Dong

Il 20/06/22 08:33, Chen-Yu Tsai ha scritto:
> The stateless decoder API does not specify the usage of SOURCE_CHANGE
> and EOF events. These events are used by stateful decoders to signal
> changes in the bitstream. They do not make sense for stateless decoders.
> 
> Do not handle subscription for these two types of events for stateless
> decoder instances. This fixes the last v4l2-compliance error:
> 
> Control ioctls:
> 		fail: v4l2-test-controls.cpp(946): have_source_change || have_eos
> 	test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
> 
> Fixes: 8cdc3794b2e3 ("media: mtk-vcodec: vdec: support stateless API")
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

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

end of thread, other threads:[~2022-06-23  9:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20  6:33 [PATCH] media: mediatek: vcodec: Skip SOURCE_CHANGE & EOS events for stateless Chen-Yu Tsai
2022-06-21 14:22 ` Nicolas Dufresne
2022-06-23  9:22 ` AngeloGioacchino Del Regno

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).