This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM67: Root cause video distortion on isl7998x going through ticsi2rx

Part Number: AM67

Tool/software:

We are using the isl7998x driver on version 6 of the Linux SDK.

By default, this driver has a field ordering:

V4L2_FIELD_SEQ_TB
V4L2_FIELD_SEQ_BT

This TI CSI shim driver (and the cadence CSI driver) do not support field ordering.

I noticed the NXP driver for this chip and their CSI module (for an older kernel version) needed a patch to their CSI driver support field ordering to support this chip.

Is it possible that the resulting image could be from the CSI drivers not supporting Field Ordering?
What is the best method to root cause this type of issue?




  • Hi Evan,

    The image appears to be warped. Is that correct?

    Additionally, can you try editing the cdns-csi.c driver so that the csi2rx_set_fmt function sets the field to V4L2_FIELD_SEQ_TB instead of V4L2_FIELD_NONE.

    Best,
    Jared

  • Hi Jared,

    I found setting the flag in csi2rx_set_fmt made it unstable. Flickering and some green frames.

  • Hi Evan,

    Did the images look correct apart from the flickering and green frames?

    Additionally, do you have an answer for the question below:

    The image appears to be warped. Is that correct?

    Best,
    Jared

  • Hi Jared,

    The image isn't warped, I took the picture with my phone from a weird angle.
    Turns out I think setting the flag doesn't change anything actually.

    Here are two stable screen grabs. I found setting a "v stable" bit prevents the green distortion I was seeing. (This is inside the isl7998x chip)

    "4 VSTABLE R/W
    0 = Ignore the ‘VSTABLE” flag from decoders, always do normal output transmission.
    1 = Use the “VSTABLE” flag from decoders to perform normal output transmission or stop the
    output transmission.

    With cdns_csi2rx.30121000.csi-bridge field:none


    With cdns_csi2rx.30121000.csi-bridge field:seq-bt


    Also, I found setting "Config input" "Progressive" bit in the decoder, and turning on a test pattern, the video feed is working and stable, drawing the entire test image.
    However! If I attempt to use the camera in this mode, it does not draw/update the last half of the image. (It seems like the isl7998x cannot translate the NTSC Top+Bottom encoded signal into progressive)

  • Hi Evavn,

    Can you test playing with register: REG 0X09 – ONE FIELD MODE CONTROL of the isl7998x?

    Best,
    Jared

  • Hi Jared,

    Yes, here's an image with the bit set.
    Only the top half is being updated by the camera and the bottom half stale data from the test image.


  • Hi Jared,

    Do you think it's possible to fix this in software, perhaps using gstreamer's x-raw interlace-mode=fields,views=2 ! interlace <something>?
    I copied forward the seq-bt flag and I'm able to open the x-raw pad for capture, but I cannot pipe it into interlace right now. Open to suggestions

  • Hi Evan,

    You can try deinterlace.

    Best,
    Jared

  • Hi Jared,

    It's still interlaced despite adding deinterlace to the pipeline.

    Even if we could get 'deinterlace' to work, we'd still want the CSI driver to support dma based deinterlace to decrease CPU load. (Gstreamer's 'deinterlace' Adds ~65% CPU usage, and we are wanting all 4 streams at the same time)

    Where do you think the deinterlacing should be done?
    We could modify the drivers or perhaps I could add another item to the device tree that could do the translation?
    I found this for example: https://www.kernel.org/doc/html/v5.8/admin-guide/media/imx.html
    Talks about a VDIC block doing it. However this appears to be on IMX only.
    Perhaps we use

    CONFIG_VIDEO_MEM2MEM_DEINTERLACE

    mem2mem sets up DMAs, so appears hardware accelerated but might require a v4l2 loopbacks? So maybe this isn't correct either.
    We can close this ticket since it's root caused and I'll open another one.

    To close the loop on why gstreamer's 'deinterlace' doesn't work, it appears to not support SEQ_BT or SEQ_TB.

    Looks like ti_csi2rx_start_dma might be my best bet.

    If you add multiview-mode=top-bottom to the gstreamer pipeline, it will combined the images into a 240 height image with distorted colors...