Coder Social home page Coder Social logo

Neovim-gtk flickers a lot about neovim-gtk HOT 29 CLOSED

daa84 avatar daa84 commented on June 30, 2024 2
Neovim-gtk flickers a lot

from neovim-gtk.

Comments (29)

daa84 avatar daa84 commented on June 30, 2024 4

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.

from neovim-gtk.

daa84 avatar daa84 commented on June 30, 2024

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.

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

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

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

I just recorded a screencast that demonstrates flickering when I open vim-ctrlspace window:
https://www.youtube.com/watch?v=uqoUnieAdg8

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

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).

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@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.

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@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.

from neovim-gtk.

daa84 avatar daa84 commented on June 30, 2024

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

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@daa84 I'll try this branch soon.

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@daa84 Wow, now everything is fine, I see no flickering at all, it works. Thanks, I'll use this branch for now!

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

I could record a screencast if you need it that proves that it works.

from neovim-gtk.

daa84 avatar daa84 commented on June 30, 2024

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.

from neovim-gtk.

glacambre avatar glacambre commented on June 30, 2024

@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!

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@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:

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@daa84 You could add an command-line option to disable double-buffering for users who could have performance issues.

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

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

from neovim-gtk.

akatrevorjay avatar akatrevorjay commented on June 30, 2024

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?

from neovim-gtk.

akatrevorjay avatar akatrevorjay commented on June 30, 2024

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.

from neovim-gtk.

akatrevorjay avatar akatrevorjay commented on June 30, 2024

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

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@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).

from neovim-gtk.

glacambre avatar glacambre commented on June 30, 2024

@akatrevorjay No, my display is 60Hz.

from neovim-gtk.

akatrevorjay avatar akatrevorjay commented on June 30, 2024

@unclechu I use compton already (with vsync) :)

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@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)?

from neovim-gtk.

daa84 avatar daa84 commented on June 30, 2024

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.

from neovim-gtk.

daa84 avatar daa84 commented on June 30, 2024

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.

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

Thanks!

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

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.

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

I'm just leaving here a link to an issue of another editor: equalsraf/neovim-qt#166 (comment)
Where another user mentioned he was having this issue too.

from neovim-gtk.

unclechu avatar unclechu commented on June 30, 2024

@daa84 Now by using 0524e97 I see this is fixed, I'm using neovim-gtk without this environment variable hack and don't see any flickering. Thanks a lot!

from neovim-gtk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.