JDK-8289505 : JavaFX choppy with NVIDIA G-SYNC
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: openjfx18
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2022-06-20
  • Updated: 2022-07-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Description
ADDITIONAL SYSTEM INFORMATION :
Win 10, GTX 980 ti

A DESCRIPTION OF THE PROBLEM :
Enabling G-SYNC for windowed applications and having focus in the JavaFX window causes the mouse to be choppy when moving over the whole monitor. (Simple UI, no animations. FRAPS shows that the window has ~2 fps.)


CUSTOMER SUBMITTED WORKAROUND :
Workaround 1 - cause repainting
Selecting text or resizing the window increases fps up to the monitor refresh rate (120 fps), which makes the movement look normal.

Using AnimationTimer produces 120fps, but also consumes CPU:

private boolean focus = false;

public void setStageAndSetupListeners(Stage stage) {
    stage.focusedProperty().addListener((ov, onHidden, onShown) -> focus = ov.getValue());

    AnimationTimer timer = new AnimationTimer() {
        @Override
        public void handle(long now) {
            if (focus) {
                label.setVisible(false);
                label.setVisible(true);
            }
        }
    };
    timer.start();
}


Workaround 2: -Dprism.order=sw
Breaks font rendering - <attached screenshot>


Workaround 3: -Dprism.forceUploadingPainter=true 
It seems to work, but it is "intended for testing and not recommended for production" 
https://mail.openjdk.org/pipermail/openjfx-dev/2020-March/025466.html


FREQUENCY : always