Mouse glitch under virt-manager with 3D acceleration and OpenGL on

I recently started using qemu/kvm for vms and instantly noticed that performance wasn’t that great So I looked online to see what I can do to improve the performance inside the vms. I saw that turning on 3D acceration and OpenGL gets better performance. And I did. Except the mouse is very glitchy.

For example, inside a vm, if I move the cursor to a corner of a window, then it takes the shape of resize window. Which is expected. But then when I move the cursor away from the corner then it keeps that shape of resize window for some reason. Then cursor turns normal after a while. Same thing happens if I hover my cursor over a link. It takes the shape of a pointing index finger. Which is expected but when I move it away from the link, it keeps the shape of the pointing index finger. This issue is there in Debian XFCE4 vm but not in Debian GNOME vm.

Tried looking online but I couldn’t find anything related to my issue. Any help?

Edit: here’s what I mean

hello @temegec14

may you post the mandatory

inxi --admin --verbosity=7 --filter --no-host --width

to see some infos like cpu, used governor etc… what type of mouse are you using ? usb, bluetooth, wired ? a bluetooth-mice and vm might cause issues.
i’m not sure if using opengl and 3d-acceleration is really helping or just minimizing the issue. but let’s see what inxi tells.

p.s.: what os’es are you using in your vm’s ?

hello @Olli thx for your response.

here’s the outout.

System:
  Kernel: 5.15.138-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: hpet,acpi_pm
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.15-x86_64
    root=UUID=9ac9639f-b7a3-4f1c-9c4b-3d1b7c06f60f rw quiet splash apparmor=1
    security=apparmor resume=UUID=c2fe50c4-8036-4618-be86-5285ebe9e781
    udev.log_priority=3
  Desktop: GNOME v: 45.1 tk: GTK v: 3.24.38 wm: gnome-shell dm: GDM v: 45.0.1
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: Dell product: Inspiron 15-3567 v: N/A
    serial: <superuser required> Chassis: type: 9 serial: <superuser required>
  Mobo: Dell model: 01HV08 v: A00 serial: <superuser required> UEFI: Dell
    v: 2.9.0 date: 01/17/2019
Battery:
  ID-1: BAT0 charge: 33.7 Wh (81.8%) condition: 41.2/44.4 Wh (92.7%)
    volts: 16.0 min: 14.8 model: LGC-LGC2.80 DELL 7PY0D type: Li-ion
    serial: <filter> status: discharging
Memory:
  System RAM: total: 24 GiB available: 23.35 GiB used: 13.7 GiB (58.7%)
  RAM Report: permissions: Unable to run dmidecode. Root privileges required.
