Bug 482131 - Tablet mode has become inappropriately enabled when waking a laptop with its lid closed that is connected to an external monitor in mirrored mode
Summary: Tablet mode has become inappropriately enabled when waking a laptop with its ...
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 6.0.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen
Depends on:
Blocks:
 
Reported: 2024-03-01 09:11 UTC by Jacopo Torrini
Modified: 2024-10-16 19:20 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Before and after sleep (145.54 KB, image/png)
2024-03-01 09:11 UTC, Jacopo Torrini
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jacopo Torrini 2024-03-01 09:11:22 UTC
Created attachment 166242 [details]
Before and after sleep

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Login a wayland session
2. Sleep the pc
3. Wake up

OBSERVED RESULT
Icons on title bar are very big and icon spacing in taskbar and tray bar is very large.
This problem is present from 5.x.x version of plasma.

EXPECTED RESULT
The visual aspect must not change

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 6.0 and KDE Neon 5.x 
(available in About System)
KDE Plasma Version: 6.0.0 and 5.x.x
KDE Frameworks Version:  6.0.0 and 5.x.x
Qt Version: 6.6.2 and 5.x.x

ADDITIONAL INFORMATION

Laptop PC Dell Inspiron 5579

This is the output of my lspci:

00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 08)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
00:04.0 Signal processing controller: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 08)
00:13.0 Non-VGA unclassified device: Intel Corporation Sunrise Point-LP Integrated Sensor Hub (rev 21)
00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO I2C Controller #0 (rev 21)
00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21)
00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #6 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point LPC Controller/eSPI Controller (rev 21)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21)
00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21)
00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21)
01:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
Comment 1 Vlad Zahorodnii 2024-03-01 09:17:16 UTC
It looks like something's off with tablet mode handling
Comment 2 Jacopo Torrini 2024-03-01 09:19:08 UTC
Restarting Plasma doesn't correct the problem.
Login and logout resolve taskbar spacing but not title bar icon size.
Comment 3 Jacopo Torrini 2024-03-01 09:25:08 UTC
(In reply to Vlad Zahorodnii from comment #1)
> It looks like something's off with tablet mode handling

This comment was very useful. 
I have a monitor attached to my laptop. My laptop has a tablet mode.
After wakeup, opening and closing the screen of my tabled resolves all the problems.
Comment 4 Vlad Zahorodnii 2024-03-01 09:29:54 UTC
okay it might be a problem in kwin code. can't verify myself as I have now hardware to test
Comment 5 Vlad Zahorodnii 2024-03-01 09:30:08 UTC
no hardware*
Comment 6 Nate Graham 2024-03-01 21:05:09 UTC
I have a 2-in-1 that triggers tablet mode properly and an external screen; what do you need me to test?

Jacopo, can you describe *exactly* your hardware setup?
Comment 7 Jacopo Torrini 2024-03-01 23:04:21 UTC
Hi Nate, 

My laptop is connected to an external display via HDMI. The laptop screen and the external screen are cloned but I always keep the laptop screen closed.
If I put the PC to sleep, when it wakes up the desktop is in tablet mode. Raising and lowering the laptop screen returns the mode to normal.

My hardware info:

System:
  Kernel: 6.5.0-21-generic x86_64 bits: 64 compiler: N/A
    Desktop: KDE Plasma 6.0.0 Distro: KDE neon 22.04 6.0
    base: Ubuntu 22.04 LTS Jammy
Machine:
  Type: Laptop System: Dell product: Inspiron 5579 v: N/A
  
  Mobo: Dell model: 07P65C v: A00 serial: <superuser required> UEFI: Dell
    v: 1.2.1 date: 09/14/2017
Battery:
  ID-1: BAT0 charge: 37.9 Wh (90.2%) condition: 42.0/42.0 Wh (100.0%)
    volts: 12.4 min: 11.4 model: BYD DELL FW8KR16 status: Discharging
CPU:
  Info: quad core model: Intel Core i7-8550U bits: 64 type: MT MCP
    arch: Coffee Lake rev: A cache: L1: 256 KiB L2: 1024 KiB L3: 8 MiB
  Speed (MHz): avg: 600 high: 800 min/max: 400/4000 cores: 1: 800 2: 400
    3: 400 4: 400 5: 400 6: 800 7: 800 8: 800 bogomips: 31999
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel UHD Graphics 620 vendor: Dell driver: i915 v: kernel
    bus-ID: 00:02.0
  Device-2: Realtek Integrated_Webcam_HD type: USB driver: uvcvideo
    bus-ID: 1-5:2
  Display: wayland server: X.org v: 1.21.1.4 with: Xwayland v: 23.2.4
    compositor: kwin_wayland driver: X: loaded: modesetting
    unloaded: fbdev,vesa gpu: i915 resolution: 1920x1080
  OpenGL: renderer: Mesa Intel UHD Graphics 620 (KBL GT2)
    v: 4.6 Mesa 23.2.1-1ubuntu3.1~22.04.2 direct render: Yes
Audio:
  Device-1: Intel Sunrise Point-LP HD Audio vendor: Dell
    driver: snd_hda_intel v: kernel bus-ID: 00:1f.3
  Sound Server-1: ALSA v: k6.5.0-21-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter
    vendor: Dell driver: ath10k_pci v: kernel bus-ID: 01:00.0
  IF: wlp1s0 state: up mac: <filter>
  IF-ID-1: docker0 state: down mac: <filter>
Bluetooth:
  Device-1: Qualcomm Atheros type: USB driver: btusb v: 0.8 bus-ID: 1-7:3
  Report: hciconfig ID: hci0 rfk-id: 0 state: up address: <filter>
    bt-v: 2.1 lmp-v: 4.2
Drives:
  Local Storage: total: 931.51 GiB used: 414.37 GiB (44.5%)
  ID-1: /dev/sda vendor: Crucial model: CT1000MX500SSD1 size: 931.51 GiB
Partition:
  ID-1: / size: 107.72 GiB used: 20.7 GiB (19.2%) fs: ext4 dev: /dev/sda2
  ID-2: /boot/efi size: 299.4 MiB used: 7.6 MiB (2.6%) fs: vfat
    dev: /dev/sda1
  ID-3: /home size: 791.5 GiB used: 393.67 GiB (49.7%) fs: ext4
    dev: /dev/sda3
Swap:
  ID-1: swap-1 type: partition size: 16.01 GiB used: 0 KiB (0.0%)
    dev: /dev/sda4
Sensors:
  System Temperatures: cpu: 40.0 C pch: 37.5 C mobo: 36.0 C sodimm: SODIMM C
  Fan Speeds (RPM): cpu: 0
Info:
  Processes: 262 Uptime: 7m Memory: 15.36 GiB used: 3.45 GiB (22.4%)
  Init: systemd runlevel: 5 Compilers: gcc: 11.4.0 Packages: 2658 Shell: Bash
  v: 5.1.16 inxi: 3.3.13
Comment 8 Nate Graham 2024-03-04 19:51:08 UTC
Thanks, I'll try to replicate that setup myself.
Comment 9 Nate Graham 2024-03-07 15:09:36 UTC
Unfortunately I cannot reproduce the issue. Here's what I'm doing:

1. Have a 2-in-1 laptop (Lenovo ThinkPad X1 Yoga gen 4) with a 14" 4K screen at 200% scale
2. Have an external 27" 1080p screen (some old HP thing) at 100% scale
3. Set the screens to be mirrored. Their scaled resolutions match, so it works perfectly
4. Close the laptop screen. The external screen is now the only active one
5. Open Kickoff and click "Sleep". The system goes to sleep
6. Wake the system up by banging on the connected external keyboard

Result: the system wakes up and external screen displays content, but it looks fine. Touch Mode has not become inappropriately enabled.

I'm starting to think there may be an issue with Libinput's detection of tablet mode on wakeup with your specific hardware.
Comment 10 TraceyC 2024-10-14 23:17:50 UTC
I found this searching to see if there was already a bug I'm seeing on my 2-in-1 (Lenovo Flex API14)
I'm wondering if this might be caused by the same potential issue with libinput? I'm happy to help troubleshoot or provide more information.

Here's what I'm experiencing:
If I set the display to auto rotate, it will not auto rotate *unless* I have "Only when in tablet mode" unchecked

I've used monitor-sensor and I can see the rotation events, but when that checkbox is checked, the screen does not rotate.
Therefore, rotation is working, but the system isn't reporting the status of tablet mode, even when it should be when the keyboard is rotated behind the screen

$ monitor-sensor
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: normal)
=== No ambient light sensor
=== No proximity sensor

    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
Comment 11 TraceyC 2024-10-16 19:20:59 UTC
I'm unable to reproduce the original issues using the same steps Nate did with git-master (Wayland)
Just to note that the external display is not touch-enabled
The icons on the display look fine after the laptop is woken back up while the lid is still closed