compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

G-SYNC causes stuttering and flickering

Open lars-reimann opened this issue 3 years ago • 5 comments

Problem

When G-SYNC is active and an app that uses Compose MPP is focused, the refresh rate of the display is lowered considerably, so moving the mouse causes stuttering and flickering. While G-SYNC can simply be turned off during development, this also affects end users of an application. For example, this problem also occurs with the new Jetbrains Toolbox.

Video

https://user-images.githubusercontent.com/2501322/147570078-86f3a856-c717-42f3-b933-b0c1119ca829.mp4

Sorry for the terrible phone recording, but funnily the problem disappears when observed by OBS.

Versions

OS: Windows 11 Build 22000.376 Compose: id("org.jetbrains.compose") version "1.0.1" (building a desktop app) NVIDIA driver: 497.29

lars-reimann avatar Dec 28 '21 13:12 lars-reimann

Hi, any news about this? Compose development and usage of compose apps make my eyes hurt due to flickering :(

The worst thing is that flickering and stuttering occur even when G-SYNC is enabled only for fullscreen apps, not for windowed.

Maybe there is some way to fix it at least for development time, e.g. use another render api/etc? I know that i can disable g-sync completely for specific app in nvidia panel, but it causes the whole screen go black for seconds on every focus gain/loss, so this in not a solution either.

UPD: As a temporary workaround for saving eyes during development SOFTWARE_COMPAT, SOFTWARE or OPENGL renderer can be used instead of DIRECT3D, that causes the flickering. Renderer can be set via environment variable SKIKO_RENDER_API or system propety skiko.renderApi. So System.setProperty("skiko.renderApi", "OPENGL") in main() should be enough.

badmannersteam avatar Aug 28 '22 10:08 badmannersteam

This is indeed a common and serious problem with the JVM GUI and hopefully it will be resolved.

drakeet avatar Aug 28 '22 12:08 drakeet

This is horrendous what is going on with this I bought a gaming computer with the fastest CPU and GPU available on the market and this grinds my computer to a halt randomly and it took me months on end to stumble on to this

terryschmidt avatar Jul 21 '23 20:07 terryschmidt

Hi, any news about this? Compose development and usage of compose apps make my eyes hurt due to flickering :(

The worst thing is that flickering and stuttering occur even when G-SYNC is enabled only for fullscreen apps, not for windowed.

Maybe there is some way to fix it at least for development time, e.g. use another render api/etc? I know that i can disable g-sync completely for specific app in nvidia panel, but it causes the whole screen go black for seconds on every focus gain/loss, so this in not a solution either.

UPD: As a temporary workaround for saving eyes during development SOFTWARE_COMPAT, SOFTWARE or OPENGL renderer can be used instead of DIRECT3D, that causes the flickering. Renderer can be set via environment variable SKIKO_RENDER_API or system propety skiko.renderApi. So System.setProperty("skiko.renderApi", "OPENGL") in main() should be enough.

This is also correct in my experience. The bug happens even if you only tell GSYNC to activate for full screen apps and Jetbrains Toolbox is not a full screen app

terryschmidt avatar Jul 21 '23 20:07 terryschmidt

I can confirm the issue with Compose 1.6.10-beta02 and Kotlin 1.9.22. However, the entire screen is flickering only when I hover over buttons. Disabling G-Sync also fixes the issue, but that is only a temporary solution for development.

The issue is present in the toolbox too, but not during the first window opening when it is manually started. Only if I minimize it to the tray and reopen it. Hope this information is useful for fixing it.

Additionally, marking the window as undecorated and transparent seems to fix the issue too.

malliaridis avatar May 16 '24 17:05 malliaridis

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

okushnikov avatar Jul 14 '24 14:07 okushnikov