Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/gfxEnv.h
Line
Count
Source (jump to first uncovered line)
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/. */
5
6
#ifndef GFX_ENV_H
7
#define GFX_ENV_H
8
9
#include "prenv.h"
10
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.
13
//
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 cached.
19
20
#define DECL_GFX_ENV(Env, Name)  \
21
0
  static bool Name() {                \
22
0
    static bool isSet = IsEnvSet(Env);\
23
0
    return isSet;                     \
24
0
  }
Unexecuted instantiation: gfxEnv::ForceCrashGuardNightly()
Unexecuted instantiation: gfxEnv::DumpDebug()
Unexecuted instantiation: gfxEnv::EnableWebRenderRecording()
Unexecuted instantiation: gfxEnv::DebugShaders()
Unexecuted instantiation: gfxEnv::DisableContextSharingGlx()
Unexecuted instantiation: gfxEnv::DisableCrashGuard()
Unexecuted instantiation: gfxEnv::DisableForcePresent()
Unexecuted instantiation: gfxEnv::DumpCompositorTextures()
Unexecuted instantiation: gfxEnv::DumpLayerSortList()
Unexecuted instantiation: gfxEnv::DumpPaint()
Unexecuted instantiation: gfxEnv::DumpPaintIntermediate()
Unexecuted instantiation: gfxEnv::DumpPaintItems()
Unexecuted instantiation: gfxEnv::DumpPaintToFile()
Unexecuted instantiation: gfxEnv::ForceDoubleBuffering()
Unexecuted instantiation: gfxEnv::GfxDevCrashMozCrash()
Unexecuted instantiation: gfxEnv::VRNoDistortion()
Unexecuted instantiation: gfxEnv::GlDebug()
Unexecuted instantiation: gfxEnv::GlDebugVerbose()
Unexecuted instantiation: gfxEnv::GlDebugAbortOnError()
Unexecuted instantiation: gfxEnv::GlDumpExtensions()
Unexecuted instantiation: gfxEnv::GlSpew()
Unexecuted instantiation: gfxEnv::GlxDebug()
Unexecuted instantiation: gfxEnv::LayersEnableXlibSurfaces()
Unexecuted instantiation: gfxEnv::LayersPreferEGL()
Unexecuted instantiation: gfxEnv::LayersPreferOffscreen()
Unexecuted instantiation: gfxEnv::SkipComposition()
Unexecuted instantiation: gfxEnv::SkipRasterization()
Unexecuted instantiation: gfxEnv::NoVRRendering()
25
26
class gfxEnv final
27
{
28
public:
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.
33
34
  // Debugging inside of ContainerLayerComposite
35
  DECL_GFX_ENV("DUMP_DEBUG", DumpDebug);
36
37
  // Use WR recording
38
  DECL_GFX_ENV("ENABLE_WR_RECORDING", EnableWebRenderRecording);
39
40
  // OpenGL shader debugging in OGLShaderProgram, in DEBUG only
41
  DECL_GFX_ENV("MOZ_DEBUG_SHADERS", DebugShaders);
42
43
  // Disabling context sharing in GLContextProviderGLX
44
  DECL_GFX_ENV("MOZ_DISABLE_CONTEXT_SHARING_GLX", DisableContextSharingGlx);
45
46
  // Disabling the crash guard in DriverCrashGuard
47
  DECL_GFX_ENV("MOZ_DISABLE_CRASH_GUARD", DisableCrashGuard);
48
  DECL_GFX_ENV("MOZ_FORCE_CRASH_GUARD_NIGHTLY", ForceCrashGuardNightly);
49
50
  // We force present to work around some Windows bugs - disable that if this
51
  // environment variable is set.
52
  DECL_GFX_ENV("MOZ_DISABLE_FORCE_PRESENT", DisableForcePresent);
53
54
  // Together with paint dumping, only when MOZ_DUMP_PAINTING is defined.
55
  // Dumping compositor textures is broken pretty badly. For example,
56
  // on Linux it crashes TextureHost::GetAsSurface() returns null.
57
  // Expect to have to fix things like this if you turn it on.
58
  // Meanwhile, content-side texture dumping
59
  // (conditioned on DebugDumpPainting()) is a good replacement.
60
  DECL_GFX_ENV("MOZ_DUMP_COMPOSITOR_TEXTURES", DumpCompositorTextures);
61
62
  // Dumping the layer list in LayerSorter
63
  DECL_GFX_ENV("MOZ_DUMP_LAYER_SORT_LIST", DumpLayerSortList);
64
65
  // Paint dumping, only when MOZ_DUMP_PAINTING is defined.
66
  DECL_GFX_ENV("MOZ_DUMP_PAINT", DumpPaint);
67
  DECL_GFX_ENV("MOZ_DUMP_PAINT_INTERMEDIATE", DumpPaintIntermediate);
68
  DECL_GFX_ENV("MOZ_DUMP_PAINT_ITEMS", DumpPaintItems);
69
  DECL_GFX_ENV("MOZ_DUMP_PAINT_TO_FILE", DumpPaintToFile);
70
71
  // Force double buffering in ContentClient
72
  DECL_GFX_ENV("MOZ_FORCE_DOUBLE_BUFFERING", ForceDoubleBuffering);
73
74
  // Force gfxDevCrash to use MOZ_CRASH in Beta and Release
75
  DECL_GFX_ENV("MOZ_GFX_CRASH_MOZ_CRASH", GfxDevCrashMozCrash);
76
  // Force gfxDevCrash to use telemetry in Nightly and Aurora
77
  DECL_GFX_ENV("MOZ_GFX_CRASH_TELEMETRY", GfxDevCrashTelemetry);
78
79
  DECL_GFX_ENV("MOZ_GFX_VR_NO_DISTORTION", VRNoDistortion);
80
81
  // Debugging in GLContext
82
  DECL_GFX_ENV("MOZ_GL_DEBUG", GlDebug);
83
  DECL_GFX_ENV("MOZ_GL_DEBUG_VERBOSE", GlDebugVerbose);
84
  DECL_GFX_ENV("MOZ_GL_DEBUG_ABORT_ON_ERROR", GlDebugAbortOnError);
85
86
  // Count GL extensions
87
  DECL_GFX_ENV("MOZ_GL_DUMP_EXTS", GlDumpExtensions);
88
89
  // Very noisy GLContext and GLContextProviderEGL
90
  DECL_GFX_ENV("MOZ_GL_SPEW", GlSpew);
91
92
  // Do extra work before and after each GLX call in GLContextProviderGLX
93
  DECL_GFX_ENV("MOZ_GLX_DEBUG", GlxDebug);
94
95
  // Use X compositing
96
  DECL_GFX_ENV("MOZ_LAYERS_ENABLE_XLIB_SURFACES", LayersEnableXlibSurfaces);
97
98
  // GL compositing on Windows
99
  DECL_GFX_ENV("MOZ_LAYERS_PREFER_EGL", LayersPreferEGL);
100
101
  // Offscreen GL context for main layer manager
102
  DECL_GFX_ENV("MOZ_LAYERS_PREFER_OFFSCREEN", LayersPreferOffscreen);
103
104
  // Skip final window composition
105
  DECL_GFX_ENV("MOZ_SKIPCOMPOSITION", SkipComposition);
106
107
  // Skip rasterizing painted layer contents
108
  DECL_GFX_ENV("MOZ_SKIPRASTERIZATION", SkipRasterization);
109
110
  // Stop the VR rendering
111
  DECL_GFX_ENV("NO_VR_RENDERING", NoVRRendering);
112
113
  // WARNING:
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.
116
117
private:
118
  // Helper function, can be re-used in the other macros
119
0
  static bool IsEnvSet(const char* aName) {
120
0
    const char* val = PR_GetEnv(aName);
121
0
    return (val != 0 && *val != '\0');
122
0
  }
123
124
0
  gfxEnv() {};
125
0
  ~gfxEnv() {};
126
  gfxEnv(const gfxEnv&) = delete;
127
  gfxEnv& operator=(const gfxEnv&) = delete;
128
};
129
130
#undef DECL_GFX_ENV
131
132
#endif /* GFX_ENV_H */