CPU:
  Info: model: Intel Core i5-7200U bits: 64 type: MT MCP arch: Amber/Kaby Lake
    note: check gen: core 7 level: v3 note: check built: 2017 process: Intel 14nm
    family: 6 model-id: 0x8E (142) stepping: 9 microcode: 0xF4
  Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache:
    L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB
    L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 2983 high: 3096 min/max: 400/3100 scaling:
    driver: intel_pstate governor: powersave cores: 1: 3094 2: 3096 3: 3093
    4: 2651 bogomips: 21607
  Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
    arch_capabilities arch_perfmon art avx avx2 bmi1 bmi2 bts clflush
    clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64
    dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu
    fsgsbase fxsr ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs ida
    intel_pt invpcid invpcid_single lahf_lm lm mca mce md_clear mmx monitor
    movbe mpx msr mtrr nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm
    pdpe1gb pebs pge pln pni popcnt pse pse36 pti pts rdrand rdseed rdtscp
    rep_good sdbg sep smap smep ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp
    syscall tm tm2 tpr_shadow tsc tsc_adjust tsc_deadline_timer vme vmx vnmi
    vpid x2apic xgetbv1 xsave xsavec xsaveopt xsaves xtopology xtpr
  Vulnerabilities:
  Type: gather_data_sampling mitigation: Microcode
  Type: itlb_multihit status: KVM: Split huge pages
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: retbleed mitigation: IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl and seccomp
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: IBRS, IBPB: conditional, STIBP: conditional,
    RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel HD Graphics 620 vendor: Dell driver: i915 v: kernel
    arch: Gen-9.5 process: Intel 14nm built: 2016-20 ports: active: HDMI-A-1
    off: eDP-1 empty: none bus-ID: 00:02.0 chip-ID: 8086:5916 class-ID: 0300
  Device-2: Realtek Integrated_Webcam_HD driver: uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-5:3 chip-ID: 0bda:5769
    class-ID: 0e02 serial: <filter>
  Display: wayland server: X.org v: 1.21.1.9 with: Xwayland v: 23.2.2
    compositor: gnome-shell driver: X: loaded: modesetting alternate: fbdev,vesa
    dri: iris gpu: i915 display-ID: 0
  Monitor-1: HDMI-A-1 model: Acer V227Q H serial: <filter> built: 2023
    res: 1920x1080 dpi: 102 gamma: 1.2 size: 476x267mm (18.74x10.51")
    diag: 546mm (21.5") ratio: 16:9 modes: max: 1920x1080 min: 720x400
  Monitor-2: eDP-1 model: AU Optronics 0x71ec built: 2016 res: 1366x768
    dpi: 101 gamma: 1.2 size: 344x193mm (13.54x7.6") diag: 394mm (15.5")
    ratio: 16:9 modes: 1366x768
  API: EGL Message: EGL data requires eglinfo. Check --recommends.
Audio:
  Device-1: Intel Sunrise Point-LP HD Audio vendor: Dell driver: snd_hda_intel
    v: kernel alternate: snd_soc_skl bus-ID: 00:1f.3 chip-ID: 8086:9d71
    class-ID: 0403
  API: ALSA v: k5.15.138-1-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: JACK v: 1.9.22 status: off tools: N/A
  Server-2: PipeWire v: 0.3.85 status: off with: pipewire-media-session
    status: active tools: pw-cli
  Server-3: PulseAudio v: 16.1 status: active with: 1: pulseaudio-alsa
    type: plugin 2: pulseaudio-jack type: module tools: pacat,pactl
Network:
  Device-1: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter
    vendor: Dell driver: ath10k_pci v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 bus-ID: 01:00.0 chip-ID: 168c:0042 class-ID: 0280
  IF: wlp1s0 state: up mac: <filter>
  IP v4: <filter> type: dynamic noprefixroute scope: global
    broadcast: <filter>
  IP v6: <filter> type: noprefixroute scope: link
  Device-2: Realtek RTL810xE PCI Express Fast Ethernet vendor: Dell
    driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: e000
    bus-ID: 02:00.0 chip-ID: 10ec:8136 class-ID: 0200
  IF: enp2s0 state: down mac: <filter>
  IF-ID-1: virbr0 state: up speed: 10 Mbps duplex: unknown mac: <filter>
  IP v4: <filter> scope: global broadcast: <filter>
  IF-ID-2: vnet11 state: unknown speed: 10 Mbps duplex: full mac: <filter>
  IP v6: <filter> scope: link
  WAN IP: <filter>
Bluetooth:
  Device-1: Qualcomm Atheros driver: btusb v: 0.8 type: USB rev: 2.0
    speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-8:5 chip-ID: 0cf3:e009
    class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 2 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: see --recommends
Logical:
  Message: No logical block device data found.
RAID:
  Message: No RAID data found.
Drives:
  Local Storage: total: 465.76 GiB used: 167.75 GiB (36.0%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 870 EVO 500GB
    size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    tech: SSD serial: <filter> fw-rev: 1B6Q scheme: GPT
  Optical-1: /dev/sr0 vendor: HL-DT-ST model: DVD+-RW GU90N rev: A1C3
    dev-links: cdrom
  Features: speed: 24 multisession: yes audio: yes dvd: yes
    rw: cd-r,cd-rw,dvd-r,dvd-ram state: running
Partition:
  ID-1: / raw-size: 334 GiB size: 327.69 GiB (98.11%) used: 167.72 GiB (51.2%)
    fs: ext4 dev: /dev/sda5 maj-min: 8:5 label: N/A
    uuid: 9ac9639f-b7a3-4f1c-9c4b-3d1b7c06f60f
  ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%)
    used: 27.8 MiB (29.0%) fs: vfat dev: /dev/sda1 maj-min: 8:1 label: N/A
    uuid: F241-AA15
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: yes
    compressor: zstd max-pool: 20%
  ID-1: swap-1 type: partition size: 12.21 GiB used: 7.6 MiB (0.1%)
    priority: -2 dev: /dev/sda4 maj-min: 8:4 label: N/A
    uuid: c2fe50c4-8036-4618-be86-5285ebe9e781
Unmounted:
  ID-1: /dev/sda2 maj-min: 8:2 size: 16 MiB fs: <superuser required> label: N/A
    uuid: N/A
  ID-2: /dev/sda3 maj-min: 8:3 size: 118.48 GiB fs: ntfs label: N/A
    uuid: D4BC42C5BC42A1BA
  ID-3: /dev/sda6 maj-min: 8:6 size: 488 MiB fs: vfat label: N/A
    uuid: 989C-4122
  ID-4: /dev/sda7 maj-min: 8:7 size: 499 MiB fs: ntfs label: N/A
    uuid: 141080BF1080A976
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 12 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 1-1:6 info: MosArt 2.4G Keyboard Mouse type: keyboard,mouse
    driver: hid-generic,usbhid interfaces: 2 rev: 1.1 speed: 12 Mb/s (1.4 MiB/s)
    lanes: 1 mode: 1.1 power: 100mA chip-ID: 062a:5918 class-ID: 0301
  Device-2: 1-5:3 info: Realtek Integrated_Webcam_HD type: video
    driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1
    mode: 2.0 power: 500mA chip-ID: 0bda:5769 class-ID: 0e02 serial: <filter>
  Device-3: 1-6:4 info: Realtek RTS5129 Card Reader Controller
    type: <vendor specific> driver: rtsx_usb,rtsx_usb_ms,rtsx_usb_sdmmc
    interfaces: 1 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0
    power: 500mA chip-ID: 0bda:0129 class-ID: ff00 serial: <filter>
  Device-4: 1-8:5 info: Qualcomm Atheros type: bluetooth driver: btusb
    interfaces: 2 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1
    power: 100mA chip-ID: 0cf3:e009 class-ID: e001
  Hub-2: 2-0:1 info: super-speed hub ports: 6 rev: 3.0
    speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 chip-ID: 1d6b:0003
    class-ID: 0900
Sensors:
  System Temperatures: cpu: 59.0 C pch: 52.5 C mobo: 52.0 C
  Fan Speeds (rpm): cpu: 0
Info:
  Processes: 293 Uptime: 21h 8m wakeups: 1 Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: 1808 pm: dpkg pkgs: 0 pm: pacman pkgs: 1754 libs: 464
  tools: gnome-software,pamac,yay pm: rpm pkgs: 0 pm: appimage pkgs: 0
  pm: flatpak pkgs: 41 pm: snap pkgs: 13 Shell: Zsh v: 5.9
  running-in: gnome-terminal inxi: 3.3.31

Weirdly, the mouse issue is only there when I enabled 3D acceleration and opengl.

I’m using Debian 12 XFCE4 and Debian 12 Gnome in my VMs. The issue is in only XFCE4 edition for some reason.

Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache:
    L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB
    L3: 3 MiB desc: 1x3 MiB
  Speed (MHz): avg: 2983 high: 3096 min/max: 400/3100 scaling:
    driver: intel_pstate governor: powersave 

the first issue:
before using a vm change the cpu-speed manually to performance, otherwise it’s terrible experience.

https://wiki.archlinux.org/title/Scaling_governor

well, your cpu isn’t a monster for vm’s

second: check the xfce4 edition if it is using wayland or x11.

third:
check if you create a new vm from iso the following: usually a linux-installer asks you if you wanna use open or propietary drivers for the gpu.
if you choose propietary-driver they will/should install the RedHat-Virtio-display-driver that is excellent.

Changing the CPU governor to performance didn’t help. Issue is still there.

Debian XFCE4 is using x11.

Using debian’s default installer doesn’t ask whether to install open source or proprietary drivers. So by default it installs everything open source.

your RAM-size is good but as said your cpu isn’t that kind of thing to run a vm. however, can you try to create a manjaro-vm and choose the propietary driver at the beginning of the installation. afterwards check that the red-hat-display-driver is usable in the display-size-settings. if you setup this vm use just the default-settings of kvm/virt-manager, they work fine with it.

I don’t think it’s a cpu related issue as videos and games runs very smoothly under vm. Might be a missing driver issue as you pointed it out.

Fyi, here’s the screenshot of the issue:

Yes, I can reproduce your problem, even with Manjaro or any other Distro. It is rather a problem of the spice server inside the VM, which renders/encodes the virtual screen and you see it on the spice client. It renders the cursor separately and sometimes it cannot catch the cursor properly due the layer latency, I suppose.

If you need acceleration on the VM and when the Host GPU is at least Intel Broadwell, then take look at Intel GVT-g: Intel GVT-g - ArchWiki But note that it will disable Hardware Accelerated Video Decoding in favor of a GPU pass-through.

First off, really appreciate you for reproducing the phenomenon I’m experiencing.

Second, glad I’m not the only one experiencing this :sweat_smile:

and finally, will defo take a look at attached link and give it a try.

Tysm again!