xournalpp icon indicating copy to clipboard operation
xournalpp copied to clipboard

Text input causes severe lag

Open seedship opened this issue 4 years ago • 24 comments

Affects versions :

OS: Arch Linux In case of linux, which desktop environment XFCE4 Xournal++ 1.0.17 Describe the bug When using the typing tool, there is severe lag. This lag is not only extremely annoying but causes characters typed to be missed too

To Reproduce Steps to reproduce the behavior:

  1. Open Xournalpp
  2. Use the typing tool
  3. Click anywhere, and the lag will begin

seedship avatar Feb 17 '20 15:02 seedship

Can confirm that the Text tool is really slow on my laptop (which is a pretty fast machine).

Technius avatar Mar 21 '20 20:03 Technius

Confirmed on my laptop as well (linuxmint 19.3): everything else is fine, but text input is so laggy as to be almost unusable.
Note that it seems to be related to GPU drivers in some fashion. Using the "high performance" nvidia gpu (with the proprietary nvidia drivers) I get this issue. Switching to the "power-saving" intel gpu the problem more or less disappears (still a tiny bit laggy, but quite usable).

cverb avatar May 08 '20 14:05 cverb

I can confirm this bug on

  • 1.0.18 535d261d
  • 1.1.0.dev-nightly.20201005-x86_64.AppImage

Manjaro using XFCE 4 + proprietary Nvidia drivers

terrible-solver avatar Oct 14 '20 08:10 terrible-solver

I can confirm this on 1.0.20v on Fedora workstation 33 (btrfs) on both flatpak and rpm.

brpy avatar Jan 13 '21 17:01 brpy

+1, reproducible on arch linux on amd/nvidia system with proprietary nvidia drivers.

haonanq666 avatar Feb 10 '21 00:02 haonanq666

+1 same problem, arch linux 5.11.16, nvidia proprietary 465.24.02, xournalpp 1.0.20

al-jshen avatar Apr 26 '21 03:04 al-jshen

+1, leaving text box open causes periodic stuttering even while tabbed out, Xournal 1.0.20, arch 5.12.3, nvidia 465.27

pilipovicn avatar May 18 '21 08:05 pilipovicn

Does turning cursor blinking off help in version 1.1.0+dev? Note that this can only be done since #2170.

For those of you who use a Gnome-based Linux distro you can find this setting in gnome-control-center, universal access section. grafik See also this description

rolandlo avatar May 18 '21 15:05 rolandlo

I tried using 1.1.0+dev and the problem seems to be mostly gone (left everything on default settings). There's still a small but noticeable delay when typing (especially when hold down backspace), but it is at least usable. No repeated characters or missed characters, no lag outside the app when leaving the text box open.

xournalpp-1.1.0.dev-nightly.20210429-x86_64.AppImage nvidia 465.27-4 arch 5.12.1

al-jshen avatar May 18 '21 16:05 al-jshen

I tried using 1.1.0+dev and the problem seems to be mostly gone (left everything on default settings). There's still a small but noticeable delay when typing (especially when hold down backspace), but it is at least usable. No repeated characters or missed characters, no lag outside the app when leaving the text box open.

xournalpp-1.1.0.dev-nightly.20210429-x86_64.AppImage nvidia 465.27-4 arch 5.12.1

I can confirm that the option you suggested still causes text input lag. xournalpp-1.1.0.dev-nightly.20210429-x86_64.AppImage Nvidia driver version: 460.73.01 uname -r: 5.10.34-1-MANJARO

terrible-solver avatar May 19 '21 21:05 terrible-solver

I can confirm the lags still exist as al-jshen described. xournalpp: 1.0.20 nvidia: 465.31 linux: 5.12.6

riaqn avatar May 27 '21 09:05 riaqn

Problem still exists. Causes severe lag across the whole system.

xournalpp: 1.1.1 nvidia: 510.68.02 linux: 5.17.5

y-usuzumi avatar May 10 '22 04:05 y-usuzumi

same problem here on Ubuntu 20.04 (xournalpp stable)

pietro-coretto avatar Jul 15 '22 15:07 pietro-coretto

Is this still an issue on the latest dev branch? I can't reproduce (neither on 1.1.1 nor on latest master).

bhennion avatar Aug 07 '22 08:08 bhennion

I just checked again. I'm still seeing the same issues on master and on 1.1.1.

lassepe avatar Aug 07 '22 08:08 lassepe

I really can't reproduce... could you give me the versions of GLibc, GTK, Pango and Cairo you are using?

bhennion avatar Aug 07 '22 09:08 bhennion

