Closed glacambre closed 6 years ago
From description looks like cursor repaint produce flicker, as when window not in focus - cursor stops. Flickering can happens when double buffer is disabled, but by default it must be enabled.
I have the same issue when I open vim-ctrlspace window, since I started to use neovim-gtk, I've never reported it because I haven't found a way to simply reproduce it. I tried to make clean init.vim
with only vim-ctrlspace but in this case this flickering isn't happening, so I think it's not related to just vim-ctrlspace. Here is my config: https://github.com/unclechu/neovimrc
I just recorded a screencast that demonstrates flickering when I open vim-ctrlspace window: https://www.youtube.com/watch?v=uqoUnieAdg8
Sometimes it's getting worse, on this video it's quite better than usual. Sometimes this happens even without opening vim-ctrlspace window, and even if I restart neovim-gtk it still happens. When this happens I just open TUI and go back to neovim-gtk after some time and this at least again happens only with vim-ctrlspace window (looks like some black magic).
@daa84 I just realized it happens during cursor blinking animation. I just met a moment when this blinking was at its worst rate and I see that in pauses of cursor blinking animation whole screen isn't blinking.
@daa84 look at my dirty hotfix to test it with cursor without blinking: https://github.com/daa84/neovim-gtk/compare/master...unclechu:dirty-fix/cursor-without-animation?expand=1 It just gets it better, not heals it completely, I still got flickering when I move selection in list of buffers in vim-ctrlspace but when I'm not touching anything it stills without flickering. See screencast: https://youtu.be/dgXCopYP7N0
P.S. Maybe it would be a good idea to add an command-line option to disable cursor animation, not just in sense of this issue but as an option for a user.
The big question is why so strange thing happens? Gtk by default have double buffering enabled. So it can be just some nvim blinking.
Can you run RUST_LOG=nvim_gtk::shell cargo run
to check logs, maybe some resize events come when flickering happens?
Another way i can try is to do double buffering by hand with cairo surface. Maybe in some environments double buffer is disabled by default
Created test branch with double buffering through second cairo surface. https://github.com/daa84/neovim-gtk/tree/double_buffer @unclechu can you test this branch? Solution is a bit dirty, but i want to find problem source.
@daa84 I'll try this branch soon.
@daa84 Wow, now everything is fine, I see no flickering at all, it works. Thanks, I'll use this branch for now!
I could record a screencast if you need it that proves that it works.
strange, i always think that gtk do double buffering for cairo automatically. But looks like in some cases it does not. Can you write your configuration? wayland/xorg, video driver?
Current double buffer solution think bad for performance. Later i adapt this changes better way.
@daa84 The double_buffer branch fixes the flickering on my end too!
Running RUST_LOG=nvim_gtk::shell cargo run
on the master branch doesn't produce any output.
Here are bits of information about my configuration I found in my X11 log in case you need it.
Matched modesetting as autoconfigured driver 0
Matched fbdev as autoconfigured driver 1
Matched vesa as autoconfigured driver 2
Assigned the driver to the xf86ConfigLayout
Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
Loading /usr/lib/xorg/modules/drivers/fbdev_drv.so
Loading /usr/lib/xorg/modules/drivers/vesa_drv.so
FBDEV: driver for framebuffer: fbdev
VESA: driver for VESA chipsets: vesa
glamor: OpenGL accelerated X.org driver based.
modeset(0): [DRI2] DRI driver: i965
modeset(0): [DRI2] VDPAU driver: i965
I run the i3 window manager without a compositor if that makes a difference.
Thank you for fixing this bug!
@daa84 xorg.conf.txt
Compton (composite manager) running command:
compton --dbus --backend glx \
--blur-background --blur-background-fixed --blur-kern 7x7box \
-c -z -r 10 -o 0.3 -t -10 \
--xinerama-shadow-crop \
-m 0.9
λ lspci | grep -i vga
00:02.0 VGA compatible controller: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller (rev 06)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tobago PRO [Radeon R7 360 / R9 360 OEM] (rev 81)
λ glxinfo | grep -i opengl
OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD BONAIRE (DRM 2.50.0 / 4.13.16-100.fc25.x86_64, LLVM 3.9.1)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 17.0.5
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 17.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 17.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
@daa84 You could add an command-line option to disable double-buffering for users who could have performance issues.
Anyway, I think some usually unnoticeable performance issues (I personally haven't noticed any lags) is better than issues with my eyes. Maybe it would be good idea to ask about that in issues of package that provides it? I think it's here: https://github.com/gtk-rs/cairo/issues
I noticed this too. Glad there's a fix here now. New laptop with 120hz display; nvidia proprietary driver.
@glacambre Is your display by chance > 60hz?
So, the branch at least for me only removes ~90% of the flickering, but it still happens every few seconds, especially during redraw upon move.
Actually now it stopped flickering at all; strange.
If it happens again I'll report back, otherwise I'll assume I may have ran it before compilation and installation was complete.
Kudos +42
@akatrevorjay That it is still flickering a bit could be some tearing caused by your proprietary video driver. Which DE do you use? You could try some composite manager with vsync feature as attempt to fix it (such as compton).
@akatrevorjay No, my display is 60Hz.
@unclechu I use compton already (with vsync) :)
@daa84 Isn't that fix for double-buffering already in master branch (I'm just asking if I still urged to use separated branch or could try fresh master)?
no, it still not merged. As this fix slowdown rendering i plan to introduce env variable that will switch double buffering behavior (by default it will be disabled). As not all user have such problems with flickering.
merged fix to master, by default disabled,
environment variable NVIM_GTK_DOUBLE_BUFFER=1
can be used to enable it
maybe later i remove it, if this buffer will be used for some other functionality.
Thanks!
Maybe this would help someone, my nvim
file in ~/.local/bin
:
#!/usr/bin/env bash
env NVIM_GTK_DOUBLE_BUFFER=1 \
"$HOME/neovim-gtk-2018-04-08-74d7417/bin/nvim-gtk" "$@" || exit $?
To auto-enable NVIM_GTK_DOUBLE_BUFFER
flag where $HOME/neovim-gtk-2018-04-08-74d7417
is a path in where you installed neovim-gtk.
I'm just leaving here a link to an issue of another editor: https://github.com/equalsraf/neovim-qt/issues/166#issuecomment-375065567 Where another user mentioned he was having this issue too.
@daa84 Now by using 0524e97b8ab1fc2207abb3e827fa7c5cff9207b3 I see this is fixed, I'm using neovim-gtk without this environment variable hack and don't see any flickering. Thanks a lot!
Hi, I'm trying to run neovim-gtk on my computer (Linux 4.14, Debian, X11, integrated GPU) and it flickers a lot. I tried running neovim-gtk with an empty init.vim and also making the window smaller, nothing changed. The only way to make the flickering stop on my computer is to focus another window.
I don't really know how to troubleshoot this issue, if you need more information, feel free to ask.
Pretty cool project by the way ! :)