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

Laggy UI on Linux (Ubuntu) with two connected displays #23

Closed
igordmn opened this issue Oct 21, 2020 · 21 comments
Closed

Laggy UI on Linux (Ubuntu) with two connected displays #23

igordmn opened this issue Oct 21, 2020 · 21 comments
Assignees
Labels
bug Something isn't working performance

Comments

@igordmn
Copy link
Collaborator

igordmn commented Oct 21, 2020

Following:
#10 (comment)

P.S. I checked that examples/todoapp works fine on my PC/Windows and MacBook: animations/resizing seems aren't laggy (on Windows there are some issues with performance, but they are not always visible)

@arkivanov
Copy link
Contributor

I'm not sure what was the issue, but now it is suddenly fine. It does not lag on my machine.

@arkivanov
Copy link
Contributor

arkivanov commented Oct 21, 2020

Found the reason. It only lags when a secondary monitor is connected. All other apps are fine.

@olonho
Copy link
Contributor

olonho commented Oct 22, 2020

Could be Open GL drivers issue.

@olonho
Copy link
Contributor

olonho commented Nov 6, 2020

Interesting, so not sure if we could do much on Compose side.

@olonho olonho closed this as completed Nov 6, 2020
@ToxicBakery
Copy link

ToxicBakery commented Nov 10, 2020

I'm on Ubunutu as well and compose probably runs at around 15-20 fps. Using nvidia drivers with a 1080ti and a single ultrawide monitor. I ran the CEF demo and interestingly CEF has pretty good frame rates, I can even watch Youtube inside the CEF without issue, but compose continues to have poor frame rate.

Any debugging you would like done that might help highlight what the issue is? Adding some system information to minimize any back and forths on this.

$ uname -a
Linux ubuntu-desktop 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal
$ nvidia-smi 
Tue Nov 10 08:41:46 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 435.21       Driver Version: 435.21       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 108...  Off  | 00000000:42:00.0  On |                  N/A |
| 16%   55C    P0    66W / 250W |    894MiB / 11175MiB |      6%      Default |
+-------------------------------+----------------------+----------------------+

@Dominaezzz
Copy link
Contributor

Dominaezzz commented Nov 24, 2020

I experience lag only when I focus on an OutlinedTextField. Even mouse starts to stutter. (Arch Linux & i3)

@Dominaezzz
Copy link
Contributor

I don't think this has to do with rendering (OpenGL) issues.
I think this has to do with (some kind of) event handling.
I only get lag when there's some sort of animation involved.

@kevincianfarini
Copy link

Which display server is being used? X11, XWayland, or native wayland?

Does the issue persist if you switch sessions to another display server?

@igordmn
Copy link
Collaborator Author

igordmn commented Dec 11, 2020

With two connected monitors, this code:

wrapped.graphicsConfiguration.device.displayMode.refreshRate

can be very slow (50-100ms).
We call it on every frame.

We will try to switch to system vsync instead of this in #137

@igordmn igordmn reopened this Dec 11, 2020
@igordmn igordmn self-assigned this Dec 11, 2020
@igordmn igordmn added bug Something isn't working performance labels Dec 11, 2020
@igordmn igordmn changed the title Laggy UI on Linux (Ubuntu) Laggy UI on Linux (Ubuntu) with two connected displays Dec 11, 2020
@petitJAM
Copy link

I'm getting similar issues running on Ubuntu 20.04 on X11 with multiple monitors. Performance does get worse when a TextField is displayed. I hadn't realized that multiple monitors was the problem until I found this issue, but then I tried it without them attached and it does seem to work smoothly.

I haven't tried on Wayland, but I do have that installed, so I could give it a go soon.

$ uname -a
Linux bryyo 5.4.0-58-generic #64-Ubuntu SMP Wed Dec 9 08:16:25 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Release:	20.04
Codename:	focal
$ nvidia-smi 
Tue Dec 29 08:52:29 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.80.02    Driver Version: 450.80.02    CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Quadro M2200        Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   47C    P0    N/A /  N/A |    743MiB /  4043MiB |     26%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

I've seen the same thing in both of these projects, so I don't think it's related to any specific code that I've written, but just in case it helps:
https://github.com/petitJAM/compose-test-app
https://github.com/petitJAM/Avidity

@Janrupf
Copy link

Janrupf commented Jan 8, 2021

Same issue here, I to be honest have not tested disconnecting monitors, but I will assume that my 3 connected monitors are the issue. Running the demo app and then clicking the button lags the entire desktop for about 2 seconds.