I'm on Arch and pacman reports the following versions:

glibc 2.35-6 gtk3 1:3.24.34-1 pango 1:1.50.8-1 cairo 1.17.6-2

lassepe avatar Aug 07 '22 10:08 lassepe

Mmm... same versions here, Arch as well. Gnome or other DE? X11 or Wayland? I'm running out of ideas as to where the difference in performance may come from.

bhennion avatar Aug 07 '22 10:08 bhennion

i3 and X11. It doesn't even really feel like a performance bottle neck. It almost feels like a too aggressive de-bounce or something. I cannot type single letters but when I press a key for a long time, then I get it to insert the letter.

lassepe avatar Aug 07 '22 10:08 lassepe

Oh, I just noticed something interesting: this only happens for my external keyboard. When I type on my laptop keyboard, it's totally fine.

lassepe avatar Aug 07 '22 11:08 lassepe

I have had this issue a while ago on my desktop computer where there is no issue regarding an external keyboard. I just tested if I still have this issue on an empty document and it seems that I can't reproduce it anymore. Would be nice if I could remember the version I used back then but these are the information I got for my current setup where I don't have this issue anymore:

Xournal++ 1.1.1 LibGTK 3.24.34 GLibc 2.35-6 GTK3 1:3.24.34-1 Pango 1:1.50.8-1 Cairo 1.17.6-2 NVIDIA's proprietary driver 515.57 Linux kernel 5.10.133-1-MANJARO On Manjaro with GNOME 42.3 and X11. Cursor Blinking is on.

Maybe the issue you have @lassepe is a different one? There seems to be some differences like you not having problems when using your laptop keyboard and also that you have issues when typing a character at any time, right? The severe lag only occurred to me when the cursor bar blinked/appeared. In between this half-a-second blinking interval it was fine. Maybe input from more people who still have this issue could be very helpful.

Nesaijn avatar Aug 07 '22 12:08 Nesaijn

I can confirm this issue on my side with the following setup:

  • Xournal++ version: 1.1.1 (Flathub)
  • OS: EndeavourOS
  • Kernel: 5.19.7-arch1-1
  • DE: KDE Plasma 5.25.5 (using Xorg display server)
  • WM: KWin
  • GPU (integrated / iGPU): Intel HD Graphics 530
  • GPU (dedicated / dGPU): NVIDIA GeForce GTX 960M
    • Driver: Closed-source/proprietary NVIDIA driver, version 515.65.01

After reading about so many people mentioning laptops and NVIDIA and Intel switching and @Nesaijn not being able to reproduce the issue in a desktop PC, I think that just like @cverb thinks it might be an issue regarding the GPU drivers or the rendering software stack in systems with a dual GPU setup (NVIDIA Optimus / Linux PRIME).

However, after experimenting a bit I was able to narrow down the scenario a bit more. In my case, the lag only happens when the "NVIDIA (Performance Mode)" mode (often referred as "NVIDIA-only" or "PRIME mode") is enabled, and in the form of a substantial spike in frame-rendering times every few moments, but almost in a perfect loop and at regular intervals.

https://user-images.githubusercontent.com/48522412/189902582-d1b16e1b-526f-4b98-b628-aeceaacd86ba.mp4

In performance mode, the NVIDIA driver takes over the rendering and compositing of the entire desktop environment session, which makes everything much smoother and makes all applications use the NVIDIA GPU without having to set environment flags or use helpers like prime-run and is the mode most people use. However, it can introduce synchronization issues between the dGPU and the iGPU, with the last being the one that actually drives all displays (be it embedded or external) connected to the device and can cause rendering issues and increase latency in some cases, specially for applications and graphics software that haven't been adapted properly to work with dual GPU setups.

Disabling the NVIDIA-only mode and returning back to the default "NVIDIA On-Demand" mode (often referred as "hybrid mode" or "Optimus mode") fixed the issue for me. In hybrid mode, both GPUs are available to use, but the default GPU and the one that handles the rendering of the desktop environment is the iGPU. If the user wants to use the dGPU with a certain application, they have to either set the appropriate environment variables, use a helper like prime-run or (if the application supports Vulkan) set the dGPU as the one to use in the application settings. Since the GPU that drives the display is the same that renders the desktop environment, less latency is introduced and any software that hasn't been adapted to work with dual GPU setups and ignore PRIME rendering offloading settings will render with the same GPU that is driving the display. I've tested this both with and without prime-run and the results are the same: it works just fine and without any issues.

