I’ve narrowed down actually what this tearing issue is, but not what is causing it.
It seems the V4L2 driver is being told the frame is ready to read out before the DMA from the mipi core is finished.
IE our MIPI input device hasn’t finished filling the buffer up before V4L2 reads it out.
This results in my frames (i have 4 V4L2 buffers set up) looking like the following:
since the frame isn’t filled yet . Though V4L2 finishes copying the data, our MIPI input is still filling the frame out. This results in the circular buffer then wrapping back around to the first buffer (which now has full data). It then repeats with only the partial top being filled in followed by the remenants of the last filled frame.
I see the MIPI protocol has Frame Packet Start & Frame Packet End codes which i assume signal to the V4L2 driver when a frame is ready.
I have already checked and verified all settings and configurations. tearing is visible even when we capture with v4l2-ctl command.
v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=YUYV --stream-mmap --set-ctrl=sensor_mode=0 --stream-count=100 -d /dev/video0