зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1287182 - log angle failureid via ANGLEPlatformInitialize. r=jrmuizel
MozReview-Commit-ID: 7Cg8AOVij1z
This commit is contained in:
Родитель
38212560dd
Коммит
4537cb28f4
|
@ -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,43 @@ GetAndInitDisplay(GLLibraryEGL& egl, void* displayType)
|
|||
return display;
|
||||
}
|
||||
|
||||
class AngleErrorReporting: public angle::Platform {
|
||||
public:
|
||||
AngleErrorReporting(nsACString *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;
|
||||
};
|
||||
|
||||
static EGLDisplay
|
||||
GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
|
||||
GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl, nsACString* const out_failureId)
|
||||
{
|
||||
EGLDisplay ret = 0;
|
||||
|
||||
|
@ -186,8 +224,16 @@ GetAndInitDisplayForAccelANGLE(GLLibraryEGL& egl)
|
|||
if (gfxPrefs::WebGLANGLEForceD3D11())
|
||||
d3d11ANGLE.UserForceEnable("User force-enabled D3D11 ANGLE on disabled hardware");
|
||||
|
||||
if (gfxConfig::IsForcedOnByUser(Feature::D3D11_HW_ANGLE))
|
||||
AngleErrorReporting errorReporter(out_failureId);
|
||||
|
||||
egl.fANGLEPlatformInitialize(&errorReporter);
|
||||
auto guardShutdown = mozilla::MakeScopeExit([&] {
|
||||
egl.fANGLEPlatformShutdown();
|
||||
});
|
||||
|
||||
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 +418,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 } }
|
||||
};
|
||||
|
||||
|
@ -424,7 +472,7 @@ GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId
|
|||
}
|
||||
|
||||
// Hardware accelerated ANGLE path
|
||||
chosenDisplay = GetAndInitDisplayForAccelANGLE(*this);
|
||||
chosenDisplay = GetAndInitDisplayForAccelANGLE(*this, out_failureId);
|
||||
}
|
||||
} else {
|
||||
chosenDisplay = GetAndInitDisplay(*this, EGL_DEFAULT_DISPLAY);
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче