mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1287182 - log angle failureid via ANGLEPlatformInitialize. r=jrmuizel
MozReview-Commit-ID: 7Cg8AOVij1z --HG-- extra : rebase_source : 16b3f68041ca9beb65409a9b3d59f4ca0d5f41a6
This commit is contained in:
parent
7ae0782b02
commit
9f3f096a00
@ -163,7 +163,8 @@ DEFINES['ANGLE_ENABLE_GLSL'] = "1"
|
||||
DEFINES['ANGLE_ENABLE_ESSL'] = "1"
|
||||
DEFINES['ANGLE_ENABLE_KEYEDMUTEX'] = "1"
|
||||
|
||||
EXPORTS.angle += [ 'include/GLSLANG/ShaderLang.h', 'include/GLSLANG/ShaderVars.h' ]
|
||||
EXPORTS.angle += [ 'include/GLSLANG/ShaderLang.h', 'include/GLSLANG/ShaderVars.h', 'include/platform/Platform.h' ]
|
||||
|
||||
EXPORTS.angle.KHR += [ 'include/KHR/khrplatform.h' ]
|
||||
|
||||
LOCAL_INCLUDES += [ 'include', 'src', 'src/common/third_party/numerics' ]
|
||||
|
@ -4,12 +4,15 @@
|
||||
|
||||
#include "GLLibraryEGL.h"
|
||||
|
||||
#include "angle/Platform.h"
|
||||
#include "gfxConfig.h"
|
||||
#include "gfxCrashReporterUtils.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/Tokenizer.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
@ -172,8 +175,51 @@ GetAndInitDisplay(GLLibraryEGL& egl, void* displayType)
|
||||
return display;
|
||||
}
|
||||
|
||||
class AngleErrorReporting: public angle::Platform {
|
||||
public:
|
||||
AngleErrorReporting()
|
||||
{
|
||||
// No static constructor
|
||||
}
|
||||
|
||||
void SetFailureId(nsACString* const aFailureId)
|
||||
{
|
||||
mFailureId = aFailureId;
|
||||
}
|
||||
|
||||
void logError(const char *errorMessage) override
|
||||
{
|
||||
nsCString str(errorMessage);
|
||||
Tokenizer tokenizer(str);
|
||||
|
||||
// Parse "ANGLE Display::initialize error " << error.getID() << ": "
|
||||
// << error.getMessage()
|
||||
nsCString currWord;
|
||||
Tokenizer::Token intToken;
|
||||
if (tokenizer.CheckWord("ANGLE") &&
|
||||
tokenizer.CheckWhite() &&
|
||||
tokenizer.CheckWord("Display") &&
|
||||
tokenizer.CheckChar(':') &&
|
||||
tokenizer.CheckChar(':') &&
|
||||
tokenizer.CheckWord("initialize") &&
|
||||
tokenizer.CheckWhite() &&
|
||||
tokenizer.CheckWord("error") &&
|
||||
tokenizer.CheckWhite() &&
|
||||
tokenizer.Check(Tokenizer::TOKEN_INTEGER, intToken)) {
|
||||
*mFailureId = "FAILURE_ID_ANGLE_ID_";
|
||||
mFailureId->AppendPrintf("%i", intToken.AsInteger());
|
||||
} else {
|
||||
*mFailureId = "FAILURE_ID_ANGLE_UNKNOWN";
|
||||
}
|
||||
}
|
||||
private:
|
||||
nsACString* mFailureId;
|
||||
};
|
||||
|
||||
AngleErrorReporting gAngleErrorReporter;
|
||||
|
||||
static EGLDisplay
|
||||
GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
|
||||
GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl, nsACString* const out_failureId)
|
||||
{
|
||||
EGLDisplay ret = 0;
|
||||
|
||||
@ -186,8 +232,19 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
|
||||
if (gfxPrefs::WebGLANGLEForceD3D11())
|
||||
d3d11ANGLE.UserForceEnable("User force-enabled D3D11 ANGLE on disabled hardware");
|
||||
|
||||
if (gfxConfig::IsForcedOnByUser(Feature::D3D11_HW_ANGLE))
|
||||
gAngleErrorReporter.SetFailureId(out_failureId);
|
||||
egl.fANGLEPlatformInitialize(&gAngleErrorReporter);
|
||||
|
||||
auto guardShutdown = mozilla::MakeScopeExit([&] {
|
||||
gAngleErrorReporter.SetFailureId(nullptr);
|
||||
// NOTE: Ideally we should be calling ANGLEPlatformShutdown after the
|
||||
// ANGLE display is destroyed. However gAngleErrorReporter
|
||||
// will live longer than the ANGLE display so we're fine.
|
||||
});
|
||||
|
||||
if (gfxConfig::IsForcedOnByUser(Feature::D3D11_HW_ANGLE)) {
|
||||
return GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ONLY_DISPLAY_ANGLE);
|
||||
}
|
||||
|
||||
if (d3d11ANGLE.IsEnabled()) {
|
||||
ret = GetAndInitDisplay(egl, LOCAL_EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE);
|
||||
@ -372,7 +429,9 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
|
||||
// Client exts are ready. (But not display exts!)
|
||||
if (IsExtensionSupported(ANGLE_platform_angle_d3d)) {
|
||||
GLLibraryLoader::SymLoadStruct d3dSymbols[] = {
|
||||
{ (PRFuncPtr*)&mSymbols.fGetPlatformDisplayEXT, { "eglGetPlatformDisplayEXT", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fANGLEPlatformInitialize, { "ANGLEPlatformInitialize", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fANGLEPlatformShutdown, { "ANGLEPlatformShutdown", nullptr } },
|
||||
{ (PRFuncPtr*)&mSymbols.fGetPlatformDisplayEXT, { "eglGetPlatformDisplayEXT", nullptr } },
|
||||
{ nullptr, { nullptr } }
|
||||
};
|
||||
|
||||
@ -407,7 +466,7 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
|
||||
|
||||
// Hardware accelerated ANGLE path (supported or force accel)
|
||||
if (shouldTryAccel) {
|
||||
chosenDisplay = GetAndInitDisplayForAccelANGLE(*this);
|
||||
chosenDisplay = GetAndInitDisplayForAccelANGLE(*this, out_failureId);
|
||||
}
|
||||
|
||||
// Fallback to a WARP display if ANGLE fails, or if WARP is forced
|
||||
|
@ -52,6 +52,10 @@
|
||||
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
|
||||
#endif
|
||||
|
||||
namespace angle {
|
||||
class Platform;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace gfx {
|
||||
@ -116,6 +120,8 @@ public:
|
||||
}
|
||||
|
||||
void ClearSymbols() {
|
||||
mSymbols.fANGLEPlatformInitialize = nullptr;
|
||||
mSymbols.fANGLEPlatformShutdown = nullptr;
|
||||
mSymbols.fGetDisplay = nullptr;
|
||||
mSymbols.fGetPlatformDisplayEXT = nullptr;
|
||||
mSymbols.fTerminate = nullptr;
|
||||
@ -498,6 +504,22 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void fANGLEPlatformInitialize(angle::Platform* platform)
|
||||
{
|
||||
MOZ_ASSERT(mSymbols.fANGLEPlatformInitialize);
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fANGLEPlatformInitialize(platform);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fANGLEPlatformShutdown()
|
||||
{
|
||||
MOZ_ASSERT(mSymbols.fANGLEPlatformShutdown);
|
||||
BEFORE_GL_CALL;
|
||||
mSymbols.fANGLEPlatformShutdown();
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
EGLDisplay Display() {
|
||||
MOZ_ASSERT(mInitialized);
|
||||
return mEGLDisplay;
|
||||
@ -622,6 +644,11 @@ public:
|
||||
pfnGetSyncAttrib fGetSyncAttrib;
|
||||
typedef EGLint (GLAPIENTRY * pfnDupNativeFenceFDANDROID)(EGLDisplay dpy, EGLSync sync);
|
||||
pfnDupNativeFenceFDANDROID fDupNativeFenceFDANDROID;
|
||||
|
||||
typedef void (GLAPIENTRY * pfnANGLEPlatformInitialize)(angle::Platform* platform);
|
||||
pfnANGLEPlatformInitialize fANGLEPlatformInitialize;
|
||||
typedef void (GLAPIENTRY * pfnANGLEPlatformShutdown)();
|
||||
pfnANGLEPlatformShutdown fANGLEPlatformShutdown;
|
||||
} mSymbols;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user