Some issues with increasing the value of javafx.animation.pulse

John Hendrikx john.hendrikx at gmail.com
Wed Mar 5 17:17:12 UTC 2025


Hi Glavo,

On 05/03/2025 17:09, Glavo wrote:
> Hi John,
>
> The above feedback is all for Windows, and we have not tested on other
> platforms yet.

Thanks for clarifying. I may be able to help a bit better then as I have
a similar setup.

>
>     On Windows I really don't expect that
>     setting pulse higher will do much (I posted this a few days ago on
>     this
>     list in response to your earlier inquiry)
>
>
> In fact, setting the pulse higher does have a noticeable effect on
> non-HiDPI screens.
> On my 1440p at 120hz monitor it works perfectly and I can clearly feel
> that it no longer has the same stuttering as it does at 60fps.

Could you check the clock resolution on your system when it works
smoothly, you can use this tool:
https://learn.microsoft.com/en-us/sysinternals/downloads/clockres

This is unfortunately a global setting, and will greatly impact the
thread scheduling on Windows systems.  It defaults to 15.625 ms, but
when something like a game or video is running, it may have been changed
to a lower value; the value may differ for example on a fresh reboot,
but be changed to a lower value when certain apps run. I expect that
when it is set to the default, FX will not be able to do smooth 120 Hz
displays as it relies on its thread being scheduled on time (but the
default is only just sufficient for 60 Hz). 

> But when DPI scaling is used, the 60fps stutter reappears and the
> frame rate of the JavaFX application is significantly lower than that
> of other windows.

Could this be simply that more work needs to be done and JavaFX is not
keeping up on a high DPI screen?  I've noticed that when I run my app
full screen on 1920x1200 vs 3840x2160 (one at 100%, the other at 150%)
that the second runs somewhat slower, but it has to display 4x the
pixels... if you suspect display scaling is the issue, you could
temporarily set the display to 100% and try again.

>
>     As for the NVIDIA problem; I doubt that setting
>     "javafx.animation.pulse"
>     can have any effect on this. You may want to look further as to
>     why this
>     problem occurs.
>
>
> This feedback comes from our users. Specifically, we added the
> following code to the application main method:
>
>     System.getProperties().putIfAbsent("javafx.animation.pulse", "120");
>
>
> So users can override the value by adding JVM arguments.
>
> We told the user to try adding the JVM
> argument `-Djavafx.animation.pulse=60`, and the user later told us
> that this solved his problem.
> So we think this is the result of adjusting this property.

Yes, I understand; there is just nothing in the code that would explain
this; it's not like this value is used to change any hardware settings,
it is just a value that is used to increment a long value that keeps
track of the frame time we need to send to animation code. 

--John

>
> Glavo
>  
>
> On Wed, Mar 5, 2025 at 11:09 PM John Hendrikx
> <john.hendrikx at gmail.com> wrote:
>
>     Hi Glavo,
>
>     On which platform is this?  On Windows I really don't expect that
>     setting pulse higher will do much (I posted this a few days ago on
>     this
>     list in response to your earlier inquiry).  It may trigger more frames
>     to be rendered, but their animation times will not use correct values
>     resulting in it just rendering duplicate frames or frames with only
>     slight differences (and not the expected 1/120 difference).
>
>     On the Windows platform I think we need to do some more work to get
>     animations >60 Hz -- specifically, the FX thread needs to be scheduled
>     reliably at intervals lower than 15 ms, which is non-trivial on
>     Windows.
>
>     As for the NVIDIA problem; I doubt that setting
>     "javafx.animation.pulse"
>     can have any effect on this. You may want to look further as to
>     why this
>     problem occurs.
>
>     --John
>
>     On 05/03/2025 07:41, Glavo wrote:
>     > We tried setting javafx.animation.pulse to 120 in our JavaFX
>     application.
>     > After a few days of collecting feedback, we found the following
>     issues
>     >
>     > * Animation frame rate does not seem to be improved on HiDPI screens
>     > on Windows.
>     > * JavaFX applications prevent NVIDIA Advanced Optimus from
>     > automatically selecting graphics cards when
>     javafx.animation.pulse is set.
>     >
>     > Glavo
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20250305/77e91cbd/attachment-0001.htm>


More information about the openjfx-dev mailing list