Tegradc: non-deterministic numbering of display outputs

Hi,

I’m having problem with a TX2i board with dual HDMI outputs and L4T 32.6.1
My problem is that from userland/libdrm the numbering of the outputs it a bit random.

In the normal case I will have
HDMI1 -> nvdisplay@15210000 -> sor1
HDMI2 -> nvdisplay@15220000 -> sor

But, occasionally i will get:
HDMI2 -> nvdisplay@15210000 -> sor1
HDMI1 -> nvdisplay@15220000 -> sor

What I have found out so far it that is seems that the numbering in libdrm / tegra_dc_ext is dependent on platform_device.id as assigned in tegra_dc_set() in dc.c.
tegra_dc_set() in turn assigns the number on a first come, first served basis.

But in my case the two nvdisplay devices will get probed in a somewhat random order. Normally 15210000 will get probed first, but occasionally 15220000 will be first. In the later case the HDMI output will be “flipped”.

Is there a way to control the probe order or is there something else I am missing?

In general, the probing order depends on the device tree order. Thus, nvdisplay@15210000 shall always be the first HDMI.

Not quite sure what is going on on your board. Could you

  1. Share the dmesg when this situation happened/ not happened? You shall share two dmesg here.

  2. Check if the order of fbX is changing the order too. It will be /sys/class/grphcis/fbX. X= 0,1,2. If the error is as what you said, then fb order will be swapped too.

Attached is two dmesg:s

Notable is that in the normal case it says:
tegradc 15210000.nvdisplay: disp0 connected to head1->/host1x/sor1

But in the swap-outputs-case is says:
tegradc 15220000.nvdisplay: disp0 connected to head2->/host1x/sor

As for the fb-device they also get swapped. In the normal case:

root@localhost:~# ls -l /sys/class/graphics/
lrwxrwxrwx    1 root     root             0 Sep 20  2020 fb0 -> ../../devices/13e10000.host1x/15210000.nvdisplay/graphics/fb0
lrwxrwxrwx    1 root     root             0 Sep 20  2020 fb1 -> ../../devices/13e10000.host1x/15220000.nvdisplay/graphics/fb1
lrwxrwxrwx    1 root     root             0 Sep 20  2020 fbcon -> ../../devices/virtual/graphics/fbcon

And when the outputs are swapped:

root@localhost:~# ls -l /sys/class/graphics/
lrwxrwxrwx    1 root     root             0 Sep 20  2020 fb0 -> ../../devices/13e10000.host1x/15220000.nvdisplay/graphics/fb0
lrwxrwxrwx    1 root     root             0 Sep 20  2020 fb1 -> ../../devices/13e10000.host1x/15210000.nvdisplay/graphics/fb1
lrwxrwxrwx    1 root     root             0 Sep 20  2020 fbcon -> ../../devices/virtual/graphics/fbcon

dmesg_normal (53.1 KB)
dmesg_switched_outputs (53.4 KB)