Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lagging when scrolling PDF #4770

Closed
rrueger opened this issue Jan 3, 2022 · 9 comments
Closed

Lagging when scrolling PDF #4770

rrueger opened this issue Jan 3, 2022 · 9 comments
Labels
4.20 bug_somewhere_else bug missing-log Read the CONTRIBUTING.md file for instructions

Comments

@rrueger
Copy link

rrueger commented Jan 3, 2022

I'm submitting a…

[x] Bug
[ ] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

When scrolling a PDF in zathura or evince, there is significant lag if the window is larger than about 60% of the screen. The larger the window, the more lag there is.

I am filing this issue under i3 because issue is not present on gnome (both Xorg and Wayland), sway (Wayland).

General scrolling (i.e. in Firefox) is not affected and works perfectly. I am using MOZ_USE_XINPUT2 in /etc/profiles.d/use-xinput2.sh for better scrolling here.

Expected Behavior

That there is no lag when scrolling.

Reproduction Instructions

Open an arbitrary document in zathura, make the window large (doesn't necessarily have to be full screen) and scroll up and down. An example document would be this shimano bike components parts list with many pictures which may exasperate the lagging and make differences more visible.

Environment

Output of i3 --moreversion 2>&-:

i3 version:
Binary i3 version:  4.20.1 (2021-11-03) © 2009 Michael Stapelberg and contributors
Running i3 version: 4.20.1 (2021-11-03) (pid 1126)
Loaded i3 config:
  /home/user/.config/i3/config (main) (last modified: Mon 03 Jan 2022 11:30:30 CET, 242 seconds ago)

The i3 binary you just called: /usr/bin/i3
The i3 binary you are running: i3

Minimal configuration to produce the lag.

set $mod Mod1
font pango:monospace 8
floating_modifier $mod
bindsym $mod+Return exec i3-sensible-terminal
bindsym $mod+Shift+r restart
bindsym $mod+f fullscreen toggle

Since there is no crash, I haven't included the logfile. I happy to do so, if you think it will help for this kind of issue.

- Linux Distribution & Version: Archlinux on 5.15.12-arch1-1
- Are you using a compositor (e.g., xcompmgr or compton): This issue is reproducible with `picom` (with various different backends) and without picom.

I am using a 4k screen on a capable Dell XPS 1510 (i7-11800H 16 Core, 24MB cache, 32 GB RAM). I don't think hardware is a limiting factor.

I have turned off any touchpad acceleration features and reset my libinput configurations to the default. So I don't think it is the scrolling action that is lagging.

This hasn't always been an issue. I cannot pin down exactly when the lagging started, because most of the time I only have documents open on half of the screen.

I suspect this might be some sort of GTK configuration issue, similar to the slow startup of gtk applications in i3, but not in gnome if the xinitrc isn't correctly configured.

For completeness, I am including my ~/.xinitrc below

test -f "/etc/X11/xinit/.Xresources" && xrdb    -merge "/etc/X11/xinit/.Xresources"
test -f "/etc/X11/xinit/.Xmodmap"    && xmodmap "/etc/X11/xinit/.Xmodmap"
test -f "$HOME/.Xresources"          && xrdb    -merge "$HOME/.Xresources"
test -f "$HOME/.Xmodmap"             && xmodmap "$HOME/.Xmodmap"
for file in /etc/X11/xinit/xinitrc.d/?*.sh
do
  [ -x "$file" ] && source "$file"
done
exec i3 --shmlog-size=26214400

I start my X session with xorg-xdm.

@i3bot i3bot added the bug label Jan 3, 2022
@i3bot
Copy link

i3bot commented Jan 3, 2022

I don’t see a link to logs.i3wm.org. Did you follow https://i3wm.org/docs/debugging.html? (In case you actually provided a link to a logfile, please ignore me.)

@i3bot i3bot added missing-log Read the CONTRIBUTING.md file for instructions 4.20 labels Jan 3, 2022
@orestisfl
Copy link
Member

Thanks for your issue but i3 should generally not affect this behavior. To confirm, try reproducing this with another wm like awesomewm or openbox (by simply replacing exec i3 in your xinitrc)

@rrueger
Copy link
Author

rrueger commented Jan 5, 2022

You are right, I tried with both awesome and openbox and observed the same lagging behaviour.

I thought I had covered my bases by also testing in Gnome/Sway.

Do you have any ideas why this would be an issue in i3/openbox/awesome but not in gnome (Xorg)?

This hasn't always been the case with zathura.

I have tested with very old versions of zathura (of which I am confident, that they used to work) and still observed lag.

@rrueger
Copy link
Author

rrueger commented Jan 9, 2022

I have tested this configuration on a 1080p laptop (Dell XPS 9550), and there seems to be no lag. So --- as far as I can tell --- this issue is due to using a 4k screen. I suppose gnome does scaling differently?

I changed the Xft.dpi: 192 in ~/.Xresources and /etc/X11/xdm/Xresources to Xft.dpi: 96 so that zathura performs no scaling, but the issue remains.

@stapelberg
Copy link
Member

I have tested this configuration on a 1080p laptop (Dell XPS 9550), and there seems to be no lag. So --- as far as I can tell --- this issue is due to using a 4k screen.

You could try reducing the resolution on your 4k screen to 1080p to see if the high resolution really is the trigger for the problem.

My guess would be that GNOME and sway are composited, and i3 isn’t. Have you tried using a compositor like https://github.com/chjj/compton to see if that helps?

@rrueger
Copy link
Author

rrueger commented Sep 5, 2022

Thank you @stapelberg for coming back to this issue.

  • I have tried both with a compositor (picom/compton) and without, both with the same (lagging) results.
  • I have verified on another 1080p device that the lagging does not occur there.
  • I have also used xrandr --output eDP1 --mode 1920x1200 to lower the resolution on my 4k capable laptop, and not experienced lagging.
  • The backend poppler/mupdf doesn't make a difference.

The following applications do not lag in i3 on a 4k monitor.

Everything points to the issue lying with Zathura, however the fact that it isn't an issue on gnome (both Xorg and Wayland) or sway somewhat defeats this thesis.

@stapelberg
Copy link
Member

stapelberg commented Sep 7, 2022

I just gave this a shot — using zathura to open https://na.s-tec.shimano.com/s3_assets/filelibrary/Catalogs/2021_Entry_Catalog_ENG_v01.pdf on a 4K display, I don’t see any lag regardless of whether the window is 50% of the screen or in fullscreen mode, and regardless of whether I’m using the Page Up and Page Down keys for scrolling or the mouse wheel.

Can you create a new user account on your machine and reproduce the issue with a default i3 config? Can you also provide a video so that we can see what kind of lag you’re experiencing?

@rrueger
Copy link
Author

rrueger commented Sep 7, 2022

Can you create a new user account on your machine and reproduce the issue with a default i3 config? Can you also provide a video so that we can see what kind of lag you’re experiencing?

Yes!

sudo useradd -m testuser
sudo wget -O ~testuser/test.pdf https://na.s-tec.shimano.com/s3_assets/filelibrary/Catalogs/2021_Entry_Catalog_ENG_v01.pdf
sudo chown -R testuser:testuser ~testuser

Then login via gdm, selecting i3. Complete the i3 default config prompt. Open terminal with <mod>-Enter.

zathura ~/test.pdf

Gives the following videos: one is with lag and fullscreen, the other with no lag where the PDF only fills a third of the screen.

One can clearly see the lag in the fullscreen variant, because after my fingers have left the touchpad, Zathura is still scrolling.

Whilst I haven't shown this in this exact setup:

  • The lag doesn't depend on being fullscreen proper, just that the PDF fills a large part of the screen. The lag seems to get worse the bigger the zathura window is.
  • The lag also appears when using the keyboard scrolling (provided the key-repeat settings are set high enough).

@stapelberg
Copy link
Member

Thanks for the details. I can’t reproduce the issue you’re seeing on any of my machines. I went as close as possible to your setup by testing it on my ThinkPad X1 Extreme running Zathura (poppler) on Fedora, but it scrolls smoothly:

IMG_0873.MOV

To me, it looks like Zathura has trouble keeping up with the scroll events, but I’m not sure why.

Because i3 isn’t in the loop at all when window contents are rendered (Xorg queries Zathura directly, i3 literally can’t tell when window contents are updated), I think you should report this issue with the Zathura developers. They should be able to help you track it down more.

@stapelberg stapelberg closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.20 bug_somewhere_else bug missing-log Read the CONTRIBUTING.md file for instructions
Projects
None yet
Development

No branches or pull requests

4 participants