(linux) On-the-fly switch of CRTC when HDMI connected

Hi there,

I’m using EmulationStation (which is based on SDL) running on Debian without compositor.
My device (retrostone2) has a inner LCD and a HDMI out connector.

I am trying to implement a on-the-fly switch, such that the signal will go from LCD to HDMI when HDMI is connected.

The kernel side of the display is ok as the on-the-fly switch works when on Xcfe desktop. EmulationStation interact directly to DRM through the SDL library (if I understood correctly).

However I’m totally new to SDL so I am not sure how to proceed and if SDL can support changing the window to update to another CRTC through KMS ?

Any help or reference of automatic switch would be really appreciated.
Thanks