slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
16.94k stars 568 forks source link

Bad graphics performances with femtovg on Linux 6.7.0 with nouveau drivers and mesa 23.3.3 on Wayland #4416

Closed abique closed 8 months ago

abique commented 8 months ago

Hi,

I can observe that llvm-pipe's thread pool is blasting my cpu for not doing much actually while all my gnome desktop is smooth.

Linux knot 6.7.0-arch3-1 #1 SMP PREEMPT_DYNAMIC Sat, 13 Jan 2024 14:37:14 +0000 x86_64 GNU/Linux
Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
01:00.0 VGA compatible controller: NVIDIA Corporation TU116 [GeForce GTX 1660 SUPER] (rev a1)
mesa 23.3.3-1
archlinux up to date

I'm compiling slint with:

slint = { version = "1.3.2", default-features = false, features = [
        "compat-1-2",
        "std",
        "serde",
        "backend-winit",
        "backend-winit-wayland",
        "backend-winit-x11",
        "renderer-femtovg",
] }

I wonder if there are some problems in femtovg maybe?

tronical commented 8 months ago

That's not good :(. Are there animations running? Are you using X11 or Wayland? Could you try with the master branch from git?

abique commented 8 months ago

It is on Wayland, I have one image that I rotate continuously, but I think even without it the problem shows up.

abique commented 8 months ago

That's not good :(. Are there animations running? Are you using X11 or Wayland? Could you try with the master branch from git?

How to tell cargo to use slint's git branch?

abique commented 8 months ago

I've switched to skia and it works fine now.

tronical commented 8 months ago

That's not good :(. Are there animations running? Are you using X11 or Wayland? Could you try with the master branch from git?

How to tell cargo to use slint's git branch?

Something like this:

slint = { version = "1.4.0", git = "https://github.com/slint-ui/slint", branch = "master" }

(and the same for slint-build if you're using that)

tronical commented 8 months ago

The FemtoVG renderer isn't thaaat crazy in what it does, but it's a little heavy on the fragment shader side. Perhaps this triggers a bad code path in the nouveau drivers :(. If it works well with Skia, then I'm not sure that there's much that we can do in Slint itself :-(.

Unless something actionable surfaces, I'll close this for now. Would be nice to switch to a different default renderer in the future.

abique commented 8 months ago

@tronical I think I'm happy with skia :+1:

abique commented 8 months ago

Do you want me to give a try to the master branch or it isn't needed?

tronical commented 8 months ago

If you have time, that would be greatly appreciated :)

abique commented 8 months ago

OK

abique commented 8 months ago

On the first run only, gnome said that the window isn't responding for a while. This is maybe related to a shader cache? Could it be that the 1.3.2 version did overflow the shader cache and needed to recompute everything all the time?

Then on every run, the linear gradient is incorrectly rendered. I get this on the console:

MESA: error: ZINK: failed to choose pdev
libEGL warning: egl: failed to create dri2 screen

While it seems to work a bit better, it stills blows the cpu in llvm pipe even if nothing happens and nothing needs to be redrawn.