Is there a way to assign a fixed XWAYLAND dispaly number to a certain display or display output?

I have three displays connected to my primary GPU. If I run xrandr in X11 I can see they are labelled as DP-0, DP-2 and DP-4. And if I run xrandr in Wayland I get XWAYLAND[0-2], nothing special here.

I also have a KVM switch that switches all three displays between my primary GPU and my secondary GPU that’s passed through to a VM. It seems to disconnect the displays and reconnect them every time I switch between inputs.

In X11, the displays maintain their labels in Fedora when I switch back and forth between the two systems (based on the physical connectors they’re connected to, I guess).

But in Wayland, every time I switch away from Fedora to the VM and back again, the display numbering would increase - and not even predictably.

What I mean by that is not all three displays would change their numbering. They might, but not always. For instance, now, after several switches between my two systems, xrandr gives me XWAYLAND6, XWAYLAND8 and XWAYLAND9, while they started as XWAYLAND0, 1 and 2.

How does this XWAYLAND numbering system work? Is there a way to create a constant mapping between physical display outputs and XWAYLAND indexes so that DP-0 always maps to XWAYLAND0, DP-2 always to XWAYLAND1, DP-4 always to XWAYLAND2?

The practical reason I would like to achieve this is because of DaVinci Resolve. It always references the display names for its layout arrangement. And every time I switch systems and back again, DR will be confused by the display changes and start to misbehave. I tried to switch to X11, but the playback performance is noticeably worse than that in Wayland.

Many thanks in advance.

I think I don’t quite understand your setup yet: You say that Wayland gives you better performance (interesting but good news) and you mention XWAYLAND output names, which means you are running an X11 app talking X11 to the Wayland compositor via the XWayland “server”.
Also, even in a pure X11 setup, output names are not guaranteed to be stable, they just happen to be (mostly).
[Note that in X11 terms, “display” is what $DISPLAY gives you; your post is about output names/numbers. ]

Thanks for your reply and clarification! I did actually mean output names/numbers.

Yes, the software in question here is indeed an X11 app, and it performs better in Wayland (with my use case), as in X11 it would have latency and stutter issues. I noticed the changing output names in Wayland, so I logged in to an X11 session just to see what would happen there.

And just as you said, I observed (mostly) stable output names, which I would really like to replicate on the XWayland server in Wayland sessions.