media: amphion: defer setting last_buffer_dequeued until resolution changes are processed
authorMing Qian <ming.qian@nxp.com>
Tue, 28 Jun 2022 05:21:12 +0000 (06:21 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 8 Jul 2022 17:13:03 +0000 (18:13 +0100)
commitafba6e20801ad9a2f863c52c21e609e021269d83
treeab8b0edd80933806384e34443a03e84f1337884c
parentfe3d651627d61210c6905339e5281d3b9db75033
media: amphion: defer setting last_buffer_dequeued until resolution changes are processed

Don't set last_buffer_dequeued during dynamic resolution change,
otherwise it may be cleared in handling resolution change,
as streamoff may be called in dynamic resolution change.

Normally, this does not happen.
But we encounter a special testcase,
User issue V4L2_DEC_CMD_STOP after enqueue one buffer
that only contains codec config header, but not any frame data.
So VPU report the parsed resolution, then report the eos event.

So driver should notify user to handle resolution change first,
after it's handled, set the last_buffer_dequeued.
then the user can exit decoding normally.

Otherwise the user may be stalled.

Fixes: 6de8d628df6ef ("media: amphion: add v4l2 m2m vpu decoder stateful driver")
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/amphion/vdec.c
drivers/media/platform/amphion/vpu_v4l2.c