Skip to content

Commit

Permalink
Bug 1561491 - Make gfx.* static prefs follow the naming convention. r…
Browse files Browse the repository at this point in the history
…=KrisWright

Differential Revision: https://phabricator.services.mozilla.com/D35975
  • Loading branch information
nnethercote committed Jun 26, 2019
1 parent 7d60bb4 commit a63eefa
Show file tree
Hide file tree
Showing 49 changed files with 235 additions and 209 deletions.
4 changes: 2 additions & 2 deletions devtools/server/actors/highlighters/utils/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const { getComputedStyle } = require("./markup");
// This canvas size value is the safest we can use because most GPUs can handle it.
// It's also far from the maximum canvas memory allocation limit (4096x4096x4 is
// 67.108.864 bytes, where the limit is 500.000.000 bytes, see
// MaxAllocSizeDoNotUseDirectly in:
// https://searchfox.org/mozilla-central/source/modules/libpref/init/StaticPrefList.h).
// gfx_max_alloc_size_do_not_use_directly in:
// modules/libpref/init/StaticPrefList.h.
//
// Note:
// Once bug 1232491 lands, we could try to refactor this code to use the values from
Expand Down
8 changes: 5 additions & 3 deletions dom/canvas/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,8 +1231,9 @@ bool CanvasRenderingContext2D::EnsureTarget(const gfx::Rect* aCoveredRect,
}

