зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1550422
- P18. Convert gfxPrefs::LayoutFrameRate to StaticPrefs. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D31461 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3992dfb602
Коммит
0815888321
|
@ -9,7 +9,6 @@
|
|||
#include "nsIWidget.h"
|
||||
#include <OpenGL/gl.h>
|
||||
#include "gfxFailure.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
#include "prenv.h"
|
||||
#include "GeckoProfiler.h"
|
||||
|
@ -99,7 +98,7 @@ bool GLContextCGL::MakeCurrentImpl() const {
|
|||
// If swapInt is 1, then glSwapBuffers will block and wait for a vblank signal.
|
||||
// When we're iterating as fast as possible, however, we want a non-blocking
|
||||
// glSwapBuffers, which will happen when swapInt==0.
|
||||
GLint swapInt = gfxPrefs::LayoutFrameRate() == 0 ? 0 : 1;
|
||||
GLint swapInt = StaticPrefs::LayoutFrameRate() == 0 ? 0 : 1;
|
||||
[mContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "gfxUtils.h"
|
||||
#include "gfx2DGlue.h"
|
||||
#include "GLScreenBuffer.h"
|
||||
#include "gfxPrefs.h"
|
||||
|
||||
#include "gfxCrashReporterUtils.h"
|
||||
|
||||
|
@ -598,7 +597,7 @@ bool GLContextGLX::MakeCurrentImpl() const {
|
|||
// Many GLX implementations default to blocking until the next
|
||||
// VBlank when calling glXSwapBuffers. We want to run unthrottled
|
||||
// in ASAP mode. See bug 1280744.
|
||||
const bool isASAP = (gfxPrefs::LayoutFrameRate() == 0);
|
||||
const bool isASAP = (StaticPrefs::LayoutFrameRate() == 0);
|
||||
mGLX->fSwapInterval(mDisplay, mDrawable, isASAP ? 0 : 1);
|
||||
}
|
||||
return succeeded;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#ifdef MOZ_WIDGET_GTK
|
||||
# include "gfxPlatformGtk.h" // for gfxPlatform
|
||||
#endif
|
||||
#include "gfxPrefs.h" // for gfxPrefs
|
||||
#include "mozilla/AutoRestore.h" // for AutoRestore
|
||||
#include "mozilla/ClearOnShutdown.h" // for ClearOnShutdown
|
||||
#include "mozilla/DebugOnly.h" // for DebugOnly
|
||||
|
@ -298,7 +297,7 @@ static int32_t CalculateCompositionFrameRate() {
|
|||
int32_t compositionFrameRatePref = StaticPrefs::LayersCompositionFrameRate();
|
||||
if (compositionFrameRatePref < 0) {
|
||||
// Use the same frame rate for composition as for layout.
|
||||
int32_t layoutFrameRatePref = gfxPrefs::LayoutFrameRate();
|
||||
int32_t layoutFrameRatePref = StaticPrefs::LayoutFrameRate();
|
||||
if (layoutFrameRatePref < 0) {
|
||||
// TODO: The main thread frame scheduling code consults the actual
|
||||
// monitor refresh rate in this case. We should do the same.
|
||||
|
|
|
@ -823,6 +823,16 @@ class WrRolloutPrefShutdownSaver : public nsIObserver {
|
|||
}
|
||||
};
|
||||
|
||||
static void FrameRatePrefChanged(const char* aPref, void*) {
|
||||
int32_t newRate = gfxPlatform::ForceSoftwareVsync()
|
||||
? gfxPlatform::GetSoftwareVsyncRate()
|
||||
: -1;
|
||||
if (newRate != gLastUsedFrameRate) {
|
||||
gLastUsedFrameRate = newRate;
|
||||
gfxPlatform::ReInitFrameRate();
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(WrRolloutPrefShutdownSaver, nsIObserver)
|
||||
|
||||
void gfxPlatform::Init() {
|
||||
|
@ -967,14 +977,9 @@ void gfxPlatform::Init() {
|
|||
}
|
||||
|
||||
gLastUsedFrameRate = ForceSoftwareVsync() ? GetSoftwareVsyncRate() : -1;
|
||||
auto updateFrameRateCallback = [](const GfxPrefValue& aValue) -> void {
|
||||
int32_t newRate = ForceSoftwareVsync() ? GetSoftwareVsyncRate() : -1;
|
||||
if (newRate != gLastUsedFrameRate) {
|
||||
gLastUsedFrameRate = newRate;
|
||||
ReInitFrameRate();
|
||||
}
|
||||
};
|
||||
gfxPrefs::SetLayoutFrameRateChangeCallback(updateFrameRateCallback);
|
||||
Preferences::RegisterCallback(
|
||||
FrameRatePrefChanged,
|
||||
nsDependentCString(StaticPrefs::GetLayoutFrameRatePrefName()));
|
||||
// Set up the vsync source for the parent process.
|
||||
ReInitFrameRate();
|
||||
|
||||
|
@ -3057,18 +3062,18 @@ 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.
|
||||
return gfxPrefs::LayoutFrameRate() == 0;
|
||||
return StaticPrefs::LayoutFrameRate() == 0;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool gfxPlatform::ForceSoftwareVsync() {
|
||||
return gfxPrefs::LayoutFrameRate() > 0 ||
|
||||
return StaticPrefs::LayoutFrameRate() > 0 ||
|
||||
recordreplay::IsRecordingOrReplaying();
|
||||
}
|
||||
|
||||
/* static */
|
||||
int gfxPlatform::GetSoftwareVsyncRate() {
|
||||
int preferenceRate = gfxPrefs::LayoutFrameRate();
|
||||
int preferenceRate = StaticPrefs::LayoutFrameRate();
|
||||
if (preferenceRate <= 0) {
|
||||
return gfxPlatform::GetDefaultFrameRate();
|
||||
}
|
||||
|
|
|
@ -291,8 +291,6 @@ class gfxPrefs final {
|
|||
|
||||
DECL_GFX_PREF(Once, "layers.windowrecording.path", LayersWindowRecordingPath, std::string, std::string());
|
||||
|
||||
DECL_GFX_PREF(Live, "layout.frame_rate", LayoutFrameRate, int32_t, -1);
|
||||
|
||||
// WARNING:
|
||||
// Please make sure that you've added your new preference to the list above
|
||||
// in alphabetical order.
|
||||
|
|
|
@ -3631,6 +3631,7 @@ VARCACHE_PREF(Live, "layout.display-list.dump-parent", LayoutDumpDisplayLi
|
|||
VARCACHE_PREF(Live, "layout.display-list.show-rebuild-area", LayoutDisplayListShowArea, RelaxedAtomicBool, false);
|
||||
VARCACHE_PREF(Live, "layout.display-list.flatten-transform", LayoutFlattenTransform, RelaxedAtomicBool, true);
|
||||
|
||||
VARCACHE_PREF(Live, "layout.frame_rate", LayoutFrameRate, RelaxedAtomicInt32, -1);
|
||||
VARCACHE_PREF(Live, "layout.min-active-layer-size", LayoutMinActiveLayerSize, int, 64);
|
||||
VARCACHE_PREF(Once, "layout.paint_rects_separately", LayoutPaintRectsSeparately, RelaxedAtomicBool, true);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче