> -----Original Message----- > From: Nicolas Dufresne [mailto:nicolas@xxxxxxxxxxxx] > Sent: Thursday, September 23, 2021 10:40 PM > To: Ming Qian <ming.qian@xxxxxxx>; mchehab@xxxxxxxxxx; > shawnguo@xxxxxxxxxx; robh+dt@xxxxxxxxxx; s.hauer@xxxxxxxxxxxxxx > Cc: hverkuil-cisco@xxxxxxxxx; kernel@xxxxxxxxxxxxxx; festevam@xxxxxxxxx; > dl-linux-imx <linux-imx@xxxxxxx>; Aisheng Dong <aisheng.dong@xxxxxxx>; > linux-media@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; > devicetree@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx > Subject: [EXT] Re: [PATCH v9 06/13] media: amphion: add vpu v4l2 m2m > support > > Caution: EXT Email > > Le lundi 13 septembre 2021 à 17:11 +0800, Ming Qian a écrit : > > vpu_v4l2.c implements the v4l2 m2m driver methods. > > vpu_helpers.c implements the common helper functions > > vpu_color.c converts the v4l2 colorspace with iso > > > > Signed-off-by: Ming Qian <ming.qian@xxxxxxx> > > Signed-off-by: Shijie Qin <shijie.qin@xxxxxxx> > > Signed-off-by: Zhou Peng <eagle.zhou@xxxxxxx> > > Reported-by: kernel test robot <lkp@xxxxxxxxx> > > --- > > drivers/media/platform/amphion/vpu_color.c | 192 ++++++ > > drivers/media/platform/amphion/vpu_helpers.c | 453 ++++++++++++++ > > drivers/media/platform/amphion/vpu_helpers.h | 72 +++ > > drivers/media/platform/amphion/vpu_v4l2.c | 625 > +++++++++++++++++++ > > drivers/media/platform/amphion/vpu_v4l2.h | 53 ++ > > 5 files changed, 1395 insertions(+) > > create mode 100644 drivers/media/platform/amphion/vpu_color.c > > create mode 100644 drivers/media/platform/amphion/vpu_helpers.c > > create mode 100644 drivers/media/platform/amphion/vpu_helpers.h > > create mode 100644 drivers/media/platform/amphion/vpu_v4l2.c > > create mode 100644 drivers/media/platform/amphion/vpu_v4l2.h > > > > +dma_addr_t vpu_get_vb_phy_addr(struct vb2_buffer *vb, u32 plane_no) > > +{ > > + return vb2_dma_contig_plane_dma_addr(vb, plane_no) + > > + vb->planes[plane_no].data_offset; > > I've change the num_planes to 1 (tried 2, but failed differently), and it > crashed while running: > > GST_DEBUG="v4l2*:7" gst-launch-1.0 videotestsrc num-buffers=100 ! > v4l2h264enc ! fakesink > > So perhaps there is a overall review of the buffer allocation vs S_FMT > implementation to be done here. Hi Nicolas, What's the failure of setting num_planes to 2? When num_planes is set to 1, driver still try to access the planes[1], but got NULL pointer. Then led to this panic. I'll try to support V4L2_PIX_FMT_NV12M, and check the plane number carefully. > > [ 81.520167] Unable to handle kernel NULL pointer dereference at virtual > address 0000000000000000 > [ 81.529168] Mem abort info: > [ 81.532467] ESR = 0x96000004 > [ 81.539550] EC = 0x25: DABT (current EL), IL = 32 bits > [ 81.546053] SET = 0, FnV = 0 > [ 81.549771] EA = 0, S1PTW = 0 > [ 81.553186] FSC = 0x04: level 0 translation fault > [ 81.558280] Data abort info: > [ 81.561437] ISV = 0, ISS = 0x00000004 > [ 81.565527] CM = 0, WnR = 0 > [ 81.568581] user pgtable: 4k pages, 48-bit VAs, pgdp=0000000882741000 > [ 81.575840] [0000000000000000] pgd=0000000000000000, > p4d=0000000000000000 > [ 81.586637] Internal error: Oops: 96000004 [#1] PREEMPT SMP > [ 81.592247] Modules linked in: amphion_vpu_core v4l2_mem2mem > videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 > videobuf2_common imx_sc_key imx_sc_thermal crct10dif_ce rtc_imx_sc > imx_sc_wdt > amphion_vpu_dev fsl_imx8_ddr_perf isl29018 mpl3115 > industrialio_triggered_buffer > kfifo_buf videodev mc fuse drm ip_tables x_tables ipv6 > [ 81.622805] CPU: 0 PID: 348 Comm: videotestsrc0:s Not tainted > 5.15.0-rc2- > imx8qxp+ #2 > [ 81.630562] Hardware name: Freescale i.MX8QXP MEK (DT) > [ 81.635711] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS > BTYPE=--) > [ 81.642687] pc : vpu_get_vb_phy_addr+0x28/0x50 [amphion_vpu_core] > [ 81.648838] lr : vpu_get_vb_phy_addr+0x20/0x50 [amphion_vpu_core] > [ 81.654971] sp : ffff800012fcba30 > [ 81.658287] x29: ffff800012fcba30 x28: ffff800012bd1040 x27: > 0000000000000000 > [ 81.665449] x26: 0000000000000000 x25: ffff800012fcbd28 x24: > ffff800012bd1010 > [ 81.672607] x23: ffff800012bd3200 x22: 0000000000000000 x21: > ffff800015807044 > [ 81.679766] x20: ffff000806a1ec00 x19: 0000000000000003 x18: > 0000000000000000 > [ 81.686924] x17: 0000000000000000 x16: 0000000000000000 x15: > 0000a95ba29c327a > [ 81.694083] x14: 000000000000039f x13: 0000000000000000 x12: > 0000000000000000 > [ 81.701241] x11: 0000000000000000 x10: 0000000000000990 x9 : > ffff800012fcb900 > [ 81.708400] x8 : ffff0008068f97f0 x7 : ffff00083f98b180 x6 : > ffff000802070af8 > [ 81.715558] x5 : ffff000802070af8 x4 : ffff800009296000 x3 : > ffff000802073480 > [ 81.722717] x2 : ffff000806a1ec00 x1 : 0000000000000002 x0 : > 0000000000000000 > [ 81.729877] Call trace: > [ 81.732332] vpu_get_vb_phy_addr+0x28/0x50 [amphion_vpu_core] > [ 81.738119] vpu_windsor_input_frame+0x84/0xbc [amphion_vpu_core] > [ 81.744252] venc_process_output+0x88/0x10c [amphion_vpu_core] > [ 81.750125] vpu_process_output_buffer+0xac/0x100 > [amphion_vpu_core] > [ 81.756519] venc_start_session+0x264/0x2cc [amphion_vpu_core] > [ 81.762392] vpu_vb2_start_streaming+0x88/0xf4 [amphion_vpu_core] > [ 81.768525] vb2_start_streaming+0x68/0x15c [videobuf2_common] > [ 81.774398] vb2_core_streamon+0x94/0x19c [videobuf2_common] > [ 81.780088] vb2_streamon+0x20/0x70 [videobuf2_v4l2] > [ 81.785083] v4l2_m2m_ioctl_streamon+0x3c/0xa0 [v4l2_mem2mem] > [ 81.790869] v4l_streamon+0x28/0x34 [videodev] > [ 81.795412] __video_do_ioctl+0x17c/0x3e0 [videodev] > [ 81.800460] video_usercopy+0x368/0x7e0 [videodev] > [ 81.805333] video_ioctl2+0x1c/0x3c [videodev] > [ 81.809859] v4l2_ioctl+0x44/0x64 [videodev] > [ 81.814211] __arm64_sys_ioctl+0xac/0xf0 > [ 81.818155] invoke_syscall+0x48/0x114 > [ 81.821917] el0_svc_common.constprop.0+0x44/0xfc > [ 81.826635] do_el0_svc+0x2c/0x94 > [ 81.829961] el0_svc+0x28/0x80 > [ 81.833027] el0t_64_sync_handler+0xa8/0x130 > [ 81.837311] el0t_64_sync+0x1a0/0x1a4 > [ 81.840992] Code: aa0003f4 97ff02f9 d37f7e61 8b334033 (f9400000) > [ 81.847099] ---[ end trace 46cf421377a59de1 ]--- > > > > > > +} > > +