LCOV - code coverage report
Current view: top level - gfx/thebes - gfxEnv.h (source / functions) Hit Total Coverage
Test: output.info Lines: 8 20 40.0 %
Date: 2017-07-14 16:53:18 Functions: 6 18 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       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             :   static bool Name() {                \
      22             :     static bool isSet = IsEnvSet(Env);\
      23             :     return isSet;                     \
      24             :   }
      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             :   // OpenGL shader debugging in OGLShaderProgram, in DEBUG only
      38           0 :   DECL_GFX_ENV("MOZ_DEBUG_SHADERS", DebugShaders);
      39             : 
      40             :   // Disabling context sharing in GLContextProviderGLX
      41             :   DECL_GFX_ENV("MOZ_DISABLE_CONTEXT_SHARING_GLX", DisableContextSharingGlx);
      42             : 
      43             :   // Disabling the crash guard in DriverCrashGuard
      44             :   DECL_GFX_ENV("MOZ_DISABLE_CRASH_GUARD", DisableCrashGuard);
      45           0 :   DECL_GFX_ENV("MOZ_FORCE_CRASH_GUARD_NIGHTLY", ForceCrashGuardNightly);
      46             : 
      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);
      50             : 
      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          56 :   DECL_GFX_ENV("MOZ_DUMP_COMPOSITOR_TEXTURES", DumpCompositorTextures);
      58             : 
      59             :   // Dumping the layer list in LayerSorter
      60           0 :   DECL_GFX_ENV("MOZ_DUMP_LAYER_SORT_LIST", DumpLayerSortList);
      61             : 
      62             :   // Paint dumping, only when MOZ_DUMP_PAINTING is defined.
      63         247 :   DECL_GFX_ENV("MOZ_DUMP_PAINT", DumpPaint);
      64         176 :   DECL_GFX_ENV("MOZ_DUMP_PAINT_INTERMEDIATE", DumpPaintIntermediate);
      65         309 :   DECL_GFX_ENV("MOZ_DUMP_PAINT_ITEMS", DumpPaintItems);
      66           0 :   DECL_GFX_ENV("MOZ_DUMP_PAINT_TO_FILE", DumpPaintToFile);
      67             : 
      68             :   // Force double buffering in ContentClient
      69           0 :   DECL_GFX_ENV("MOZ_FORCE_DOUBLE_BUFFERING", ForceDoubleBuffering);
      70             : 
      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           0 :   DECL_GFX_ENV("MOZ_GFX_CRASH_TELEMETRY", GfxDevCrashTelemetry);
      75             : 
      76             :   DECL_GFX_ENV("MOZ_GFX_VR_NO_DISTORTION", VRNoDistortion);
      77             : 
      78             :   // Debugging in GLContext
      79           0 :   DECL_GFX_ENV("MOZ_GL_DEBUG", GlDebug);
      80           0 :   DECL_GFX_ENV("MOZ_GL_DEBUG_VERBOSE", GlDebugVerbose);
      81             :   DECL_GFX_ENV("MOZ_GL_DEBUG_ABORT_ON_ERROR", GlDebugAbortOnError);
      82             : 
      83             :   // Count GL extensions
      84           0 :   DECL_GFX_ENV("MOZ_GL_DUMP_EXTS", GlDumpExtensions);
      85             : 
      86             :   // Very noisy GLContext and GLContextProviderELG
      87           0 :   DECL_GFX_ENV("MOZ_GL_SPEW", GlSpew);
      88             : 
      89             :   // Do extra work before and after each GLX call in GLContextProviderGLX
      90           0 :   DECL_GFX_ENV("MOZ_GLX_DEBUG", GlxDebug);
      91             : 
      92             :   // Use X compositing
      93           8 :   DECL_GFX_ENV("MOZ_LAYERS_ENABLE_XLIB_SURFACES", LayersEnableXlibSurfaces);
      94             : 
      95             :   // GL compositing on Windows
      96             :   DECL_GFX_ENV("MOZ_LAYERS_PREFER_EGL", LayersPreferEGL);
      97             : 
      98             :   // Offscreen GL context for main layer manager
      99           0 :   DECL_GFX_ENV("MOZ_LAYERS_PREFER_OFFSCREEN", LayersPreferOffscreen);
     100             : 
     101             :   // Stop the VR rendering
     102             :   DECL_GFX_ENV("NO_VR_RENDERING", NoVRRendering);
     103             : 
     104             :   // WARNING:
     105             :   // Please make sure that you've added your new envvar to the list above in
     106             :   // alphabetical order. Please do not just append it to the end of the list.
     107             : 
     108             : private:
     109             :   // Helper function, can be re-used in the other macros
     110           9 :   static bool IsEnvSet(const char* aName) {
     111           9 :     const char* val = PR_GetEnv(aName);
     112           9 :     return (val != 0 && *val != '\0');
     113             :   }
     114             : 
     115             :   gfxEnv() {};
     116             :   ~gfxEnv() {};
     117             :   gfxEnv(const gfxEnv&) = delete;
     118             :   gfxEnv& operator=(const gfxEnv&) = delete;
     119             : };
     120             : 
     121             : #undef DECL_GFX_ENV
     122             : 
     123             : #endif /* GFX_ENV_H */

Generated by: LCOV version 1.13