2015-10-28 16:31:00 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef GFX_ENV_H
|
|
|
|
#define GFX_ENV_H
|
|
|
|
|
|
|
|
#include "prenv.h"
|
|
|
|
|
|
|
|
// To register the check for an environment variable existence (and not empty),
|
|
|
|
// add a line in this file using the DECL_GFX_ENV macro.
|
|
|
|
//
|
|
|
|
// For example this line in the .h:
|
2016-06-09 14:06:00 +03:00
|
|
|
// DECL_GFX_ENV("MOZ_DISABLE_CONTEXT_SHARING_GLX",DisableContextSharingGLX);
|
2015-10-28 16:31:00 +03:00
|
|
|
// means that you can call
|
|
|
|
// bool var = gfxEnv::DisableContextSharingGLX();
|
|
|
|
// and that the value will be checked only once, first time we call it, then
|
|
|
|
// cached.
|
|
|
|
|
2016-06-09 14:06:00 +03:00
|
|
|
#define DECL_GFX_ENV(Env, Name) \
|
2015-10-28 16:31:00 +03:00
|
|
|
static bool Name() { \
|
|
|
|
static bool isSet = IsEnvSet(Env); \
|
|
|
|
return isSet; \
|
|
|
|
}
|
|
|
|
|
|
|
|
class gfxEnv final {
|
|
|
|
public:
|
|
|
|
// This is where DECL_GFX_ENV for each of the environment variables should go.
|
|
|
|
// We will keep these in an alphabetical order by the environment variable,
|
|
|
|
// to make it easier to see if a method accessing an entry already exists.
|
|
|
|
// Just insert yours in the list.
|
|
|
|
|
|
|
|
// Debugging inside of ContainerLayerComposite
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("DUMP_DEBUG", DumpDebug);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
2017-07-17 08:38:22 +03:00
|
|
|
// Use WR recording
|
2017-08-15 10:40:55 +03:00
|
|
|
DECL_GFX_ENV("ENABLE_WR_RECORDING", EnableWebRenderRecording);
|
2017-07-17 08:38:22 +03:00
|
|
|
|
2015-10-28 16:31:00 +03:00
|
|
|
// OpenGL shader debugging in OGLShaderProgram, in DEBUG only
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_DEBUG_SHADERS", DebugShaders);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Disabling context sharing in GLContextProviderGLX
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_DISABLE_CONTEXT_SHARING_GLX", DisableContextSharingGlx);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Disabling the crash guard in DriverCrashGuard
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_DISABLE_CRASH_GUARD", DisableCrashGuard);
|
|
|
|
DECL_GFX_ENV("MOZ_FORCE_CRASH_GUARD_NIGHTLY", ForceCrashGuardNightly);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
2016-03-28 19:59:38 +03:00
|
|
|
// We force present to work around some Windows bugs - disable that if this
|
|
|
|
// environment variable is set.
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_DISABLE_FORCE_PRESENT", DisableForcePresent);
|
2016-03-28 19:59:38 +03:00
|
|
|
|
2015-10-28 16:31:00 +03:00
|
|
|
// Together with paint dumping, only when MOZ_DUMP_PAINTING is defined.
|
|
|
|
// Dumping compositor textures is broken pretty badly. For example,
|
|
|
|
// on Linux it crashes TextureHost::GetAsSurface() returns null.
|
|
|
|
// Expect to have to fix things like this if you turn it on.
|
|
|
|
// Meanwhile, content-side texture dumping
|
|
|
|
// (conditioned on DebugDumpPainting()) is a good replacement.
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_DUMP_COMPOSITOR_TEXTURES", DumpCompositorTextures);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Dumping the layer list in LayerSorter
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_DUMP_LAYER_SORT_LIST", DumpLayerSortList);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Paint dumping, only when MOZ_DUMP_PAINTING is defined.
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_DUMP_PAINT", DumpPaint);
|
|
|
|
DECL_GFX_ENV("MOZ_DUMP_PAINT_INTERMEDIATE", DumpPaintIntermediate);
|
|
|
|
DECL_GFX_ENV("MOZ_DUMP_PAINT_ITEMS", DumpPaintItems);
|
|
|
|
DECL_GFX_ENV("MOZ_DUMP_PAINT_TO_FILE", DumpPaintToFile);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Force double buffering in ContentClient
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_FORCE_DOUBLE_BUFFERING", ForceDoubleBuffering);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
2015-11-09 09:28:00 +03:00
|
|
|
// Force gfxDevCrash to use MOZ_CRASH in Beta and Release
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_GFX_CRASH_MOZ_CRASH", GfxDevCrashMozCrash);
|
2015-11-09 09:28:00 +03:00
|
|
|
// Force gfxDevCrash to use telemetry in Nightly and Aurora
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_GFX_CRASH_TELEMETRY", GfxDevCrashTelemetry);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_GFX_VR_NO_DISTORTION", VRNoDistortion);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Debugging in GLContext
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_GL_DEBUG", GlDebug);
|
|
|
|
DECL_GFX_ENV("MOZ_GL_DEBUG_VERBOSE", GlDebugVerbose);
|
|
|
|
DECL_GFX_ENV("MOZ_GL_DEBUG_ABORT_ON_ERROR", GlDebugAbortOnError);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Count GL extensions
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_GL_DUMP_EXTS", GlDumpExtensions);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
2018-05-10 10:48:07 +03:00
|
|
|
// Very noisy GLContext and GLContextProviderEGL
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_GL_SPEW", GlSpew);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
2019-07-02 19:45:22 +03:00
|
|
|
//
|
|
|
|
DECL_GFX_ENV("MOZ_GPU_SWITCHING_SPEW", GpuSwitchingSpew);
|
|
|
|
|
2016-06-07 01:26:44 +03:00
|
|
|
// Do extra work before and after each GLX call in GLContextProviderGLX
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_GLX_DEBUG", GlxDebug);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Use X compositing
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_LAYERS_ENABLE_XLIB_SURFACES", LayersEnableXlibSurfaces);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// GL compositing on Windows
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_LAYERS_PREFER_EGL", LayersPreferEGL);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// Offscreen GL context for main layer manager
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("MOZ_LAYERS_PREFER_OFFSCREEN", LayersPreferOffscreen);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
2018-09-04 03:18:11 +03:00
|
|
|
// Skip final window composition
|
|
|
|
DECL_GFX_ENV("MOZ_SKIPCOMPOSITION", SkipComposition);
|
|
|
|
|
|
|
|
// Skip rasterizing painted layer contents
|
|
|
|
DECL_GFX_ENV("MOZ_SKIPRASTERIZATION", SkipRasterization);
|
|
|
|
|
2015-10-28 16:31:00 +03:00
|
|
|
// Stop the VR rendering
|
2016-06-09 14:06:00 +03:00
|
|
|
DECL_GFX_ENV("NO_VR_RENDERING", NoVRRendering);
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
// WARNING:
|
|
|
|
// Please make sure that you've added your new envvar to the list above in
|
|
|
|
// alphabetical order. Please do not just append it to the end of the list.
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Helper function, can be re-used in the other macros
|
|
|
|
static bool IsEnvSet(const char* aName) {
|
2016-06-07 01:26:44 +03:00
|
|
|
const char* val = PR_GetEnv(aName);
|
2015-10-28 16:31:00 +03:00
|
|
|
return (val != 0 && *val != '\0');
|
|
|
|
}
|
|
|
|
|
|
|
|
gfxEnv(){};
|
|
|
|
~gfxEnv(){};
|
|
|
|
gfxEnv(const gfxEnv&) = delete;
|
|
|
|
gfxEnv& operator=(const gfxEnv&) = delete;
|
|
|
|
};
|
|
|
|
|
2016-06-09 14:06:00 +03:00
|
|
|
#undef DECL_GFX_ENV
|
2015-10-28 16:31:00 +03:00
|
|
|
|
|
|
|
#endif /* GFX_ENV_H */
|