author | Jeff Gilbert <jgilbert@mozilla.com> |
Fri, 24 Oct 2014 18:26:41 -0700 | |
changeset 215867 | 8890eab664bf0660d4295162457397a42e9fcbb2 |
parent 215866 | cbcafb38ad62408208d35c7aaf00f93661c6d5be |
child 215868 | 261e7681ed027a3b5da5e10b6b110e027c343ce2 |
push id | 51872 |
push user | jgilbert@mozilla.com |
push date | Fri, 14 Nov 2014 23:23:49 +0000 |
treeherder | mozilla-inbound@8890eab664bf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jrmuizel |
bugs | 1089018 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/gl/GLContext.cpp +++ b/gfx/gl/GLContext.cpp @@ -499,21 +499,21 @@ GLContext::InitWithPrefix(const char *pr }; mInitialized = LoadSymbols(&symbols[0], trygl, prefix); MakeCurrent(); if (mInitialized) { uint32_t version = 0; ParseGLVersion(this, &version); -#ifdef MOZ_GL_DEBUG - printf_stderr("OpenGL version detected: %u\n", version); - printf_stderr("OpenGL vendor: %s\n", fGetString(LOCAL_GL_VENDOR)); - printf_stderr("OpenGL renderer: %s\n", fGetString(LOCAL_GL_RENDERER)); -#endif + if (ShouldSpew()) { + printf_stderr("OpenGL version detected: %u\n", version); + printf_stderr("OpenGL vendor: %s\n", fGetString(LOCAL_GL_VENDOR)); + printf_stderr("OpenGL renderer: %s\n", fGetString(LOCAL_GL_RENDERER)); + } if (version >= mVersion) { mVersion = version; } // Don't fail if version < mVersion, see bug 999445, // Mac OSX 10.6/10.7 machines with Intel GPUs claim only OpenGL 1.4 but // have all the GL2+ extensions that we need. } @@ -634,36 +634,32 @@ GLContext::InitWithPrefix(const char *pr sDebugMode |= DebugTrace; // aborts on GL error. Can be useful to debug quicker code that is known not to generate any GL error in principle. if (PR_GetEnv("MOZ_GL_DEBUG_ABORT_ON_ERROR")) sDebugMode |= DebugAbortOnError; #endif if (mInitialized) { -#ifdef MOZ_GL_DEBUG - static bool firstRun = true; - if (firstRun && DebugMode()) { - const char *vendors[size_t(GLVendor::Other)] = { + if (ShouldSpew()) { + const char* vendors[size_t(GLVendor::Other)] = { "Intel", "NVIDIA", "ATI", "Qualcomm" }; MOZ_ASSERT(glVendorString); if (mVendor < GLVendor::Other) { printf_stderr("OpenGL vendor ('%s') recognized as: %s\n", glVendorString, vendors[size_t(mVendor)]); } else { printf_stderr("OpenGL vendor ('%s') unrecognized\n", glVendorString); } } - firstRun = false; -#endif InitExtensions(); InitFeatures(); // Disable extensions with partial or incorrect support. if (WorkAroundDriverBugs()) { if (Renderer() == GLRenderer::AdrenoTM320) { MarkUnsupported(GLFeature::standard_derivatives); @@ -1596,24 +1592,18 @@ GLContext::DebugCallback(GLenum source, void GLContext::InitExtensions() { MakeCurrent(); const char* extensions = (const char*)fGetString(LOCAL_GL_EXTENSIONS); if (!extensions) return; -#ifdef MOZ_GL_DEBUG - static bool firstRun = true; -#else - // Non-DEBUG, so never spew. - const bool firstRun = false; -#endif - - InitializeExtensionsBitSet(mAvailableExtensions, extensions, sExtensionNames, firstRun && DebugMode()); + InitializeExtensionsBitSet(mAvailableExtensions, extensions, + sExtensionNames); if (WorkAroundDriverBugs() && Vendor() == GLVendor::Qualcomm) { // Some Adreno drivers do not report GL_OES_EGL_sync, but they really do support it. MarkExtensionSupported(OES_EGL_sync); } @@ -1646,20 +1636,16 @@ GLContext::InitExtensions() if (WorkAroundDriverBugs() && nsCocoaFeatures::OSXVersionMajor() == 10 && nsCocoaFeatures::OSXVersionMinor() == 9 && Renderer() == GLRenderer::IntelHD3000) { MarkExtensionUnsupported(EXT_texture_compression_s3tc); } #endif - -#ifdef MOZ_GL_DEBUG - firstRun = false; -#endif } void GLContext::PlatformStartup() { RegisterStrongMemoryReporter(new GfxTexturesReporter()); } @@ -2286,33 +2272,32 @@ ReportArrayContents(const char *title, c printf_stderr("%d ", copy[i].name); } printf_stderr("\n"); } void GLContext::ReportOutstandingNames() { - if (!DebugMode()) + if (!ShouldSpew()) return; printf_stderr("== GLContext %p Outstanding ==\n", this); ReportArrayContents("Outstanding Textures", mTrackedTextures); ReportArrayContents("Outstanding Buffers", mTrackedBuffers); ReportArrayContents("Outstanding Queries", mTrackedQueries); ReportArrayContents("Outstanding Programs", mTrackedPrograms); ReportArrayContents("Outstanding Shaders", mTrackedShaders); ReportArrayContents("Outstanding Framebuffers", mTrackedFramebuffers); ReportArrayContents("Outstanding Renderbuffers", mTrackedRenderbuffers); } #endif /* DEBUG */ - void GLContext::GuaranteeResolve() { if (mScreen) { mScreen->AssureBlitted(); } fFinish(); } @@ -2450,10 +2435,17 @@ DoesStringMatch(const char* aString, con // aWantedVendor followed by alpha character const char *afterOccurrence = occurrence + strlen(aWantedString); if (isalpha(*afterOccurrence)) return false; return true; } +/*static*/ bool +GLContext::ShouldSpew() +{ + static bool spew = PR_GetEnv("MOZ_GL_SPEW"); + return spew; +} + } /* namespace gl */ } /* namespace mozilla */
--- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -460,56 +460,54 @@ public: void MarkExtensionUnsupported(GLExtensions aKnownExtension) { mAvailableExtensions[aKnownExtension] = 0; } void MarkExtensionSupported(GLExtensions aKnownExtension) { mAvailableExtensions[aKnownExtension] = 1; } - public: - template<size_t N> - static void InitializeExtensionsBitSet(std::bitset<N>& extensionsBitset, const char* extStr, const char** extList, bool verbose = false) + static void InitializeExtensionsBitSet(std::bitset<N>& extensionsBitset, + const char* extStr, + const char** extList) { char* exts = ::strdup(extStr); - if (verbose) + if (ShouldSpew()) printf_stderr("Extensions: %s\n", exts); char* cur = exts; bool done = false; while (!done) { char* space = strchr(cur, ' '); if (space) { *space = '\0'; } else { done = true; } for (int i = 0; extList[i]; ++i) { if (PL_strcasecmp(cur, extList[i]) == 0) { - if (verbose) + if (ShouldSpew()) printf_stderr("Found extension %s\n", cur); extensionsBitset[i] = true; } } cur = space + 1; } free(exts); } - protected: std::bitset<Extensions_Max> mAvailableExtensions; - // ----------------------------------------------------------------------------- // Feature queries /* * This mecahnism introduces a new way to check if a OpenGL feature is * supported, regardless of whether it is supported by an extension or natively * by the context version/profile */ public: @@ -3693,16 +3691,17 @@ public: #endif protected: bool mHeavyGLCallsSinceLastFlush; public: void FlushIfHeavyGLCallsSinceLastFlush(); + static bool ShouldSpew(); }; bool DoesStringMatch(const char* aString, const char *aWantedString); } /* namespace gl */ } /* namespace mozilla */
--- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -800,17 +800,17 @@ GLContextEGL::CreateEGLPBufferOffscreenC || foundConfigs == 0) { NS_WARNING("No EGL Config for minimal PBuffer!"); return nullptr; } // We absolutely don't care, so just pick the first one. config = configs[0]; - if (GLContext::DebugMode()) + if (GLContext::ShouldSpew()) sEGLLibrary.DumpEGLConfig(config); gfxIntSize pbSize(size); surface = GLContextEGL::CreatePBufferSurfaceTryingPowerOfTwo(config, LOCAL_EGL_NONE, pbSize); if (!surface) { NS_WARNING("Failed to create PBuffer for context!");
--- a/gfx/gl/GLLibraryEGL.cpp +++ b/gfx/gl/GLLibraryEGL.cpp @@ -118,17 +118,17 @@ GLLibraryEGL::EnsureInitialized() if (mInitialized) { return true; } mozilla::ScopedGfxFeatureReporter reporter("EGL"); #ifdef MOZ_B2G if (!sCurrentContext.init()) - MOZ_CRASH("Tls init failed"); + MOZ_CRASH("Tls init failed"); #endif #ifdef XP_WIN if (!mEGLLibrary) { // On Windows, the GLESv2, EGL and DXSDK libraries are shipped with libxul and // we should look for them there. We have to load the libs in this // order, because libEGL.dll depends on libGLESv2.dll which depends on the DXSDK // libraries. This matters especially for WebRT apps which are in a different directory. @@ -404,32 +404,18 @@ GLLibraryEGL::InitExtensions() { const char *extensions = (const char*)fQueryString(mEGLDisplay, LOCAL_EGL_EXTENSIONS); if (!extensions) { NS_WARNING("Failed to load EGL extension list!"); return; } - bool debugMode = false; -#ifdef DEBUG - if (PR_GetEnv("MOZ_GL_DEBUG")) - debugMode = true; - - static bool firstRun = true; -#else - // Non-DEBUG, so never spew. - const bool firstRun = false; -#endif - - GLContext::InitializeExtensionsBitSet(mAvailableExtensions, extensions, sEGLExtensionNames, firstRun && debugMode); - -#ifdef DEBUG - firstRun = false; -#endif + GLContext::InitializeExtensionsBitSet(mAvailableExtensions, extensions, + sEGLExtensionNames); } void GLLibraryEGL::DumpEGLConfig(EGLConfig cfg) { int attrval; int err;