Public bug reported:

[ Impact ]

On Ubuntu 24.04, Mutter may fail to restore windows to the same external
monitor after unplug/replug on amdgpu DisplayPort MST / Thunderbolt
systems.

The affected window placement code matches the preferred monitor using
winsys_id. On the native KMS backend this includes the DRM connector ID:

  winsys_id = gpu_id << 32 | connector_id

On amdgpu MST, the same physical monitor can get a different DRM
connector ID after replug. In one verified case:

  before unplug: DP-9 connector_id=171, winsys_id=0x1000000ab
  after replug:  DP-9 connector_id=176, winsys_id=0x1000000b0

The monitor EDID stayed stable:

  DP-9 / HPN / HP 840 G9 AiO / 8CC24228S8

Because the winsys_id changed, Mutter could treat the same monitor as a
different monitor and leave windows on the internal panel instead of
restoring them to the external monitor.

The fix backports upstream Mutter commit:

  297ae747716debbed71df357c370decdaaf14648
  window: Replace 'winsys_id' for monitor matching

It replaces winsys_id-based window monitor matching with a logical
monitor ID generated from stable monitor identity:

  EDID:vendor:product:serial

with fallback to:

  CONNECTOR:connector-name

when EDID is not useful.

[ Test Plan ]

1. Boot an affected Ubuntu 24.04 amdgpu MST/Thunderbolt system with only the 
internal panel connected.
2. Plug in the external monitor.
3. Move a test window to the external monitor.
4. Unplug the external monitor.
5. Plug the same external monitor back in.
6. Verify the test window returns to the external monitor.

Expected result with the fix:
  - The window returns to the external monitor.

[ Where problems could occur ]

This changes Mutter's window-to-monitor matching logic. Regressions
would likely appear as windows restoring to the wrong monitor after
hotplug, docking/undocking, suspend/resume, or explicit user window
moves.

Specific risks:
  - Monitors with bad or missing EDID fall back to connector name, which may 
still be unstable on some hardware.

[ Other Info ]

The commit - Replace 'winsys_id' for monitor matching:
  https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3753
  297ae747716debbed71df357c370decdaaf14648

** Affects: mutter (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  [ Impact ]
  
  On Ubuntu 24.04, Mutter may fail to restore windows to the same external
  monitor after unplug/replug on amdgpu DisplayPort MST / Thunderbolt
  systems.
  
  The affected window placement code matches the preferred monitor using
  winsys_id. On the native KMS backend this includes the DRM connector ID:
  
-   winsys_id = gpu_id << 32 | connector_id
+   winsys_id = gpu_id << 32 | connector_id
  
  On amdgpu MST, the same physical monitor can get a different DRM
  connector ID after replug. In one verified case:
  
-   before unplug: DP-9 connector_id=171, winsys_id=0x1000000ab
-   after replug:  DP-9 connector_id=176, winsys_id=0x1000000b0
+   before unplug: DP-9 connector_id=171, winsys_id=0x1000000ab
+   after replug:  DP-9 connector_id=176, winsys_id=0x1000000b0
  
  The monitor EDID stayed stable:
  
-   DP-9 / HPN / HP 840 G9 AiO / 8CC24228S8
+   DP-9 / HPN / HP 840 G9 AiO / 8CC24228S8
  
  Because the winsys_id changed, Mutter could treat the same monitor as a
  different monitor and leave windows on the internal panel instead of
  restoring them to the external monitor.
  
  The fix backports upstream Mutter commit:
  
-   297ae747716debbed71df357c370decdaaf14648
-   window: Replace 'winsys_id' for monitor matching
+   297ae747716debbed71df357c370decdaaf14648
+   window: Replace 'winsys_id' for monitor matching
  
  It replaces winsys_id-based window monitor matching with a logical
  monitor ID generated from stable monitor identity:
  
-   EDID:vendor:product:serial
+   EDID:vendor:product:serial
  
  with fallback to:
  
-   CONNECTOR:connector-name
+   CONNECTOR:connector-name
  
  when EDID is not useful.
  
  [ Test Plan ]
  
  1. Boot an affected Ubuntu 24.04 amdgpu MST/Thunderbolt system with only the 
internal panel connected.
  2. Plug in the external monitor.
  3. Move a test window to the external monitor.
  4. Unplug the external monitor.
  5. Plug the same external monitor back in.
  6. Verify the test window returns to the external monitor.
  
- 
  Expected result with the fix:
-   - The window returns to the external monitor.
+   - The window returns to the external monitor.
  
  [ Where problems could occur ]
  
  This changes Mutter's window-to-monitor matching logic. Regressions
  would likely appear as windows restoring to the wrong monitor after
  hotplug, docking/undocking, suspend/resume, or explicit user window
  moves.
  
  Specific risks:
-   - Monitors with bad or missing EDID fall back to connector name, which may 
still be unstable on some hardware.
- 
+   - Monitors with bad or missing EDID fall back to connector name, which may 
still be unstable on some hardware.
  
  [ Other Info ]
  
- Upstream fix:
-   https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3753
-   297ae747716debbed71df357c370decdaaf14648
+ The commit - Replace 'winsys_id' for monitor matching:
+   https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3753
+   297ae747716debbed71df357c370decdaaf14648

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to mutter in Ubuntu.
https://bugs.launchpad.net/bugs/2156974

Title:
  window do not return to the same external monitor after hotplug

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mutter/+bug/2156974/+subscriptions


-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to