This WIP branch prototypes the usage of virtual display devices (through "virtual desktop" mode at the moment) to support display mode emulation in the Wayland driver.
It works by allowing the driver to mark each host adapter with a virtual_id, which, if present, signals to win32u that it should include the adapter in the virtual display configuration. The virtual configuration (along with the virtual ids) is reported back to the driver though a new user driver function. If none of the host adapters is marked with a virtual id (i.e., all other drivers) we fall back to the single virtual display mode as before.
Some deficiencies and open questions with the prototype:
1. Virtual desktop mode implies a lot of behavior that we don't want at this point the Wayland driver (e.g., taskbar window, changing the display mode to the virtual desktop resolution at startup, some changes in fsclip behavior). One way forward would be to have a "virtual display devices" mode separate from the "virtual desktop" mode, so that drivers can opt in only to the desired behavior (virtual desktop would imply virtual devices, to maintain the current behavior). 2. It's not clear to me what would be the best way for a driver to opt in or out of certain core behavior. Perhaps the driver would change some volatile registry key which other components would consult? Or introduce a user driver function for core to query the driver about such features on demand? Is there some precedence I can get inspiration from? 3. At the moment, the prototype calls the new "NotifyVirtualDevices" user driver callback only in the process which the display update occurred. This means that other processes don't get notified of the virtual devices mapping to host devices, so, in the Wayland driver case, we are not able to scale windows from those processes properly. One approach would be for core to ensure that the NotifyVirtualDevices callback is called once in all processes, but I am not sure what's the best way to achieve this (or even if this is the preferred approach). Another way would be to have a mechanism for the driver to query the virtual device info (+mappings) on demand, and just broadcast a message to all windows. In this case it could even be done internally by the driver (so more in line with what the part-12 MR is doing), if we don't want to introduce a more global behavior. Perhaps there is some even better mechanism, which would also be more fitting to how we envision the virtual display/devic es to evolve going forward.
Let me know what you think!