https://bugs.kde.org/show_bug.cgi?id=521487

            Bug ID: 521487
           Summary: Wayland: a transient DRM/modeset failure makes KWin
                    overwrite and permanently lose the saved output
                    (monitor) layout
    Classification: Plasma
           Product: kwin
      Version First 6.6.4
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: platform-drm
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

Created attachment 193163
  --> https://bugs.kde.org/attachment.cgi?id=193163&action=edit
Post-incident kwinoutputconfig.json (KWin 6.6.4, reformatted, serials
redacted): 8 known outputs + 20 saved per-combination layouts; current
output-set entry overwritten by the post-freeze fallback

## Wayland: a transient DRM/modeset failure makes KWin overwrite and
permanently lose the saved output (monitor) layout

## Summary
On a multi-monitor Wayland session, when the GPU driving the outputs has a
*transient* failure (DRM render nodes briefly disappear and an atomic modeset
test fails), KWin falls back to a default arrangement and **persists it** to
`~/.config/kwinoutputconfig.json`, overwriting the previously saved good layout
for that exact output set. After the GPU recovers, the original layout is
neither re-applied nor recoverable: KWin keeps no backup of the prior config.

## Impact
A carefully configured multi-display layout (positions, scale, rotation,
priority) is silently and permanently destroyed by a momentary GPU/DRM glitch,
with no way to restore it short of rebuilding it by hand.

## Environment
- KWin 6.6.4 (Wayland session), Plasma 6.6.4, Qt 6.10.2
- Ubuntu 26.04 LTS, kernel 7.0.0-22-generic
- GPUs: NVIDIA proprietary 595.71.05 (RTX 4060 Ti + RTX 3050) + Intel Arrow
Lake-S iGPU (i915). The 3 affected monitors are driven by the RTX 3050
  (HDMI-A-1/2/3: two 2560x1440 portrait + one 1920x1080 landscape, scale 1.4).
- Output config store: `~/.config/kwinoutputconfig.json`   (no
`~/.local/share/kscreen/` on this setup).

## Steps to reproduce
(The trigger is hardware-dependent, but the data-loss behavior is the point.)
1. Wayland multi-monitor session with a custom, saved layout.
2. A transient display-stack failure happens on the GPU driving the outputs
(here: an i915 HPD/hotplug storm — `i915_hotplug_work_func [i915] hogged CPU`),
   so the DRM render nodes momentarily vanish.
3. Observe KWin's reaction and the on-disk config.

## Observed
KWin journal (`kwin_wayland`):
```
kwin_core: Failed to open /dev/dri/renderD128 device (No such device)
kwin_wayland_drm: Atomic modeset test failed! Permission denied
kwin_core: Applying output configuration failed!
```
- KWin applies a fallback geometry (one monitor ends up floated to e.g.  
`x=2811, y=1829` with a gap and a large vertical offset).
- `~/.config/kwinoutputconfig.json` is rewritten with this fallback; the good
geometry for the same output set is gone.
- Once the GPU is healthy again, the original layout is not restored and cannot
be recovered (no backup file, no `$HOME` snapshot).
- **Logging out and back in does NOT restore the layout** — unlike the older
"not applied after sleep" reports, here the on-disk config has been
*overwritten* with the fallback, so there is no good config left to re-apply.

## Expected
- KWin should **not** persist a degraded/fallback output configuration over a
known-good one when the change was caused by a *transient* modeset/output
failure (as opposed to a deliberate user reconfiguration).
- Preferably keep a short history/backup of the last known-good config per
output-set, and re-apply it once the outputs come back healthy.
- At minimum: do not overwrite the stored config on
  `Applying output configuration failed!`.

## Notes
- The GPU freeze itself is hardware/driver and out of scope here; the
reportable defect is the irreversible loss of the saved layout.
- The "Permission denied" line was originally emitted in French ("Permission
non accordée"); translated for clarity.

## Searched for duplicates (none open matches this exact mechanism)
Checked bugs.kde.org before filing:
- **416475** "Display Configuration not saved properly on Wayland with multiple
monitors" — RESOLVED FIXED (Plasma 5.26), KScreen. Closest in spirit
(sleep/hotplug resets positions) but fixed long ago and on a different layer.
- **362058** "Dual monitor loses settings after screen sleep" — RESOLVED
WORKSFORME. Similar trigger, but there the saved config survives and a
logout/login restores it; **here it is overwritten and unrecoverable**.
- **462214** / **455532** "Atomic modeset test failed / Failed to find a
working setup for new outputs" — RESOLVED FIXED (5.26.5), platform-drm. Same
*symptom*(modeset test fails) but those are about failing to drive the display,
not about overwriting the persisted layout.
- **447085** (DUP of 429236) — config lost across relogin, not this case.

This report is filed as a new bug because none of the above (all old/closed)
covers the **destruction of a previously-saved good layout on a transient
failure, on KWin 6.6.x**.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to