1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11 // To register the check for an environment variable existence (and not empty),
12 // add a line in this file using the DECL_GFX_ENV macro.
14 // For example this line in the .h:
15 // DECL_GFX_ENV("MOZ_DISABLE_CONTEXT_SHARING_GLX",DisableContextSharingGLX);
16 // means that you can call
17 // bool var = gfxEnv::DisableContextSharingGLX();
18 // and that the value will be checked only once, first time we call it, then
21 #define DECL_GFX_ENV(Env, Name) \
22 static bool Name() { \
23 static bool isSet = IsEnvSet(Env); \
29 // This is where DECL_GFX_ENV for each of the environment variables should go.
30 // We will keep these in an alphabetical order by the environment variable,
31 // to make it easier to see if a method accessing an entry already exists.
32 // Just insert yours in the list.
34 // Debugging inside of ContainerLayerComposite
35 DECL_GFX_ENV("DUMP_DEBUG", DumpDebug
);
37 // OpenGL shader debugging in OGLShaderProgram, in DEBUG only
38 DECL_GFX_ENV("MOZ_DEBUG_SHADERS", DebugShaders
);
40 // Disabling context sharing in GLContextProviderGLX
41 DECL_GFX_ENV("MOZ_DISABLE_CONTEXT_SHARING_GLX", DisableContextSharingGlx
);
43 // Disabling the crash guard in DriverCrashGuard
44 DECL_GFX_ENV("MOZ_DISABLE_CRASH_GUARD", DisableCrashGuard
);
45 DECL_GFX_ENV("MOZ_FORCE_CRASH_GUARD_NIGHTLY", ForceCrashGuardNightly
);
47 // We force present to work around some Windows bugs - disable that if this
48 // environment variable is set.
49 DECL_GFX_ENV("MOZ_DISABLE_FORCE_PRESENT", DisableForcePresent
);
51 // Together with paint dumping, only when MOZ_DUMP_PAINTING is defined.
52 // Dumping compositor textures is broken pretty badly. For example,
53 // on Linux it crashes TextureHost::GetAsSurface() returns null.
54 // Expect to have to fix things like this if you turn it on.
55 // Meanwhile, content-side texture dumping
56 // (conditioned on DebugDumpPainting()) is a good replacement.
57 DECL_GFX_ENV("MOZ_DUMP_COMPOSITOR_TEXTURES", DumpCompositorTextures
);
59 // Dumping the layer list in LayerSorter
60 DECL_GFX_ENV("MOZ_DUMP_LAYER_SORT_LIST", DumpLayerSortList
);
62 // Paint dumping, only when MOZ_DUMP_PAINTING is defined.
63 DECL_GFX_ENV("MOZ_DUMP_PAINT", DumpPaint
);
64 DECL_GFX_ENV("MOZ_DUMP_PAINT_INTERMEDIATE", DumpPaintIntermediate
);
65 DECL_GFX_ENV("MOZ_DUMP_PAINT_ITEMS", DumpPaintItems
);
66 DECL_GFX_ENV("MOZ_DUMP_PAINT_TO_FILE", DumpPaintToFile
);
68 // Force double buffering in ContentClient
69 DECL_GFX_ENV("MOZ_FORCE_DOUBLE_BUFFERING", ForceDoubleBuffering
);
71 // Force gfxDevCrash to use MOZ_CRASH in Beta and Release
72 DECL_GFX_ENV("MOZ_GFX_CRASH_MOZ_CRASH", GfxDevCrashMozCrash
);
73 // Force gfxDevCrash to use telemetry in Nightly and Aurora
74 DECL_GFX_ENV("MOZ_GFX_CRASH_TELEMETRY", GfxDevCrashTelemetry
);
76 DECL_GFX_ENV("MOZ_GFX_VR_NO_DISTORTION", VRNoDistortion
);
78 // Debugging in GLContext
79 DECL_GFX_ENV("MOZ_GL_DEBUG", GlDebug
);
80 DECL_GFX_ENV("MOZ_GL_DEBUG_VERBOSE", GlDebugVerbose
);
81 DECL_GFX_ENV("MOZ_GL_DEBUG_ABORT_ON_ERROR", GlDebugAbortOnError
);
83 // Count GL extensions
84 DECL_GFX_ENV("MOZ_GL_DUMP_EXTS", GlDumpExtensions
);
86 // Very noisy GLContext and GLContextProviderEGL
87 DECL_GFX_ENV("MOZ_GL_SPEW", GlSpew
);
90 DECL_GFX_ENV("MOZ_GPU_SWITCHING_SPEW", GpuSwitchingSpew
);
92 // Do extra work before and after each GLX call in GLContextProviderGLX
93 DECL_GFX_ENV("MOZ_GLX_DEBUG", GlxDebug
);
96 DECL_GFX_ENV("MOZ_LAYERS_ENABLE_XLIB_SURFACES", LayersEnableXlibSurfaces
);
98 // GL compositing on Windows
99 DECL_GFX_ENV("MOZ_LAYERS_PREFER_EGL", LayersPreferEGL
);
101 // Offscreen GL context for main layer manager
102 DECL_GFX_ENV("MOZ_LAYERS_PREFER_OFFSCREEN", LayersPreferOffscreen
);
104 // Skip final window composition
105 DECL_GFX_ENV("MOZ_SKIPCOMPOSITION", SkipComposition
);
107 // Skip rasterizing painted layer contents
108 DECL_GFX_ENV("MOZ_SKIPRASTERIZATION", SkipRasterization
);
110 // Stop the VR rendering
111 DECL_GFX_ENV("NO_VR_RENDERING", NoVRRendering
);
114 // Please make sure that you've added your new envvar to the list above in
115 // alphabetical order. Please do not just append it to the end of the list.
118 // Helper function, can be re-used in the other macros
119 static bool IsEnvSet(const char* aName
) {
120 const char* val
= PR_GetEnv(aName
);
121 return (val
!= 0 && *val
!= '\0');
127 gfxEnv(const gfxEnv
&) = delete;
128 gfxEnv
& operator=(const gfxEnv
&) = delete;
133 #endif /* GFX_ENV_H */