-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Default vsyncmode #12489
Default vsyncmode #12489
Conversation
c6b4c32
to
a0a78d4
Compare
@fwcd Could you test this on macOS? |
We will need code as part of the config load to change the deprecated values to zero |
Not sure what you mean by that. The deprecrated values are interpreted as default. |
a0a78d4
to
e8a41d5
Compare
@ywwg I have moved the upgrade of the deprecated values to preferences/upgrade.cpp. I left the decision of converting ST_DEFAULT to either ST_PLL or ST_TIMER to VSyncThread, but maybe you prefer to move it to WaveformWidgetFactory, where the config value is read ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you! Yes this is what I imagined for how to handle the values. I made a few small notes.
|
||
VSyncThread::VSyncMode upgradeDeprecatedVSyncModes(int configVSyncMode) { | ||
using VT = VSyncThread; | ||
if (configVSyncMode >= 0 || configVSyncMode <= static_cast<int>(VT::ST_COUNT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is perfect thanks
return VT::ST_TIMER; | ||
case VT::ST_PLL: | ||
return VT::ST_PLL; | ||
case VT::ST_COUNT: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove this case and then change the range check above to < instead of <=. That's a little more clear.
@@ -4,13 +4,22 @@ | |||
#include "util/math.h" | |||
#include "util/performancetimer.h" | |||
|
|||
VSyncThread::VSyncThread(QObject* pParent) | |||
namespace { | |||
VSyncThread::VSyncMode defaultVSyncMode() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
ST_PLL, | ||
ST_COUNT // Dummy Type at last, counting possible types | ||
ST_DEFAULT = 0, | ||
ST_MESA_VBLANK_MODE_1_DEPRECATED, // 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems unnecessary to say what numbers the enums correspond to.
Haven't dug into the details yet, just my observation from quickly test-driving this with the default configuration: While this mostly works well, I also get considerably more frame drops with this build (testing on an M1 Mac): Screen.Recording.2024-01-08.at.23.14.34.movFor comparison, here's Screen.Recording.2024-01-08.at.23.30.57.movSame goes for Screen.Recording.2024-01-08.at.23.13.57.mov |
Perhaps it would make sense to defer this for now, i.e. remove it from the 2.4.0 milestone, to make sure that we have enough time to test this new mode on macOS. |
I am not against that, as in keeping the default ST_TIMER and documenting ST_PLL, but I would like to understand why you are seeing different results than me on an M1. For me with ST_TIMER having good or bad framerate varies per execution, with ST_PLL it is always stable once the PLL is (which is pretty fast). Are you using fixed framerate or ProMotion in your macOS display settings? Are you using the internal (laptop) or an external monitor? If you turn on logging, do you see the PLL settling around 16667 ms? |
I think we can give this another few rounds of testing, but if indeed the results are inconsistent, let's leave the default to ST_TIMER for all platforms. Now that we have a default, we can always enable PLL on mac (or elsewhere) in a minor/patch release |
I will move it to 2.4.1 for now, because it can be considered a bug fix. |
This is using the built-in ProMotion laptop display with variable frame rate.
I'll have to investigate that, you mean the regular debug logging, right? |
Can you try with a fixed framerate?
Yes. It will periodically log the interval resulting from the PLL |
It might be good though to merge this MR anyway, with the minor change of keeping the default ST_TIMER for all platforms. The main reason is that it will write the
to the settings file. This will be easier and less error prone to instruct users to change the value 0 to 5 to try the PLL mode, rather than asking them to add the missing VSync key. |
Hm, I just experienced lots of frame drops with this and logging the PLL showed it was not settling on 16666 microseconds. After changing the refresh rate in the macOS display settings between promotion and back to 60 Hz the problem the problem was fixed and rock solid again. Can you try if that works for you too, @fwcd ? |
@fwcd I found the problem with ProMotion. If the user selected framerate (in mixxx settings) is lower than the actual (PLL) framerate, I run the swap at the nearest multiple interval. So, If the PLL is 60, the user selected frame rate is 30 (or in fact, between 25 and 40), I swap every 2 x 1/60 interval. The implementation to do this was wrong and this become noticeable at 120 fps. I have a fix ready, and will create a separate PR. |
Do we really need the frame rate slider in case of the PLL? |
No, and I'd be happy to remove the logic to deal with the frame rate value. Better keep it simple. In the meantime I have come to the conclusion that with ProMotion driving the continuous swapped->update iteration that triggers the PLL (at 120 fps) I keep getting more frame drops (at 60 fps) than when configuring the display at fixed frame rate. I will continue working on this but in the meantime the conclusion is: to use PLL, configure the display at fixed framerate. @fwcd can you test that? |
I'll test-drive it once I find some time.
In any case we should make sure that the default vsync mode works well, regardless of whether the user uses ProMotion or has set the display to a fixed framerate. |
Yes, I have it working now for both. Just need to do some final cleanup. |
Can you please check #12611 ? |
Oh sorry, I have just realized that I have pushed your changes to 2.4. |
No, I don't see a need to revert it. |
…e, TIMER otherwise, upgrade deprecated modes
c64e793
to
f998eaa
Compare
I tested this on Windows7 and Windows11. The configuration behavior is as intended. Code looking good to me and was before approved by Owen. |
Much appreciated! I will edit the wiki page and the blogpost accordingly (mentioning that ST_PLL is now the default on macOS, and how to select ST_TIMER or ST_PLL explicitly) Out of curiosity, when you say "works very well on windows11", is that better than ST_TIMER or the same? (i.e. when playing, but also when scrolling the library). |
Make VSync mode 0 refer to the default mode; make ST_PLL the default on macOS, ST_TIMER otherwise
Write the mode to the config
where valid are 0 (DEFAULT), 4 (ST_FREE), 5 (ST_PLL), 6 (ST_TIMER)