https://user-images.githubusercontent.com/48522412/189903737-2ddb29f4-13fb-4fd4-9a45-cf2c0d0fe33e.mp4

This might not even be an issue with Xournal++, but with how the libraries it relies on to render the GUI, text and the notebook canvas (Freetype, Cairo, Pango, GTK...) support hardware-accelerated rendering and how well they handle synchronization with the rendering device, the application that is using them and/or the display in dual GPU setups. Maybe updating the libraries to the latest stable release or tweaking how Xournal++ interacts with them could solve this issue.

hobyst avatar Sep 13 '22 12:09 hobyst

I still have this issue on a Desktop with a Nvidia GTX 1060 6GB.

Text insertion mode makes the whole PC lag.

Pherrara avatar Apr 21 '23 15:04 Pherrara

Hello. I have the same issue, I have a laptop with a RTX3070 Max-Q. I also get a similar issue using the highlighter with the line tool. I see the CPU usage going up all the way to 100% when it's doing that. The audio lags as well and overall it's a sluggish experience overall.

inxi -F output:

System: Host: Vic1184-GP66 Kernel: 5.15.0-91-generic x86_64 bits: 64 Desktop: Cinnamon 5.6.8 Distro: Linux Mint 21.1 Vera Machine: Type: Laptop System: Micro-Star product: GP66 Leopard 10UG v: REV:1.0 serial: Mobo: Micro-Star model: MS-1542 v: REV:1.0 serial: UEFI: American Megatrends v: E1542IMS.30A date: 03/09/2021 Battery: ID-1: BAT1 charge: 40.4 Wh (98.5%) condition: 41.0/63.2 Wh (64.9%) CPU: Info: 6-core model: Intel Core i7-10750H bits: 64 type: MT MCP cache: L2: 1.5 MiB Speed (MHz): avg: 1169 min/max: 800/5000 cores: 1: 800 2: 800 3: 801 4: 800 5: 800 6: 800 7: 800 8: 1645 9: 2983 10: 2209 11: 800 12: 800 Graphics: Device-1: Intel CometLake-H GT2 [UHD Graphics] driver: i915 v: kernel Device-2: NVIDIA GA104M [GeForce RTX 3070 Mobile / Max-Q] driver: nvidia v: 535.129.03 Device-3: Acer HD Webcam type: USB driver: uvcvideo Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: modesetting,nvidia unloaded: fbdev,nouveau,vesa gpu: i915 resolution: 1: 1440x2560 2: 1920x1080~144Hz OpenGL: renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2 v: 4.6.0 NVIDIA 535.129.03 Audio: Device-1: Intel Comet Lake PCH cAVS driver: snd_hda_intel Device-2: NVIDIA GA104 High Definition Audio driver: snd_hda_intel Device-3: Kingston HyperX Cloud Alpha S type: USB driver: hid-generic,snd-usb-audio,usbhid Sound Server-1: ALSA v: k5.15.0-91-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: Intel Comet Lake PCH CNVi WiFi driver: iwlwifi IF: wlo1 state: up mac: e0:2b:e9:dd:36:46 Device-2: Intel driver: igc IF: enp5s0 state: down mac: d8:bb:c1:22:68:f1 Bluetooth: Device-1: Intel AX201 Bluetooth type: USB driver: btusb Report: hciconfig ID: hci0 state: up address: E0:2B:E9:DD:36:4A bt-v: 3.0 Drives: Local Storage: total: 709.83 GiB used: 347.53 GiB (49.0%) ID-1: /dev/nvme0n1 vendor: Western Digital model: WDS250G2B0C size: 232.89 GiB ID-2: /dev/nvme1n1 vendor: Kingston model: OM8PCP3512F-AI1 size: 476.94 GiB Partition: ID-1: / size: 476.85 GiB used: 347.52 GiB (72.9%) fs: btrfs dev: /dev/nvme1n1p2 ID-2: /boot/efi size: 92.5 MiB used: 9.4 MiB (10.2%) fs: vfat dev: /dev/nvme1n1p1 ID-3: /home size: 476.85 GiB used: 347.52 GiB (72.9%) fs: btrfs dev: /dev/nvme1n1p2 Swap: Alert: No swap data was found. Sensors: System Temperatures: cpu: 56.0 C pch: 55.0 C mobo: N/A gpu: nvidia temp: 53 C Fan Speeds (RPM): N/A Info: Processes: 426 Uptime: 2h 6m Memory: 15.44 GiB used: 4.97 GiB (32.2%) Shell: Bash inxi: 3.3.13

vic1184 avatar Jan 15 '24 12:01 vic1184