зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1632096 - Forward WebRender gl(ANGLE) error message to gfx critical note r=gw
Differential Revision: https://phabricator.services.mozilla.com/D72123
This commit is contained in:
Родитель
a5112d03db
Коммит
74fce68a04
|
@ -607,14 +607,15 @@ class GLContext : public GenericAtomicRefCounted,
|
|||
return err == LOCAL_GL_NO_ERROR;
|
||||
}
|
||||
|
||||
void DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity,
|
||||
GLsizei length, const GLchar* message);
|
||||
|
||||
private:
|
||||
static void GLAPIENTRY StaticDebugCallback(GLenum source, GLenum type,
|
||||
GLuint id, GLenum severity,
|
||||
GLsizei length,
|
||||
const GLchar* message,
|
||||
const GLvoid* userParam);
|
||||
void DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity,
|
||||
GLsizei length, const GLchar* message);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// MOZ_GL_DEBUG implementation
|
||||
|
|
|
@ -996,27 +996,60 @@ static already_AddRefed<gl::GLContext> CreateGLContextCGL() {
|
|||
}
|
||||
#endif
|
||||
|
||||
static void GLAPIENTRY DebugMessageCallback(GLenum aSource, GLenum aType,
|
||||
GLuint aId, GLenum aSeverity,
|
||||
GLsizei aLength,
|
||||
const GLchar* aMessage,
|
||||
const GLvoid* aUserParam) {
|
||||
constexpr const char* kContextLost = "Context has been lost.";
|
||||
|
||||
if (StaticPrefs::gfx_webrender_gl_debug_message_critical_note_AtStartup() &&
|
||||
aSeverity == LOCAL_GL_DEBUG_SEVERITY_HIGH) {
|
||||
auto message = std::string(aMessage, aLength);
|
||||
// When content lost happned, error messages are flooded by its message.
|
||||
if (message != kContextLost) {
|
||||
gfxCriticalNote << message;
|
||||
}
|
||||
}
|
||||
|
||||
if (StaticPrefs::gfx_webrender_gl_debug_message_print_AtStartup()) {
|
||||
gl::GLContext* gl = (gl::GLContext*)aUserParam;
|
||||
gl->DebugCallback(aSource, aType, aId, aSeverity, aLength, aMessage);
|
||||
}
|
||||
}
|
||||
|
||||
static already_AddRefed<gl::GLContext> CreateGLContext() {
|
||||
RefPtr<gl::GLContext> gl;
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (gfx::gfxVars::UseWebRenderANGLE()) {
|
||||
return CreateGLContextANGLE();
|
||||
gl = CreateGLContextANGLE();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
return CreateGLContextEGL();
|
||||
#elif defined(MOZ_WIDGET_ANDROID)
|
||||
gl = CreateGLContextEGL();
|
||||
#elif defined(MOZ_WAYLAND)
|
||||
if (gdk_display_get_default() &&
|
||||
!GDK_IS_X11_DISPLAY(gdk_display_get_default())) {
|
||||
return CreateGLContextEGL();
|
||||
gl = CreateGLContextEGL();
|
||||
}
|
||||
#elif XP_MACOSX
|
||||
gl = CreateGLContextCGL();
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
return CreateGLContextCGL();
|
||||
#endif
|
||||
bool enableDebugMessage =
|
||||
StaticPrefs::gfx_webrender_gl_debug_message_critical_note_AtStartup() ||
|
||||
StaticPrefs::gfx_webrender_gl_debug_message_print_AtStartup();
|
||||
|
||||
return nullptr;
|
||||
if (enableDebugMessage && gl &&
|
||||
gl->IsExtensionSupported(gl::GLContext::KHR_debug)) {
|
||||
gl->fEnable(LOCAL_GL_DEBUG_OUTPUT);
|
||||
gl->fDisable(LOCAL_GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
gl->fDebugMessageCallback(&DebugMessageCallback, (void*)gl.get());
|
||||
gl->fDebugMessageControl(LOCAL_GL_DONT_CARE, LOCAL_GL_DONT_CARE,
|
||||
LOCAL_GL_DONT_CARE, 0, nullptr, true);
|
||||
}
|
||||
|
||||
return gl.forget();
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -4181,6 +4181,23 @@
|
|||
value: true
|
||||
mirror: once
|
||||
|
||||
# When gl debug message is a high severity message, forwward it to gfx critical
|
||||
# note.
|
||||
- name: gfx.webrender.gl-debug-message-critical-note
|
||||
type: bool
|
||||
#if defined(XP_WIN) && defined(NIGHTLY_BUILD)
|
||||
value: true
|
||||
#else
|
||||
value: false
|
||||
#endif
|
||||
mirror: once
|
||||
|
||||
# Enable printing gl debug messages
|
||||
- name: gfx.webrender.gl-debug-message-print
|
||||
type: bool
|
||||
value: false
|
||||
mirror: once
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
# Keep this pref hidden on non-nightly builds to avoid people accidentally
|
||||
# turning it on.
|
||||
|
|
Загрузка…
Ссылка в новой задаче