Commit Graph

92 Commits

Author SHA1 Message Date
Ming Qian
c775386112 LF-13169-2: Revert "LF-13169: mxc: vpu: hantro_v4l2: avoid pollerr before sequence header parsed"
This reverts commit d95ba73844.

This workaround may fail some android case, the proper solution is that
parse drop the first Non-I frame in the beginning.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2024-10-21 14:46:19 +09:00
Ming Qian
0e79bc1aef LF-13695: mxc: vpu: hantro_v4l2: decoder support display delay
Use v4l2 ctrl V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE and
V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY to instead of private ctrl id
V4L2_CID_DIS_REORDER.

The range of V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY is [0, 0]

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-17 11:45:44 +09:00
Ming Qian
d95ba73844 LF-13169: mxc: vpu: hantro_v4l2: avoid pollerr before sequence header parsed
v4l2 m2m will report pollerr if both queue are off or empty,
before sequence header parsed, it's likely that the capture queue is not
on, if the first buffer doesn't contain sequence header, the output
queue may be empty if the buffer is consumed before more buffers queued,
then report pollerr and exit unexpectedly.

The beffer solution is that the parser can drop the non-I frames before
the first IDR frame.

This patch is a workaround only for hantro v4l2, as the driver implement
its own poll callback. that driver only report pollerr for both queue
empty case after the initial sequence header parsed.

Tested-by: Hou Qi <qi.hou@nxp.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-10-10 18:29:24 +09:00
Ming Qian
166bdb2afd LF-12804: mxc: vpu: hantro_v4l2: filter out unapplicable ctrl
some ctrl is only applicable for certain format, if the format is not
supported by vpu hardware, just filter out it.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-02 10:07:57 +09:00
Ming Qian
09840a7365 LF-12740-2: mxc: vpu: hantro_v4l2: fix some coverity issues
there are some coverity issues found in hantro_v4l2, try to fix them

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-02 10:07:56 +09:00
Ming Qian
89132a55ab LF-12740: mxc: vpu: hantro_v4l2: report performance statistics
report performance statistics via debugfs.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-07-02 10:07:55 +09:00
Ming Qian
de80eb0b4d LF-12696: mxc: vpu: hantro_v4l2: Report the average QP of current encoded frame
Report the average QP value of current encoded frame via the control
V4L2_CID_MPEG_VIDEO_AVERAGE_QP, the value applies to the last dequeued
capture buffer.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2024-07-02 10:07:54 +09:00
Ming Qian
8930b85188 MMFMWK-9372: mxc: vpu: hantro_v4l2: Filter out pollerr in source change
when reschange_notified is set, driver will prevent to stream on capture
queue, it likely make the both queue disable case in seek, can report
pollerr unexpectedly.

Tested-by: Hou Qi <qi.hou@nxp.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-28 18:03:22 +09:00
Ming Qian
fb4dfa9c07 MA-22342: mxc: vpu: hantro_v4l2: report pollerr if both queue are empty
For v4l2 m2m device, there has to be at least one buffer queued on each
queued_list, which means either in driver already or waiting for driver
to claim it and start processing.

hantro_v4l2 is m2m device, but it don't use the v4l2 m2m framework
directly, so just keep it consistent with v4l2 m2m poll. report pollerr
if output queue is empty and capture queue is empry or off.

Tested-by: Xu Mao <mao.xu@nxp.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-23 11:07:33 +09:00
TaoJiang
79db63ad79 LF-11969: vpu: hantro: open frame rc by default
Few users use the fixed qp mode
open frame level rate control feature by default
default rc mode is CBR

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
Reviewed-by: Ming Qian <ming.qian@nxp.com>
2024-04-11 12:07:26 +05:30
Ming Qian
3f7cb17fe9 LF-11467: mxc: vpu: hantro_v4l2: set last flag in source change event
For the first source change event, set last flag too, as android may
streamon capture before the first source change event. This allows users
to handle source change with consistent behavior

Tested-by: xiahong.bao <xiahong.bao@nxp.com>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2024-04-01 15:21:34 +09:00
Vladimir Oltean
3b28da2e17 vpu: hantro_v4l2: add build dependency on CONFIG_VIDEOBUF2_V4L2
CONFIG_VIDEOBUF2_V4L2 can be built as module and CONFIG_MXC_HANTRO_V4L2
can be built-in, which is a problem, because in that case, symbols
exported by the videobuf2-v4l2.ko module will not be available to the
built-in vsiv4l2 driver.

ld.lld: error: undefined symbol: vb2_poll
>>> referenced by vsi-v4l2-enc.c:1553 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:1553)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_poll) in archive vmlinux.a
>>> referenced by vsi-v4l2-enc.c:1554 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:1554)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_poll) in archive vmlinux.a
>>> referenced by vsi-v4l2-enc.c:1559 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:1559)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_poll) in archive vmlinux.a
>>> referenced 5 more times

ld.lld: error: undefined symbol: vb2_mmap
>>> referenced by vsi-v4l2-enc.c:0 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:0)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(v4l2_enc_mmap) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:0 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:0)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(v4l2_dec_mmap) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_dma_contig_memops
>>> referenced by vsi-v4l2-enc.c:1465 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:1465)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(v4l2_enc_open) in archive vmlinux.a
>>> referenced by vsi-v4l2-enc.c:1465 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:1465)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(v4l2_enc_open) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:1160 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:1160)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(v4l2_dec_open) in archive vmlinux.a
>>> referenced 1 more times

ld.lld: error: undefined symbol: vb2_queue_init
>>> referenced by vsi-v4l2-enc.c:1469 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:1469)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(v4l2_enc_open) in archive vmlinux.a
>>> referenced by vsi-v4l2-enc.c:1486 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:1486)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(v4l2_enc_open) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:1164 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:1164)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(v4l2_dec_open) in archive vmlinux.a
>>> referenced 1 more times

ld.lld: error: undefined symbol: vb2_streamon
>>> referenced by vsi-v4l2-dec.c:253 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:253)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_capture_on) in archive vmlinux.a
>>> referenced by vsi-v4l2-enc.c:0 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:0)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_streamon) in archive vmlinux.a
>>> referenced by vsi-v4l2-enc.c:661 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:661)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_encoder_cmd) in archive vmlinux.a
>>> referenced 2 more times

ld.lld: error: undefined symbol: vb2_buffer_done
>>> referenced by vsi-v4l2-dec.c:267 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:267)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_capture_on) in archive vmlinux.a
>>> referenced by vsi-v4l2-priv.h:587 (../drivers/mxc/hantro_v4l2/vsi-v4l2-priv.h:587)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(return_all_buffers) in archive vmlinux.a
>>> referenced by vsi-v4l2-priv.h:587 (../drivers/mxc/hantro_v4l2/vsi-v4l2-priv.h:587)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_streamoff) in archive vmlinux.a
>>> referenced 6 more times

ld.lld: error: undefined symbol: vb2_streamoff
>>> referenced by vsi-v4l2-dec.c:295 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:295)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_capture_off) in archive vmlinux.a
>>> referenced by vsi-v4l2-enc.c:380 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:380)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_streamoff) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:455 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:455)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_streamoff) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_ops_wait_prepare
>>> referenced by vsi-v4l2-enc.c:836 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:836)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_buf_wait_prepare) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:881 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:881)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_buf_wait_prepare) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_ops_wait_finish
>>> referenced by vsi-v4l2-enc.c:831 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:831)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_buf_wait_finish) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:876 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:876)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_buf_wait_finish) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_reqbufs
>>> referenced by vsi-v4l2-enc.c:86 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:86)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_reqbufs) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:85 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:85)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_reqbufs) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_querybuf
>>> referenced by vsi-v4l2-enc.c:228 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:228)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_querybuf) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:161 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:161)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_querybuf) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_qbuf
>>> referenced by vsi-v4l2-enc.c:0 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:0)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_qbuf) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:0 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:0)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_qbuf) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_expbuf
>>> referenced by vsi-v4l2-enc.c:479 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:479)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_expbuf) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:566 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:566)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_expbuf) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_dqbuf
>>> referenced by vsi-v4l2-enc.c:410 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:410)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_dqbuf) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:483 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:483)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_dqbuf) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_create_bufs
>>> referenced by vsi-v4l2-enc.c:111 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:111)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_create_bufs) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_prepare_buf
>>> referenced by vsi-v4l2-enc.c:458 (drivers/mxc/hantro_v4l2/vsi-v4l2-enc.c:458)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-enc.o:(vsi_enc_prepare_buf) in archive vmlinux.a
>>> referenced by vsi-v4l2-dec.c:545 (drivers/mxc/hantro_v4l2/vsi-v4l2-dec.c:545)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_prepare_buf) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_plane_vaddr
>>> referenced by vsi-v4l2-priv.h:610 (../drivers/mxc/hantro_v4l2/vsi-v4l2-priv.h:610)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2-dec.o:(vsi_dec_reqbufs) in archive vmlinux.a
>>> referenced by vsi-v4l2daemon.c:308 (drivers/mxc/hantro_v4l2/vsi-v4l2daemon.c:308)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2daemon.o:(getbusaddr) in archive vmlinux.a

ld.lld: error: undefined symbol: vb2_plane_cookie
>>> referenced by vsi-v4l2daemon.c:309 (drivers/mxc/hantro_v4l2/vsi-v4l2daemon.c:309)
>>>               drivers/mxc/hantro_v4l2/vsi-v4l2daemon.o:(getbusaddr) in archive vmlinux.a

To fix the build issue, force the hantro_v4l2 driver to be also built as
a module when videobuf2-v4l2 is a module

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2023-10-30 15:58:10 +08:00
Ming Qian
b2c14fbd62 LF-10193: vpu: hantro_v4l2: initiate a drain of the capture queue in dynamic resolution change
The last buffer from before the change must be marked with the
V4L2_BUF_FLAG_LAST flag, similarly to the Drain sequence above.

Initiate a drain of the capture queue in dynamic resolution change.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:10 +08:00
TaoJiang
2d1f680397 LF-9606: vpu: hantro: solve Uninitialized scalar variable issue
1.Coverity report this issue
2.initialize local variable

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:10 +08:00
TaoJiang
a356b8e1b0 LF-9585: vpu: hantro_v4l2: solve coverity issue
1.add return value check

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
TaoJiang
3b43b40c64 MMFMWK-9253: vpu: hantro: add mepg1 support
1.add mpeg1 v4l2 format and treat as mpeg2

Reviewed-by: Ming Qian <ming.qian@nxp.com>
Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
Ming Qian
e5b766161e LF-8969-3: mxc: hantro_v4l2: make vsi_v4l2_msg consistent for 64bit and 32bit
1.convert unsigned long to u64
2.convert pointer to u64, shouldn't use these property

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
Ming Qian
c93de73e56 LF-8969-2: mxc: hantro_v4l2: add compat_ioctl
call compat_ptr_ioctl directly

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
Ming Qian
bdc2867932 LF-8929: imx8m: vpu: encoder don't discard source frames after streamoff output
In v4l2 encoder spec,  any source frames queued to the OUTPUT queue
between V4L2_ENC_CMD_STOP and VIDIOC_STREAMOFF() will be discarded.

But we shouldn't discard frames after VIDIOC_STREAMOFF().

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: Hou Qi <qi.hou@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
Ming Qian
f05f82ce84 LF-8795-3: imx8m: mxc: vpu: get accurate rv fourcc
kernel has define 2 rv fourcc, rv30 and rv40.
but vpu only use one rv format.
so need to store the setting rv fourcc,
and report it in get_fmt().

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
Ming Qian
255777c17b LF-8795-2: imx8m: mxc: vpu: specify the format bit mask explicitly
driver use the format bit mask implicitly,
it use the index in array,
but there is 2 members for rv format,
then the index may led to some bug.

so specify format bit mask explicitly to avoid bug.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:09 +08:00
Zhou Peng
64c93a4203 arm64: imx8m: vpu: update class_create() usage
Cope with API change:
1aaba11da9 ("driver core: class: remove module * from class_create()")

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:08 +08:00
Ming Qian
92c6294706 LF-8795: imx8m: mxc: vpu: correct the realvideo fourcc
The realvideo comes in 4 incompatible flavours,
RV10/RV20/RV30/RV40 also known as RealVideo 1 / G2 / 8 / 9+10.

The fourcc V4L2_PIX_FMT_RV is inappropriate.
V4L2_PIX_FMT_RV30 and V4L2_PIX_FMT_RV40 has been upstreamed,

use the specific fourcc V4L2_PIX_FMT_RV30 and V4L2_PIX_FMT_RV40
instead of the inappropriate general fourcc V4L2_PIX_FMT_RV.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:08 +08:00
Ming Qian
cb121a7871 LF-8319: imx8m: vpu: allow user set a reasonable sizeimage for compressed format
the sizeimage calculated from width * height
may be too large,
android may not meet it, then fail the decoding.

to avoid such case, let user set a reason sizeimage

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: Ming Zhou <ming.zhou@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:08 +08:00
Ming Qian
d4f1325b07 MA-21001: imx8m: vpu: correct the unspecified color space
in the E.2.1 of Rec. ITU-T H.264 (06/2019),
0 of cloour primaries is reserved, and 2 is unspecified.
driver can map V4L2_COLORSPACE_LAST to 0,
and map V4L2_COLORSPACE_DEFAULT to 2.

v4l2_xfer_func and v4l2_ycbcr_encoding are similar case.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:08 +08:00
Ming Qian
7f6d5dea8b LF-7524: imx8m: vpu: clear the last_buffer_dequeued flag when capture streamoff and streamon
The last_buffer_dequeued flag will be cleared
in vb2_streamoff() automatically,
but there are two cases that may led to this flag not cleared,
it may fail some android cts testcase

so driver clear this flag manually
when capture streamoff and streamon

Signed-off-by: Ming Qian <ming.qian@nxp.com>
2023-10-30 15:58:08 +08:00
Ming Qian
14e8cfa3f4 LF-7236-3: imx8m: vpu: don't return EPOLLERR if qbuf isn't called
disable quirk_poll_must_check_waiting_for_buffers,
this quirk check only affect capture queue,
and it's set by V4L2 for backwards compatibility reasons.

But it's not used for m2m device, the vpu decoder is
m2m device, but not implement using m2m helper function.

just keep consistent with the m2m implementation

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: xiahong.bao <xiahong.bao@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:07 +08:00
Ming Qian
ef52118abf LF-7290: imx8m: vpu: wakeup poll and return epipe if only enqueue invalid codec config data
the eos event is deprecated,
if the error occurs during parsing sequence header,
driver can wakeup the poll waiting,
and set last_buffer_dequeued,
then the client can get the errno "-EPIPE"

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Tested-by: Xu Mao <mao.xu@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:07 +08:00
Ming Qian
9ae61edf99 LF-7236-2: imx8m: vpu: handle seek first, then source change
if source change event is triggered during seek,
handle seek first,
it requires that the capture streamoff and on
for seek and source change separately

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
Tested-by: xiahong.bao <xiahong.bao@nxp.com>
2023-10-30 15:58:07 +08:00
Ming Qian
b8a5eb008f LF-7236-1: imx8m: vpu: return the queued buffer before source change
if source change event is not received,
driver will prevent streamon capture really,
if do seek in this case, return the queued but not actived buffer.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
Tested-by: xiahong.bao <xiahong.bao@nxp.com>
2023-10-30 15:58:07 +08:00
Ming Qian
8a24c0e5ec LF-7019: imx8m: vpu: report video full range if colour_description_present_flag is false
In H264/H265 spec, the video_full_range_flag is not controlled
by colour_description_present_flag,

so if colour_description_present_flag is false,
the sequence header still may report the video_full_range_flag

and when the video_full_range_flag syntax element is not present,
the value of video_full_range_flag shall be inferred to be equal to 0.

so when sequence header is found, report the parsed video_full_range_flag

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:07 +08:00
Dong Aisheng
375521a8f5 arm64: imx8m: vpu: hantro_v4l2: drop 'elems' argument from control type ops
Coping with upstream changes:
cd75981ec9 ("media: v4l2-ctrls: drop 'elems' argument from control type ops.")

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
2023-10-30 15:58:07 +08:00
Zhou Peng
b5ccf8d426 LF-7138: arm64: imx8m: vpu: fix build issue caused by v4l2_ctrl_type_ops.init changed
init function defined in v4l2_ctrl_type_ops is changed
need to initialize elements[from_idx..end_idx] instead of element[idx]

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:07 +08:00
Zhou Peng
914a53fda7 LF-7016-1: arm64: imx8m: vpu: change file mode to 644
Change file mode to 644 to comply with community rule.

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
979d3f86bf LF-6690-4:imx8m:vpu: simplify the calculation of sizeimage
refine the function verifyPlanesize

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
0ecee32ccb LF-6690-3: imx8m: vpu: recalculate sizeimage after source change
when daemon report source change event to driver,
driver need recalculate the sizeimage

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
Tested-by: Ming Zhou <ming.zhou@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
2f698fdb27 MA-20476: imx8m:vpu: clear resolution change count when reset decoder
driver will prevert to enqueue capture buffer to daemon
if resolution change is never received,
after reset decoder, driver needs to clear the resolution change count
to prevert to enqueue capture buffer to daemon.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
c3d0847a58 LF-6690-2:imx8m:vpu: correct the sizeimage of nv16 and nv24
Add the missing sizeiamge of chroma

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
595131cf0e LF-6697: imx8m: vpu: calculate default bytesperline according pixel format
Driver use the width as the default bytesperline,
no matter what pixel format is.
The it requires the user set correct bytesperline,
if not, some error occurs.

