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

            Bug ID: 529011
           Summary: Internal display (eDP-1) stays disabled after
                    suspend-by-lid-close and resume with the lid open
    Classification: Plasma
           Product: kwin
      Version First 6.6.6
       Reported In:
          Platform: Ubuntu
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: multi-screen
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

SUMMARY
On Plasma 6.6.6 Wayland, after suspending by closing the laptop lid with
external monitors attached and resuming with the lid open, the internal panel
(eDP-1) stays disabled while the external outputs come back. KWin keeps using
the lidClosed=true output setup even though the lid is physically open. On the
same machine the opposite also happens sometimes (external outputs dropped
instead), so which panel goes dark comes down to which setup was stored last.

STEPS TO REPRODUCE
1. Laptop with an internal panel and two external monitors attached. Here: Dell
laptop, Intel TigerLake-H iGPU (8086:9a60) driving eDP-1 [email protected] scale
1.5 plus DP-9 and DP-11 (3840x2160@60) through DP-MST. NVIDIA RTX A3000 Mobile
present but drives none of these.
2. Have a working three-output layout (eDP-1 at 0,1280; DP-9 at 2560,0; DP-11
at 2560,1440).
3. Close the lid and leave the machine alone for a while. PowerDevil logs "Lid
action was suppressed because an external monitor is present", the system
suspends (s2idle).
4. Open the lid, resume, unlock.

OBSERVED RESULT
Both external outputs come back, eDP-1 stays disabled:
  kscreen-doctor: Output 1 eDP-1 ... disabled
  /sys/class/drm/card2-eDP-1: enabled=disabled, dpms=Off
  qdbus6 org.kde.KWin /KWin supportInformation -> Screen 0: Name: eDP-1 
Enabled: 0

Meanwhile the firmware and the input layer both consider the lid open:
  /proc/acpi/button/lid/LID0/state -> state: open
  evtest --query /dev/input/event0 EV_SW SW_LID -> exit 0 (not active = open)
  journal: "systemd-logind: Lid opened."

`kscreen-doctor output.eDP-1.enable` brings the panel back instantly, so the
DRM link and the hardware are fine - this is purely the output configuration
KWin chooses.

EXPECTED RESULT
Resuming with the lid open should restore the configuration that was active
before the lid was closed, or at least re-evaluate the lid state on resume.

TIMELINE (one reproducible occurrence)
  20:07:43  systemd-logind: Lid closed.
  20:07:43  powerdevil: Lid action was suppressed because an external monitor
is present
  20:07:45  kernel: ACPI: button: The lid device is not compliant to SW_LID.
  20:23:15  kernel: PM: suspend entry (s2idle)
  04:14:19  kernel: PM: suspend exit; systemd-logind: Lid opened.
  04:18:46  session unlocked (password); eDP-1 still disabled
  04:19     kscreen-doctor output.eDP-1.enable restores it

EVIDENCE THAT KWIN'S LID STATE IS STALE
~/.config/kwinoutputconfig.json contains a setup with "lidClosed": true where
eDP-1 is enabled:false and both external outputs enabled:true, and KWin picks
exactly that one. Discriminating test: toggling the panel from the CLI
  kscreen-doctor output.eDP-1.disable   # then inspect kwinoutputconfig.json
  kscreen-doctor output.eDP-1.enable
Both writes land on the lidClosed=true entry, never on the lidClosed=false one
- i.e. the LidSwitchTracker still reports "closed" while the lid is physically
open.

src/lidswitchtracker.cpp only assigns m_isLidClosed from switchEvent() and
never re-reads the switch, so a single SW_LID event lost during resume stays
wrong until the lid is physically cycled or the session is restarted.

THINGS I TRIED
A synthetic lid switch device created via /dev/uinput (EV_SW + SW_LID,
registered with UI_SET_SWBIT, exposed as a regular input device with udev
ID_INPUT_SWITCH=1) does not make KWin change its state at all, so the tracker
cannot be reset that way.

WORKAROUND
A small systemd --user service that watches the real SW_LID events on
/dev/input/event0 plus logind's PrepareForSleep(false), reads the physical lid
state via EVIOCGSW, and calls kscreen-doctor accordingly (enable + position on
lid open, disable on lid close while an external output is active). It makes
the symptom go away but the compositor state is still wrong.

SUGGESTED FIX DIRECTION
Re-read the switch state (or emit lidStateChanged) when the output backend
re-enumerates after resume, so the tracker cannot stay out of sync with the
firmware.

SOFTWARE/OS VERSIONS
Operating System: Ubuntu 26.04.1 LTS
KDE Plasma Version: 6.6.6
KDE Frameworks Version: 6.x (Ubuntu 26.04 packages)
Qt Version: 6.9.x
Kernel Version: 7.0.0-43-generic (64-bit)
Graphics Platform: Wayland
kwin-wayland 4:6.6.6-0ubuntu0.1, plasma-workspace 4:6.6.6-0ubuntu0.1

SEE ALSO
528875 (same machine family, lid close swaps output priorities and does not
restore them)
433262 (KScreen, 5.21, same symptom, closed as fixed in 2022)

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

Reply via email to