// Check that the dimensions are sane
if (mWidth > StaticPrefs::MaxCanvasSize() ||
mHeight > StaticPrefs::MaxCanvasSize() || mWidth < 0 || mHeight < 0) {
if (mWidth > StaticPrefs::gfx_canvas_max_size() ||
mHeight > StaticPrefs::gfx_canvas_max_size() || mWidth < 0 ||
mHeight < 0) {
SetErrorState();
return false;
}
Expand Down Expand Up @@ -5667,7 +5668,8 @@ size_t BindingJSObjectMallocBytes(CanvasRenderingContext2D* aContext) {
int32_t height = aContext->GetHeight();

// TODO: Bug 1552137: No memory will be allocated if either dimension is
// greater than gfxPrefs::MaxCanvasSize(). We should check this here too.
// greater than gfxPrefs::gfx_canvas_max_size(). We should check this here
// too.

CheckedInt<uint32_t> bytes = CheckedInt<uint32_t>(width) * height * 4;
if (!bytes.isValid()) {
Expand Down
6 changes: 3 additions & 3 deletions gfx/2d/Factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ mozilla::gfx::Config* Factory::sConfig = nullptr;

static void PrefChanged(const char* aPref, void*) {
mozilla::gfx::LoggingPrefs::sGfxLogLevel =
Preferences::GetInt(StaticPrefs::GetGfxLoggingLevelPrefName(),
StaticPrefs::GetGfxLoggingLevelPrefDefault());
Preferences::GetInt(StaticPrefs::Getgfx_logging_levelPrefName(),
StaticPrefs::Getgfx_logging_levelPrefDefault());
}

void Factory::Init(const Config& aConfig) {
MOZ_ASSERT(!sConfig);
sConfig = new Config(aConfig);
Preferences::RegisterCallback(
PrefChanged,
nsDependentCString(StaticPrefs::GetGfxLoggingLevelPrefName()));
nsDependentCString(StaticPrefs::Getgfx_logging_levelPrefName()));
}

void Factory::ShutDown() {
Expand Down
2 changes: 1 addition & 1 deletion gfx/2d/HelpersWinFonts.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static BYTE GetSystemTextQuality() { return sSystemTextQuality; }

static AntialiasMode GetSystemDefaultAAMode() {
AntialiasMode defaultMode = AntialiasMode::SUBPIXEL;
if (StaticPrefs::DisableAllTextAA()) {
if (StaticPrefs::gfx_text_disable_aa()) {
return AntialiasMode::NONE;
}

Expand Down
2 changes: 1 addition & 1 deletion gfx/2d/ScaledFontBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Atomic<uint32_t> ScaledFont::sDeletionCounter(0);
ScaledFont::~ScaledFont() { sDeletionCounter++; }

AntialiasMode ScaledFont::GetDefaultAAMode() {
if (StaticPrefs::DisableAllTextAA()) {
if (StaticPrefs::gfx_text_disable_aa()) {
return AntialiasMode::NONE;
}

Expand Down
2 changes: 1 addition & 1 deletion gfx/gl/GLContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ GLContext::GLContext(CreateContextFlags flags, const SurfaceCaps& caps,
mDebugFlags(ChooseDebugFlags(flags)),
mSharedContext(sharedContext),
mCaps(caps),
mWorkAroundDriverBugs(StaticPrefs::WorkAroundDriverBugs()) {
mWorkAroundDriverBugs(StaticPrefs::gfx_work_around_driver_bugs()) {
mOwningThreadId = PlatformThread::CurrentId();
MOZ_ALWAYS_TRUE(sCurrentContext.init());
sCurrentContext.set(0);
Expand Down
2 changes: 1 addition & 1 deletion gfx/gl/GLContextProviderCGL.mm
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ bool UseDoubleBufferedWindows() const {
return nullptr;
}

GLint opaque = StaticPrefs::CompositorGLContextOpaque();
GLint opaque = StaticPrefs::gfx_compositor_glcontext_opaque();
[context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];

RefPtr<GLContextCGL> glContext =
Expand Down
2 changes: 1 addition & 1 deletion gfx/gl/GLContextProviderGLX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ bool GLXLibrary::EnsureInitialized() {

if (HasExtension(extensionsStr, "GLX_EXT_texture_from_pixmap") &&
fnLoadSymbols(symbols_texturefrompixmap)) {
mUseTextureFromPixmap = StaticPrefs::UseGLXTextureFromPixmap();
mUseTextureFromPixmap = StaticPrefs::gfx_use_glx_texture_from_pixmap();
} else {
mUseTextureFromPixmap = false;
NS_WARNING("Texture from pixmap disabled");
Expand Down
2 changes: 1 addition & 1 deletion gfx/gl/GLLibraryEGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ PRLibrary* LoadApitraceLibrary() {
if (!path) return nullptr;

// Initialization of gfx prefs here is only needed during the unit tests...
if (!StaticPrefs::UseApitrace()) {
if (!StaticPrefs::gfx_apitrace_enabled()) {
return nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions gfx/gl/GfxTexturesReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ void GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount) {
"GFX: Current texture usage greater than update amount.");
sAmount -= amount;

if (StaticPrefs::GfxLoggingTextureUsageEnabled()) {
if (StaticPrefs::gfx_logging_texture_usage_enabled()) {
printf_stderr("Current texture usage: %s\n",
FormatBytes(sAmount).c_str());
}
} else {
sAmount += amount;
if (sAmount > sPeakAmount) {
sPeakAmount.exchange(sAmount);
if (StaticPrefs::GfxLoggingPeakTextureUsageEnabled()) {
if (StaticPrefs::gfx_logging_peak_texture_usage_enabled()) {
printf_stderr("Peak texture usage: %s\n",
FormatBytes(sPeakAmount).c_str());
}
Expand Down
3 changes: 2 additions & 1 deletion gfx/ipc/GPUParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ mozilla::ipc::IPCResult GPUParent::RecvInit(
}
#ifdef XP_WIN
else {
if (StaticPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater()) {
if (StaticPrefs::gfx_direct3d11_use_double_buffering() &&
IsWin10OrLater()) {
// This is needed to avoid freezing the window on a device crash on double
// buffering, see bug 1549674.
widget::WinCompositorWindowThread::Start();
Expand Down
4 changes: 2 additions & 2 deletions gfx/ipc/GPUProcessManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ void GPUProcessManager::OnProcessLaunchComplete(GPUProcessHost* aHost) {
static bool ShouldLimitDeviceResets(uint32_t count, int32_t deltaMilliseconds) {
// We decide to limit by comparing the amount of resets that have happened
// and time since the last reset to two prefs.
int32_t timeLimit = StaticPrefs::DeviceResetThresholdMilliseconds();
int32_t countLimit = StaticPrefs::DeviceResetLimitCount();
int32_t timeLimit = StaticPrefs::gfx_device_reset_threshold_ms();
int32_t countLimit = StaticPrefs::gfx_device_reset_limit();

bool hasTimeLimit = timeLimit >= 0;
bool hasCountLimit = countLimit >= 0;
Expand Down
6 changes: 3 additions & 3 deletions gfx/layers/LayerScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ LayerScopeWebSocketManager::LayerScopeWebSocketManager()
NS_NewNamedThread("LayerScope", getter_AddRefs(mDebugSenderThread));

mServerSocket = do_CreateInstance(NS_SERVERSOCKET_CONTRACTID);
int port = StaticPrefs::LayerScopePort();
int port = StaticPrefs::gfx_layerscope_port();
mServerSocket->Init(port, false, -1);
mServerSocket->AsyncListen(new SocketListener);
}
Expand Down Expand Up @@ -1465,7 +1465,7 @@ NS_IMETHODIMP LayerScopeWebSocketManager::SocketListener::OnSocketAccepted(
// ----------------------------------------------
/*static*/
void LayerScope::Init() {
if (!StaticPrefs::LayerScopeEnabled() || XRE_IsGPUProcess()) {
if (!StaticPrefs::gfx_layerscope_enabled() || XRE_IsGPUProcess()) {
return;
}

Expand Down Expand Up @@ -1563,7 +1563,7 @@ bool LayerScope::CheckSendable() {
// Only compositor threads check LayerScope status
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread() || gIsGtest);

if (!StaticPrefs::LayerScopeEnabled()) {
if (!StaticPrefs::gfx_layerscope_enabled()) {
return false;
}
if (!gLayerScopeManager.GetSocketManager()) {
Expand Down
6 changes: 4 additions & 2 deletions gfx/layers/apz/src/AsyncPanZoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5089,7 +5089,8 @@ void AsyncPanZoomController::DispatchStateChangeNotification(
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
// Let the compositor know about scroll state changes so it can manage
// windowed plugins.
if (StaticPrefs::HidePluginsForScroll() && mCompositorController) {
if (StaticPrefs::gfx_e10s_hide_plugins_for_scroll() &&
mCompositorController) {
mCompositorController->ScheduleHideAllPluginWindows();
}
#endif
Expand All @@ -5111,7 +5112,8 @@ void AsyncPanZoomController::DispatchStateChangeNotification(
controller->NotifyAPZStateChange(GetGuid(),
APZStateChange::eTransformEnd);
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
if (StaticPrefs::HidePluginsForScroll() && mCompositorController) {
if (StaticPrefs::gfx_e10s_hide_plugins_for_scroll() &&
mCompositorController) {
mCompositorController->ScheduleShowAllPluginWindows();
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions gfx/layers/client/ClientLayerManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ bool ClientLayerManager::EndTransactionInternal(

// Skip the painting if the device is in device-reset status.
if (!gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) {
if (StaticPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
if (StaticPrefs::gfx_content_always_paint() && XRE_IsContentProcess()) {
TimeStamp start = TimeStamp::Now();
root->RenderLayer();
mLastPaintTime = TimeStamp::Now() - start;
Expand Down Expand Up @@ -700,7 +700,7 @@ void ClientLayerManager::ForwardTransaction(bool aScheduleComposite) {
refreshStart = mTransactionStart;
}

if (StaticPrefs::AlwaysPaint() && XRE_IsContentProcess()) {
if (StaticPrefs::gfx_content_always_paint() && XRE_IsContentProcess()) {
mForwarder->SendPaintTime(mLatestTransactionId, mLastPaintTime);
}

Expand Down
4 changes: 2 additions & 2 deletions gfx/layers/client/TextureClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ GetTextureType(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
#endif

#ifdef XP_MACOSX
if (StaticPrefs::UseIOSurfaceTextures()) {
if (StaticPrefs::gfx_use_iosurface_textures()) {
return TextureType::MacIOSurface;
}
#endif

#ifdef MOZ_WIDGET_ANDROID
if (StaticPrefs::UseSurfaceTextureTextures()) {
if (StaticPrefs::gfx_use_surfacetexture_textures()) {
return TextureType::AndroidNativeWindow;
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions gfx/layers/composite/AsyncCompositionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ static bool SampleAnimations(Layer* aLayer,
}

void AsyncCompositionManager::RecordShadowTransforms(Layer* aLayer) {
MOZ_ASSERT(StaticPrefs::CollectScrollTransforms());
MOZ_ASSERT(StaticPrefs::gfx_vsync_collect_scroll_transforms());
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());

ForEachNodePostOrder<ForwardIterator>(aLayer, [this](Layer* layer) {
Expand Down Expand Up @@ -1472,7 +1472,7 @@ bool AsyncCompositionManager::TransformShadowTree(
trans *= gfx::Matrix4x4::From2D(mWorldTransform);
rootComposite->SetShadowBaseTransform(trans);

if (StaticPrefs::CollectScrollTransforms()) {
if (StaticPrefs::gfx_vsync_collect_scroll_transforms()) {
RecordShadowTransforms(root);
}

Expand Down
8 changes: 4 additions & 4 deletions gfx/layers/composite/LayerManagerComposite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ LayerComposite* LayerManagerComposite::RootLayer() const {
void LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion,
const IntRect& aBounds) {
bool drawFps = StaticPrefs::LayersDrawFPS();
bool drawFrameColorBars = StaticPrefs::CompositorDrawColorBars();
bool drawFrameColorBars = StaticPrefs::gfx_draw_color_bars();

if (drawFps) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 650, 400));
Expand All @@ -633,7 +633,7 @@ void LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion,
}

#ifdef USE_SKIA
bool drawPaintTimes = StaticPrefs::AlwaysPaint();
bool drawPaintTimes = StaticPrefs::gfx_content_always_paint();
if (drawPaintTimes) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect()));
}
Expand All @@ -654,7 +654,7 @@ void LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor) {
static uint16_t sFrameCount = 0;
void LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) {
bool drawFps = StaticPrefs::LayersDrawFPS();
bool drawFrameColorBars = StaticPrefs::CompositorDrawColorBars();
bool drawFrameColorBars = StaticPrefs::gfx_draw_color_bars();

// Don't draw diagnostic overlays if we want to snapshot the output.
if (mTarget) {
Expand Down Expand Up @@ -764,7 +764,7 @@ void LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds) {
}

#ifdef USE_SKIA
bool drawPaintTimes = StaticPrefs::AlwaysPaint();
bool drawPaintTimes = StaticPrefs::gfx_content_always_paint();
if (drawPaintTimes) {
DrawPaintTimes(mCompositor);
}
Expand Down
10 changes: 5 additions & 5 deletions gfx/layers/d3d11/CompositorD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ CompositorD3D11::CompositorD3D11(CompositorBridgeParent* aParent,
mIsDoubleBuffered(false),
mVerifyBuffersFailed(false),
mUseMutexOnPresent(false) {
mUseMutexOnPresent = StaticPrefs::UseMutexOnPresent();
mUseMutexOnPresent = StaticPrefs::gfx_use_mutex_on_present();
}

CompositorD3D11::~CompositorD3D11() {}
Expand Down Expand Up @@ -201,7 +201,7 @@ bool CompositorD3D11::Initialize(nsCString* const out_failureReason) {
(IDXGIFactory2**)getter_AddRefs(dxgiFactory2));

#if (_WIN32_WINDOWS_MAXVER >= 0x0A00)
if (StaticPrefs::Direct3D11UseDoubleBuffering() && SUCCEEDED(hr) &&
if (StaticPrefs::gfx_direct3d11_use_double_buffering() && SUCCEEDED(hr) &&
dxgiFactory2 && IsWindows10OrGreater()) {
// DXGI_SCALING_NONE is not available on Windows 7 with Platform Update.
// This looks awful for things like the awesome bar and browser window
Expand Down Expand Up @@ -291,10 +291,10 @@ bool CompositorD3D11::Initialize(nsCString* const out_failureReason) {
}

bool CanUsePartialPresents(ID3D11Device* aDevice) {
if (StaticPrefs::PartialPresent() > 0) {
if (StaticPrefs::gfx_partialpresent_force() > 0) {
return true;
}
if (StaticPrefs::PartialPresent() < 0) {
if (StaticPrefs::gfx_partialpresent_force() < 0) {
return false;
}
if (DeviceManagerDx::Get()->IsWARP()) {
Expand Down Expand Up @@ -1247,7 +1247,7 @@ void CompositorD3D11::EndFrame() {

if (oldSize == mSize) {
Present();
if (StaticPrefs::CompositorClearState()) {
if (StaticPrefs::gfx_compositor_clearstate()) {
mContext->ClearState();
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/d3d11/MLGDeviceD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ bool MLGSwapChainD3D11::Initialize(CompositorWidget* aWidget) {
}

RefPtr<IDXGIFactory2> dxgiFactory2;
if (StaticPrefs::Direct3D11UseDoubleBuffering() &&
if (StaticPrefs::gfx_direct3d11_use_double_buffering() &&
SUCCEEDED(dxgiFactory->QueryInterface(dxgiFactory2.StartAssignment())) &&
dxgiFactory2 && IsWin10OrLater() && XRE_IsGPUProcess()) {
// DXGI_SCALING_NONE is not available on Windows 7 with the Platform Update:
Expand Down
3 changes: 2 additions & 1 deletion gfx/layers/d3d11/TextureD3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ static void DestroyDrawTarget(RefPtr<DrawTarget>& aDT,

D3D11TextureData::~D3D11TextureData() {
if (mDrawTarget) {
if (PaintThread::Get() && StaticPrefs::Direct2DDestroyDTOnPaintThread()) {
if (PaintThread::Get() &&
StaticPrefs::gfx_direct2d_destroy_dt_on_paintthread()) {
RefPtr<DrawTarget> dt = mDrawTarget;
RefPtr<ID3D11Texture2D> tex = mTexture;
RefPtr<Runnable> task = NS_NewRunnableFunction(
Expand Down
4 changes: 2 additions & 2 deletions gfx/layers/ipc/CompositorBridgeParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ PLayerTransactionParent* CompositorBridgeParent::AllocPLayerTransactionParent(
#ifdef XP_WIN
// This is needed to avoid freezing the window on a device crash on double
// buffering, see bug 1549674.
if (StaticPrefs::Direct3D11UseDoubleBuffering() && IsWin10OrLater() &&
if (StaticPrefs::gfx_direct3d11_use_double_buffering() && IsWin10OrLater() &&
XRE_IsGPUProcess()) {
mWidget->AsWindows()->EnsureCompositorWindow();
}
Expand Down Expand Up @@ -1792,7 +1792,7 @@ PWebRenderBridgeParent* CompositorBridgeParent::AllocPWebRenderBridgeParent(
return mWrBridge;
}

if (StaticPrefs::WebRenderSplitRenderRoots()) {
if (StaticPrefs::gfx_webrender_split_render_roots()) {
apis.AppendElement(
apis[0]->CreateDocument(aSize, 1, wr::RenderRoot::Content));
}
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/CompositorVsyncScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ void CompositorVsyncScheduler::Composite(VsyncId aId,
mozilla::Telemetry::COMPOSITE_FRAME_ROUNDTRIP_TIME,
compositeFrameTotal.ToMilliseconds());
} else if (mVsyncNotificationsSkipped++ >
StaticPrefs::CompositorUnobserveCount()) {
StaticPrefs::gfx_vsync_compositor_unobserve_count()) {
UnobserveVsync();
}
}
Expand Down
11 changes: 6 additions & 5 deletions gfx/layers/opengl/CompositorOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,10 +805,11 @@ void CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,

#if defined(MOZ_WIDGET_ANDROID)
if ((mSurfaceOrigin.x > 0) || (mSurfaceOrigin.y > 0)) {
mGLContext->fClearColor(StaticPrefs::CompositorOverrideClearColorR(),
StaticPrefs::CompositorOverrideClearColorG(),
StaticPrefs::CompositorOverrideClearColorB(),
StaticPrefs::CompositorOverrideClearColorA());
mGLContext->fClearColor(
StaticPrefs::gfx_compositor_override_clear_color_r(),
StaticPrefs::gfx_compositor_override_clear_color_g(),
StaticPrefs::gfx_compositor_override_clear_color_b(),
StaticPrefs::gfx_compositor_override_clear_color_a());
} else {
mGLContext->fClearColor(mClearColor.r, mClearColor.g, mClearColor.b,
mClearColor.a);
Expand Down Expand Up @@ -1972,7 +1973,7 @@ GLuint CompositorOGL::GetTemporaryTexture(GLenum aTarget, GLenum aUnit) {
}

bool CompositorOGL::SupportsTextureDirectMapping() {
if (!StaticPrefs::AllowTextureDirectMapping()) {
if (!StaticPrefs::gfx_allow_texture_direct_mapping()) {
return false;
}

Expand Down
Loading

0 comments on commit a63eefa

Please sign in to comment.