Add some protection in driver that
calculating default bytesperline according format and width

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
c7d1f7cbe5 LF-6691: imx8m: vpu: correct V4L2_XFER_FUNC_LINEAR to V4L2_XFER_FUNC_NONE
V4L2 has defined V4L2_XFER_FUNC_NONE for linear transfer characteristics

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
6d055781ff LF-6690: imx8m: vpu_enc: support contiguous and non contiguous formats
To be compatible with Android, driver need to support contiguous formats,
and the encoder can support non contiguous formats,
so support contiguous  and non contiguous formats in the same time.

Support NV12 NV12M YUV420 YUV420M NV21 NV21M.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
TaoJiang
6d5e1defb7 LF6570: IMX8M VPU:solve fps setting error
1.move fps setting to output queue

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
TaoJiang
6c4c9ad4f5 LF6572: IMX8M VPU:solve mult-instance test fail
1.add invoke timeout

Signed-off-by: TaoJiang <tao.jiang_2@nxp.com>
2023-10-30 15:58:06 +08:00
Ming Qian
207ea61956 LF-6451: imx8m: vpu_enc: correct the pixel format for non contiguous formats
For the format that has non contiguous planes,
we should use the non contiguous format.

use V4L2_PIX_FMT_NV12M instead of V4L2_PIX_FMT_NV12
use V4L2_PIX_FMT_YUV420M instead of V4L2_PIX_FMT_YUV420
use V4L2_PIX_FMT_NV21M instead of V4L2_PIX_FMT_NV21

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:05 +08:00
Ming Qian
f1db9be8ba LF-6130: imx8m: vpu_dec: call poll_wait on the first invocation
vsi_dec_capture_on will be called after source change event.
so if user poll on capture queue before it's really stream on,
the poll will wait until timeout.

call poll_wait on the first invocation
on all the potential queues of interest

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:05 +08:00
Ming Qian
d0502afc87 LF-5945-2: imx8m: vpu_dec: remove check reschange in driver
after daemon send reschange event to driver,
it requires driver to send captureon cmd to it,
otherwise it keeps waiting.
we add this check to compatible with ffmpeg.
if the source change event is handled by capture streamon
or start cmd,
driver can always notify userspace a source change event.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:05 +08:00
Ming Qian
e90a04ddda LF-5945: LF-5924: imx8m: vpu_dec: report source change event when bit depth is changed
Driver will report all possible format in enum_fmt
before source change event,
so client may choose the 10bit format, for example nv12_10le.
but if the stream is 8bit, when the sequence header is parsed,
only 8 bit format is supported,
so need to send source change event to client,
then client can setup capture with 8bit format.

If the source change event is missed, the result may be unexpected

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:05 +08:00
Ming Qian
cffc762540 LF-5924: imx8m: vpu_dec: set last flag before buffer done
the flag V4L2_BUF_FLAG_LAST should be set before vb2_buffer_done,
v4l2 core can set the last_buffer_dequeued to the vb2_queue,
then any attempt to dequeue more CAPTURE buffers beyond the buffer
marked with V4L2_BUF_FLAG_LAST will result in a -EPIPE error
from VIDIOC_DQBUF().

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou>
2023-10-30 15:58:05 +08:00
Ming Qian
ec7a74daaa LF-5776-2 imx8m: vpu_dec: correct the sizeimage of format rfc and rcfx
If VP9 decoding caputre format is 'RFC0', the capture buffer needs contain
luma_table and chroma_table, so correct the sizeimage of format rfc and
rcfx.
Driver can't use the sizeimage reported by daemon directly,
as daemon report the sizeimage according bit depth, not format,
so the reported sizeimage maybe inaccuracy.

Besides, driver need to notify source change event if daemon has
stream on the capture.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: Zhou Peng <eagle.zhou>
2023-10-30 15:58:05 +08:00
Zhou Peng
5ab64d1300 mxc: vpu : kconfig: replace VIDEO_V4L2 with VIDEO_DEV
In the latest kernel, VIDEO_V4L2 was merged with VIDEO_DEV
So change Kconfig for hantro

Signed-off-by: Zhou Peng <eagle.zhou@nxp.com>
2023-10-30 15:58:05 +08:00