Its just this example code:

fun main() = Window {
    var text by remember { mutableStateOf("Hello, World!") }

    MaterialTheme {
        Button(onClick = {
            text = "Hello, Desktop!"
        }) {
            Text(text)
        }
    }
}

This should be enough to fully reproduce the issue. I want to point out once again that it is enough to click the button in the example and everything lags.

System info:

OS: Arch Linux x86_64
Kernel: 5.10.3-arch1-1
Resolution: 1920x1080, 1920x1080, 1920x1080
WM: i3-gaps
CPU: AMD Ryzen Threadripper 1950X (32) @ 3.400GHz
GPU: NVIDIA GeForce GTX 1080
Memory: 14737MiB / 64223MiB

NVIDIA smi:

Fri Jan  8 19:30:11 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 455.45.01    Driver Version: 455.45.01    CUDA Version: 11.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1080    Off  | 00000000:09:00.0  On |                  N/A |
|  0%   58C    P5    24W / 240W |    994MiB /  8111MiB |     18%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1345      G   /usr/lib/Xorg                     657MiB |
|    0   N/A  N/A      1453      G   ...AAAAAAAA== --shared-files       67MiB |
|    0   N/A  N/A      2479      G   ...AAAAAAAAA= --shared-files       33MiB |
|    0   N/A  N/A     13521      G   kitty                               3MiB |
|    0   N/A  N/A     15561      G   ./ts3client_linux_amd64             2MiB |
|    0   N/A  N/A     35932      G   picom                               2MiB |
|    0   N/A  N/A     35934      G   .../xscreensaver/glslideshow       50MiB |
|    0   N/A  N/A     35935      G   .../xscreensaver/glslideshow       50MiB |
|    0   N/A  N/A     35936      G   .../xscreensaver/glslideshow       50MiB |
|    0   N/A  N/A     48521      G   .../java-14-openjdk/bin/java        7MiB |
+-----------------------------------------------------------------------------+

Killing the compositor and other OpenGL applications doesn't change anything.

@Spationaute
Copy link

I got the same problem:

 OS: Ubuntu 20.04 focal
 Kernel: x86_64 Linux 5.4.0-60-generic
 Resolution: 3840x1080
 DE: GNOME 3.36.4
 CPU: Intel Core i7-8750H @ 12x 4.1GHz [62.0°C]
 GPU: GeForce GTX 1060
 RAM: 11675MiB / 31804MiB
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.32.03    Driver Version: 460.32.03    CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1060    Off  | 00000000:01:00.0  On |                  N/A |
| N/A   58C    P0    23W /  N/A |    349MiB /  6078MiB |      8%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1627      G   /usr/lib/xorg/Xorg                251MiB |
|    0   N/A  N/A      2095      G   /usr/bin/gnome-shell               88MiB |
|    0   N/A  N/A     45660      G   ...m/java-15-oracle/bin/java        5MiB |
+-----------------------------------------------------------------------------+

@igordmn
Copy link
Collaborator Author

igordmn commented Jan 22, 2021

Problem with two displays should be fixed soon.

There is prebuilt version for testing: 0.0.0-vsync-build30

P.S. I discovered a new performance issue with maximized window, not related to this issue.

@Janrupf
Copy link

Janrupf commented Jan 22, 2021

Its fixed, really cool!

@Spationaute
Copy link

Sweet, I changed to the testing version and it doesn't lag anymore! Good job!

@tth05
Copy link

tth05 commented Jan 27, 2021

When will this be merged into a full release? I'm having the same issue, 15 FPS or lower, disconnecting one monitor doesn't help. The custom prebuilt version fixes it though.

@igordmn
Copy link
Collaborator Author

igordmn commented Jan 27, 2021

When will this be merged into a full release?

I hope this week or at the beginning of the next. The changes are on a review now:
https://android-review.googlesource.com/c/platform/frameworks/support/+/1535152
https://android-review.googlesource.com/c/platform/frameworks/support/+/1534675

@igordmn
Copy link
Collaborator Author

igordmn commented Jan 28, 2021

Should be fixed in 0.3.0-build146.

@igordmn igordmn closed this as completed Jan 28, 2021
@sergeyampo
Copy link

Spent so many hours finding how to improve UI performance on Ubuntu 21 with Nvidia graphic card. Tried literally everything but what does help is:
sudo nvidia-settings
image

@okushnikov
Copy link

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@okushnikov
Copy link

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance
Projects
None yet
Development

No branches or pull requests