Bug 454558 - kwin detects wrong display size when qemu VM window is resized
Summary: kwin detects wrong display size when qemu VM window is resized
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.24.90
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-29 10:54 UTC by Kishore Gopalakrishnan
Modified: 2022-06-18 13:29 UTC (History)
1 user (show)

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


Attachments
config xml file for the QEMU VM (6.23 KB, application/xml)
2022-05-29 10:57 UTC, Kishore Gopalakrishnan
Details
Initial Screen before resize (3.60 MB, image/png)
2022-05-31 07:24 UTC, Big Husky
Details
Screen after any resize action (3.06 MB, image/png)
2022-05-31 07:26 UTC, Big Husky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2022-05-29 10:54:10 UTC
SUMMARY
When kwin is run inside a QEMU VM with spice display and the VM window is resized, kwin resizes the display to the wrong size, resulting in an unusable VM. This is on X11 (not sure what happens on wayland). This was working correctly with kwin 5.24.5

STEPS TO REPRODUCE
1. Using virt-manager, create a qemu VM with graphics type="spice"
2. Install spice-vdagent in the guest
3. In the guest, create a file `~/.config/systemd/user/spice-vdagent.service`, with the following content (this is required in case you are using systemd startup for Plasma stuff. Otherwise, spice-vdagent should start automatically):
```
[Unit]
Description=Spice guest session agent
After=plasma-core.target

[Service]
ExecStart=/usr/bin/spice-vdagent -x

[Install]
WantedBy=plasma-core.target
```
4. In the guest, systemctl enable --user spice-vdagent
5. Reboot the guest
6. After logging into the plasma X11 session in the guest, resize the VM window

OBSERVED RESULTS
Display is in some other size/aspect ratio different from the VM window. This is the behaviour with 5.24.90.

EXPECTED RESULTS
Display of the VM should be resized according to the VM window. This is the behaviour with 5.24.5.

SOFTWARE VERSIONS (on guest)
Operating System: Arch Linux
KDE Plasma Version: 5.24.90
KDE Frameworks Version: 5.94.0
Qt Version: 5.15.4
Kernel Version: 5.15.43-1-lts (64-bit)
Graphics Platform: X11
Processors: 4 × AMD EPYC-Rome Processor
Memory: 1.4 GiB of RAM
Graphics Processor: virgl
Manufacturer: QEMU
Product Name: Standard PC (Q35 + ICH9, 2009)
System Version: pc-q35-5.1

ADDITIONAL INFORMATION
A. I have noticed the same issue in the KDE Neon (unstable) guest as well.
B. Downgrading kwin to 5.24.5 fixes the issue
Comment 1 Kishore Gopalakrishnan 2022-05-29 10:57:12 UTC
Created attachment 149307 [details]
config xml file for the QEMU VM

Here is the config I used for the VM
Comment 2 Big Husky 2022-05-31 07:24:33 UTC
Created attachment 149343 [details]
Initial Screen before resize
Comment 3 Big Husky 2022-05-31 07:26:54 UTC
Created attachment 149344 [details]
Screen after any resize action
Comment 4 Big Husky 2022-05-31 07:31:27 UTC
Hi
the same happens running in VMware Fusion 12 VM's. The same happens on Arch Linux and on KDE Neon.
Resizing or trying to go full screen results in an ultra large window that is unusable. Am also using X11. Haven't tried with Wayland .

It makes no difference if you use the title bars or maximise button or you use the KDE System Preferences to change resolution. The result remains the same.
As the original poster mentions, this worked fine all the way to the latest 5.24.5 release.

Attached two screenshots.
Comment 5 Big Husky 2022-06-11 19:08:37 UTC
Situation is unchanged on latest updates. 
KDE Neon now shows KDE Plasma Version: 5.25.0 , KDE Frameworks Version: 5.95.0 and Qt Version 5.15.4
Comment 6 Big Husky 2022-06-16 08:28:09 UTC
Looks llke it is resolved in the latest, released version with KDE Neon.
Awaiting ArchLinux updates to confirm.
Comment 7 Big Husky 2022-06-17 06:57:28 UTC
Also working in ArchLinux now
Comment 8 Kishore Gopalakrishnan 2022-06-18 13:29:22 UTC
Also cannot reproduce on 

Operating System: Arch Linux
KDE Plasma Version: 5.25.0
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.4
Kernel Version: 5.18.3-arch1-1 (64-bit)
Graphics Platform: X11