Integrate meta-seco-imx/linux-seco-imx/seco_lf-5.10.y-mx8q_vpu
Integrate linux-seco-imx/seco_lf-5.10.y-mx8q_vpu
--
LF-5850-3: mxc: vpu_windsor: fix a coverity issue of untrusted pointer read
when use some untrusted pointer read, need to check before use.
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng <eagle.zhou>
--
LF-5679: mxc: vpu_windsor: append an empty last buffer on eos
In previous, vpu windsor encoder append an last buffer that contains the end of sequence (00 00 01 0a), and calculated a timestamp according the framerate.
But it confuse with the gstreamer, gstreamer don't want to get a unknown timestamp, and don't want to get an extra frame buffer but an empyt last buffer.
So driver append an empty last buffer on eos, and set last frame's timestamp
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Shijie Qin shijie.qin@nxp.com
--
MA-20005-14 vpu_encoder_mu: Fix build error exposed by -Wtautological-pointer-compare
Fix below build error: drivers/mxc/vpu_windsor/vpu_encoder_mu.c:38:17: error: comparison of address of 'core_dev->mu_msg_fifo' equal to a null pointer is always false [-Werror,-Wtautological-pointer-compare] if (&core_dev->mu_msg_fifo == NULL) { ~~~~~~~~~~^~~~~~~~~~~ ~~~~
Signed-off-by: Jindong Yue jindong.yue@nxp.com Reviewed-by: Shijie Qin shijie.qin@nxp.com
--
LF-4833 arm64: imx8q vpu: encoder handle yuv bytesperline correctly
vpu allow user set bytesperline larger than width, but driver fix it to width in previous. fix this bug, encoder can support more cases.
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Shijie Qin shijie.qin@nxp.com
--
LF-6212: mxc: vpu_malone: avoid kernel panic in alloc_dma_buffer
The call trace show the kernel panic occurs in memset_io. Seems dma_alloc_coherent() return an error code on fail instead of NULL.
So we use the IS_ERR_OR_NULL to check the return value.
But it's strangely as the document has described the function dma_alloc_coherent returns a pointer to the allocated region (in the processor's virtual address space) or NULL if the allocation failed.
2022-05-24T04:06:15 [ 745.193344] Unable to handle kernel paging request at virtual address ffffffffffffffe8 2022-05-24T04:06:15 [ 745.201296] Mem abort info: 2022-05-24T04:06:15 [ 745.204101] ESR = 0x86000004 2022-05-24T04:06:15 [ 745.207161] EC = 0x21: IABT (current EL), IL = 32 bits 2022-05-24T04:06:15 [ 745.212503] SET = 0, FnV = 0 2022-05-24T04:06:15 [ 745.215596] EA = 0, S1PTW = 0 2022-05-24T04:06:15 [ 745.218740] FSC = 0x04: level 0 translation fault 2022-05-24T04:06:15 [ 745.224070] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000000081b03000 2022-05-24T04:06:15 [ 745.231018] [ffffffffffffffe8] pgd=0000000000000000, p4d=0000000000000000 2022-05-24T04:06:15 [ 745.237851] Internal error: Oops: 86000004 [#1] PREEMPT SMP 2022-05-24T04:06:16 [ 745.287814] Hardware name: Freescale i.MX8QM MEK (DT) 2022-05-24T04:06:16 [ 745.292862] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) 2022-05-24T04:06:16 [ 745.299819] pc : 0xffffffffffffffe8 2022-05-24T04:06:16 [ 745.303303] lr : alloc_dma_buffer+0x5c/0xdc 2022-05-24T04:06:16 [ 745.307499] sp : ffff80001686ba50 2022-05-24T04:06:16 [ 745.310809] x29: ffff80001686ba50 x28: ffff00081e934008 x27: 0000000000000000 2022-05-24T04:06:16 [ 745.317950] x26: ffff00081e934680 x25: ffff00081e934900 x24: ffff00081e935000 2022-05-24T04:06:16 [ 745.325091] x23: ffff800009d3b5b0 x22: ffff0008197d9800 x21: fffffffffffff9b0 2022-05-24T04:06:16 [ 745.332233] x20: ffff00081e934000 x19: ffff00081e935db0 x18: 0000000000000000 2022-05-24T04:06:16 [ 745.339374] x17: 0000000000002000 x16: fffffc00010fffc8 x15: 0000000000000001 2022-05-24T04:06:16 [ 745.346515] x14: 0000000000000002 x13: 00000000000c5a87 x12: ffff0008ff4458c0 2022-05-24T04:06:16 [ 745.353656] x11: ffff0008f95f9668 x10: fffffc0020453a08 x9 : 0000000000000000 2022-05-24T04:06:16 [ 745.360797] x8 : ffff80001c8be000 x7 : 0000000000000000 x6 : 000000000000003f 2022-05-24T04:06:16 [ 745.367938] x5 : 0000000000000040 x4 : 0000000000000000 x3 : ffff80001c8be000 2022-05-24T04:06:16 [ 745.375079] x2 : 0000000000c00000 x1 : 0000000000000000 x0 : ffff80001c5ef198 2022-05-24T04:06:16 [ 745.382221] Call trace: 2022-05-24T04:06:16 [ 745.384662] 0xffffffffffffffe8 2022-05-24T04:06:16 [ 745.387798] vpu_buf_queue+0x314/0x580 2022-05-24T04:06:16 [ 745.391551] __enqueue_in_driver+0x3c/0x6c 2022-05-24T04:06:16 [ 745.395651] vb2_core_qbuf+0x44c/0x5a0 2022-05-24T04:06:16 [ 745.399396] vb2_qbuf+0x94/0xf0 2022-05-24T04:06:16 [ 745.402532] v4l2_ioctl_qbuf+0x1a4/0x29c 2022-05-24T04:06:16 [ 745.406450] v4l_qbuf+0x48/0x60 2022-05-24T04:06:16 [ 745.409586] __video_do_ioctl+0x178/0x3dc 2022-05-24T04:06:16 [ 745.413591] video_usercopy+0x374/0x6a0 2022-05-24T04:06:16 [ 745.417422] video_ioctl2+0x18/0x24 2022-05-24T04:06:16 [ 745.420906] v4l2_ioctl+0x44/0x64 2022-05-24T04:06:16 [ 745.424216] __arm64_sys_ioctl+0xa8/0xf0 2022-05-24T04:06:16 [ 745.428142] invoke_syscall+0x48/0x114 2022-05-24T04:06:16 [ 745.431895] el0_svc_common.constprop.0+0xd4/0xfc 2022-05-24T04:06:16 [ 745.436595] do_el0_svc+0x28/0x90 2022-05-24T04:06:16 [ 745.439905] el0_svc+0x34/0xb0 2022-05-24T04:06:16 [ 745.442955] el0t_64_sync_handler+0xa4/0x130 2022-05-24T04:06:16 [ 745.447220] el0t_64_sync+0x18c/0x190 2022-05-24T04:06:16 [ 745.450884] Code: bad PC value 2022-05-24T04:06:16 [ 745.453940] ---[ end trace 0000000000000000 ]--- 2022-05-24T04:06:16 [ 745.458550] Kernel panic - not syncing: Oops: Fatal exception 2022-05-24T04:06:16 [ 745.464292] SMP: stopping secondary CPUs
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng eagle.zhou@nxp.com
--
LF-5876-2: mxc: vpu_malone: wake up when error occurs
when error occurs, driver set error flag, and driver need to wake up the poll wait
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng eagle.zhou@nxp.com
--
MA-20244: mxc: vpu_malone: don't prevent to enqueue input frame
in past, we use vpu_frm_depth to control the input frame count, to make sure the count is no more than 256. but we have kept the buffer until it's decoded, and the buffer count is no more than 32, so we don't need to prevent to enqueue input frame. besides, the frm_dec_delay is not accuracy if there are some frames skiped, so remove the unused variable
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng eagle.zhou@nxp.com
--
LF-5962-2: mxc: vpu_malone: adjust some warning log
add macro vpu_warn output firmware version only once
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng eagle.zhou@nxp.com
--
LF-5962: mxc: vpu_malone: disable timestamp manager by default
driver can propagate timestamp from output buffer to capture buffer directly.
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng eagle.zhou@nxp.com
--
MA-20218: mxc: vpu_malone: return the buffer with cocdecdata flag
the buffer with cocdecdata flag, driver will merge it to the next frame. so it needs to be released when the next frame is done.
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng <eagle.zhou>
--
LF-5901: mxc: vpu_malone: add a picture skipped event
if the frame can't be decoded, and be skipped, firmware can send a skipped event to driver, then driver can return this buffer with an error flag.
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng <eagle.zhou>
--
LF-5850-2: mxc: vpu_malone: fix a coverity issue of untrusted pointer read
when use some untrusted pointer read, need to check before use.
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng <eagle.zhou>
--
LF-5850: mxc: vpu_malone: fix a coverity issue of uninitialized scalar variable
the timestamp may be uninitialized in picture decoded
Signed-off-by: Ming Qian ming.qian@nxp.com Reviewed-by: Zhou Peng <eagle.zhou>
--
LF-5880: mxc: vpu_malone: don't set last_buffer_dequeued if queue is not streaming
in android cts, sometimes the capture streamoff may be called before eos, so driver may set the last_buffer_dequeued when the capture queue is not streaming, then after streamon, dqbuf will always return -EPIPE.
Signed-off-by: Ming Qian ming.qian@nxp.com
--
LF-5879: mxc: vpu_malone: reduce decoder output buffer count
driver report min buffers for output to 16, this number is too conservative, we can reduce it to 8.
Signed-off-by: Ming Qian ming.qian@nxp.com
--
LF-5876: mxc: vpu_malone: set error for unsupported stream
For unsupported stream, in previous, driver only send a V4L2_EVENT_CODEC_ERROR event, but this event is our custom, client may not handle it, such as gstreamer. so set error and trigger a pollerr event, then client can exit without hang.
Signed-off-by: Ming Qian ming.qian@nxp.com
--
LF-5664-2 mxc: vpu_malone: fix build warning about camparison of distinct pointer types
Fixed build warning about 'comparison of distinct pointer types lacks a cast' when use clamp.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-5664 mxc: vpu_malone: update capture format when set output in the initial
Driver need update capture format when set output, otherwise, gstreamer will get wrong resolution on capture at beginning, which will lead to driver send source change event and do unexpected capture streamoff/on operations.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-5663 mxc: vpu_malone: set last_buffer_dequeued to notify decoding finished
Application may not subscribe 'V4L2_EVENT_EOS', set last_buffer_dequeued for capture vb2_queue to notify decoding finished.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-5644-4 mxc: vpu_malone: add module_param to disable time stamp manager
There is a timestamp manager in firmware, so in previous, the timestamp of capture vb2_buffer is got from firmware. Add a module_param 'vpu_tsm_ena' to enable/disable this function. If disable it, copy timestamp from output to capture.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-5644-3 mxc: vpu_malone: add valid output/capture v4l2_buffer sequence
Normally, sequence is monotonically increasing, if capture sequence is no consecutive that means there has decoded frame be dropped in vpu.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-5644-2 mxc: vpu_malone: return output v4l2_buffer with 'V4L2_BUF_FLAG_ERROR' if it no decoded frame
If no decoded frame output for current bitstream buffer, return output v4l2_buffer with 'V4L2_BUF_FALG_ERROR' to notify user.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-5644-1 mxc: vpu_malone: implement 'V4L2_CID_MIN_BUFFERS_FOR_OUTPUT' ioctrl
Implment 'V4L2_CID_MIN_BUFFERS_FOR_OUTPUT' ioctl to better support frame mode.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-5604 mxc: vpu_malone: handle invalid timestamp which tv_sec or tv_usec is negative
If tv_usec is negative, which convert to u32 is a big positive value, thus will confusing timestamp manager. Use 'V4L2_NXP_BUF_FLAG_TIMESTAMP_INVALID' to idicate such invalid timestamp which tv_sec or tv_usec is negative.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-4968-2 mxc: vpu_malone: handle source change for special case
Cover different client work flow of handle twice continuous source change event: Case 1(unit test): capture port work flow is streamon then queue all free capture buffer, hence, will clear wait_res_change_done incorrectly on first source change. Solution: move the check to capture streamon().
Case 2(Codec2) might only do cature streamon one time. Solution: add workaround to wait previous source change completed when receive new resolution, up to wait 2s for worst case.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-4968 mxc: vpu_malone: guarantee wait source change completed
Some stream might occurs twice continuous source change event quickly, previously, driver will wait at most 1s for first time sour change, but 1s might not enough, then will skip wait_res_change_done one times and do abort during source change period.
In order to guarantee each wait source change completed, clear wait_res_change_done until 'res_change_done_count == res_change_send_count'. And then wait source change done at receive seq_info is reduntant.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com
--
LF-4737 mxc: vpu_malone: directly return eos event if receive stop cmd but no stream buffer input
If receive stop cmd but no stream buffer input, there no actual task need driver/firmware to do, thus directly return eos event to user.
Signed-off-by: Shijie Qin shijie.qin@nxp.com Reviewed-by: ming_qian ming.qian@nxp.com