зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1692609 - Force 60hz for RFP and use that as the time-atom r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D148122
This commit is contained in:
Родитель
abb489882e
Коммит
76a5c5703e
|
@ -29,6 +29,7 @@
|
|||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "mozilla/StaticPrefs_layers.h"
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/StaticPrefs_privacy.h"
|
||||
#include "mozilla/StaticPrefs_webgl.h"
|
||||
#include "mozilla/StaticPrefs_widget.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -942,6 +943,10 @@ void gfxPlatform::Init() {
|
|||
Preferences::RegisterCallback(
|
||||
gfxPlatform::ReInitFrameRate,
|
||||
nsDependentCString(StaticPrefs::GetPrefName_layout_frame_rate()));
|
||||
Preferences::RegisterCallback(
|
||||
gfxPlatform::ReInitFrameRate,
|
||||
nsDependentCString(
|
||||
StaticPrefs::GetPrefName_privacy_resistFingerprinting()));
|
||||
}
|
||||
|
||||
// Create the sRGB to output display profile transforms. They can be accessed
|
||||
|
@ -3024,17 +3029,26 @@ bool gfxPlatform::IsInLayoutAsapMode() {
|
|||
// the second is that the compositor goes ASAP and the refresh driver
|
||||
// goes at whatever the configurated rate is. This only checks the version
|
||||
// talos uses, which is the refresh driver and compositor are in lockstep.
|
||||
// Ignore privacy_resistFingerprinting to preserve ASAP mode there.
|
||||
return StaticPrefs::layout_frame_rate() == 0;
|
||||
}
|
||||
|
||||
static int LayoutFrameRateFromPrefs() {
|
||||
auto val = StaticPrefs::layout_frame_rate();
|
||||
if (StaticPrefs::privacy_resistFingerprinting()) {
|
||||
val = 60;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool gfxPlatform::ForceSoftwareVsync() {
|
||||
return StaticPrefs::layout_frame_rate() > 0;
|
||||
return LayoutFrameRateFromPrefs() > 0;
|
||||
}
|
||||
|
||||
/* static */
|
||||
int gfxPlatform::GetSoftwareVsyncRate() {
|
||||
int preferenceRate = StaticPrefs::layout_frame_rate();
|
||||
int preferenceRate = LayoutFrameRateFromPrefs();
|
||||
if (preferenceRate <= 0) {
|
||||
return gfxPlatform::GetDefaultFrameRate();
|
||||
}
|
||||
|
|
|
@ -156,12 +156,26 @@ nsRFPService* nsRFPService::GetOrCreate() {
|
|||
return sRFPService;
|
||||
}
|
||||
|
||||
constexpr double RFP_TIME_ATOM_MS = 16.667; // 60Hz, 1000/60 but rounded.
|
||||
/*
|
||||
In RFP RAF always runs at 60Hz, so we're ~0.02% off of 1000/60 here.
|
||||
```js
|
||||
extra_frames_per_frame = 16.667 / (1000/60) - 1 // 0.00028
|
||||
sec_per_extra_frame = 1 / (extra_frames_per_frame * 60) // 833.33
|
||||
min_per_extra_frame = sec_per_extra_frame / 60 // 13.89
|
||||
```
|
||||
We expect an extra frame every ~14 minutes, which is enough to be smooth.
|
||||
16.67 would be ~1.4 minutes, which is OK, but is more noticable.
|
||||
Put another way, if this is the only unacceptable hitch you have across 14
|
||||
minutes, I'm impressed, and we might revisit this.
|
||||
*/
|
||||
|
||||
/* static */
|
||||
double nsRFPService::TimerResolution() {
|
||||
double prefValue = StaticPrefs::
|
||||
privacy_resistFingerprinting_reduceTimerPrecision_microseconds();
|
||||
if (StaticPrefs::privacy_resistFingerprinting()) {
|
||||
return std::max(100000.0, prefValue);
|
||||
return std::max(RFP_TIME_ATOM_MS * 1000.0, prefValue);
|
||||
}
|
||||
return prefValue;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче