How to determine HDMI interlaced video field order?

I’m a developer of a capture application using the HDMI input of the Rock5B.
I need to determine the field order for deinterlacing 1080i interlaced format using Bob deinterlacing method. Does anyone know a good method to achieve this?

Issue
It seems that the field order (Top Field First or Bottom Field First) of the HDMI input on the Rock5B (RK3588) changes each time /dev/video0 is opened. For instance, when specifying Top Field First for deinterlacing, sometimes it deinterlaces correctly, but other times the field order is reversed, causing jitter. This issue occurs randomly.

Therefore, I want to determine the field order when opening /dev/video0, but I haven’t found a method to do this.

According to the V4L documentation, “All video capture and output devices must report the current field order.” However, the HDMI input driver (rk_hdmirx) does not seem to support this feature.
https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/field-order.html

Upon examining the rk_hdmirx source code, it appears that the field order handling is incomplete.


Example: pixm->field = V4L2_FIELD_NONE;

As of 2024, there may be few users who need to use the interlaced format, but if anyone has a good method, please let me know.