Bug 1775480 - Add more crash annotations for bug 1772839. r=gfx-reviewers,aosmond

Add crash annotations for the total number of webrender renderers, as
well as the number that are currently not paused, as this error could
be caused by having multiple renderers in a resumed state
concurrently. Additionally, add some gfxCriticalNotes for potentially
relevant error cases.

Differential Revision: https://phabricator.services.mozilla.com/D150000
This commit is contained in:
Jamie Nicol 2022-06-22 15:31:56 +00:00
Родитель 9e7f8fbe32
Коммит 00cdec76f5
6 изменённых файлов: 62 добавлений и 7 удалений

Просмотреть файл

@ -635,6 +635,7 @@ void GPUProcessManager::DisableWebRender(wr::WebRenderError aError,
}
void GPUProcessManager::NotifyWebRenderError(wr::WebRenderError aError) {
gfxCriticalNote << "Handling webrender error " << (unsigned int)aError;
if (aError == wr::WebRenderError::VIDEO_OVERLAY) {
#ifdef XP_WIN
gfxVars::SetUseWebRenderDCompVideoOverlayWin(false);

Просмотреть файл

@ -220,8 +220,14 @@ void RenderCompositorEGL::DestroyEGLSurface() {
// Release EGLSurface of back buffer before calling ResizeBuffers().
if (mEGLSurface) {
gle->SetEGLSurfaceOverride(EGL_NO_SURFACE);
egl->fMakeCurrent(EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
egl->fDestroySurface(mEGLSurface);
if (!egl->fMakeCurrent(EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
const EGLint err = egl->mLib->fGetError();
gfxCriticalNote << "Error in eglMakeCurrent: " << gfx::hexa(err);
}
if (!egl->fDestroySurface(mEGLSurface)) {
const EGLint err = egl->mLib->fGetError();
gfxCriticalNote << "Error in eglDestroySurface: " << gfx::hexa(err);
}
mEGLSurface = nullptr;
}
}

Просмотреть файл

@ -151,8 +151,14 @@ void RenderCompositorOGLSWGL::DestroyEGLSurface() {
// Release EGLSurface of back buffer before calling ResizeBuffers().
if (mEGLSurface) {
gle->SetEGLSurfaceOverride(EGL_NO_SURFACE);
egl->fMakeCurrent(EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
egl->fDestroySurface(mEGLSurface);
if (!egl->fMakeCurrent(EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
const EGLint err = egl->mLib->fGetError();
gfxCriticalNote << "Error in eglMakeCurrent: " << gfx::hexa(err);
}
if (!egl->fDestroySurface(mEGLSurface)) {
const EGLint err = egl->mLib->fGetError();
gfxCriticalNote << "Error in eglDestroySurface: " << gfx::hexa(err);
}
mEGLSurface = EGL_NO_SURFACE;
}
}

Просмотреть файл

@ -266,6 +266,9 @@ void RenderThread::AddRenderer(wr::WindowId aWindowId,
}
mRenderers[aWindowId] = std::move(aRenderer);
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::GraphicsNumRenderers,
(unsigned int)mRenderers.size());
auto windows = mWindowInfos.Lock();
windows->emplace(AsUint64(aWindowId), new WindowInfo());
@ -281,6 +284,9 @@ void RenderThread::RemoveRenderer(wr::WindowId aWindowId) {
}
mRenderers.erase(aWindowId);
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::GraphicsNumRenderers,
(unsigned int)mRenderers.size());
if (mRenderers.empty()) {
if (mHandlingDeviceReset) {
@ -311,11 +317,22 @@ RendererOGL* RenderThread::GetRenderer(wr::WindowId aWindowId) {
return it->second.get();
}
size_t RenderThread::RendererCount() {
size_t RenderThread::RendererCount() const {
MOZ_ASSERT(IsInRenderThread());
return mRenderers.size();
}
size_t RenderThread::ActiveRendererCount() const {
MOZ_ASSERT(IsInRenderThread());
size_t num_active = 0;
for (const auto& it : mRenderers) {
if (!it.second->IsPaused()) {
num_active++;
}
}
return num_active;
}
void RenderThread::BeginRecordingForWindow(wr::WindowId aWindowId,
const TimeStamp& aRecordingStart,
wr::PipelineId aRootPipelineId) {
@ -597,10 +614,16 @@ void RenderThread::Pause(wr::WindowId aWindowId) {
auto it = mRenderers.find(aWindowId);
MOZ_ASSERT(it != mRenderers.end());
if (it == mRenderers.end()) {
gfxCriticalNote << "RenderThread cannot find renderer for window "
<< gfx::hexa(aWindowId) << " to pause.";
return;
}
auto& renderer = it->second;
renderer->Pause();
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::GraphicsNumActiveRenderers,
(unsigned int)ActiveRendererCount());
}
bool RenderThread::Resume(wr::WindowId aWindowId) {
@ -610,10 +633,18 @@ bool RenderThread::Resume(wr::WindowId aWindowId) {
auto it = mRenderers.find(aWindowId);
MOZ_ASSERT(it != mRenderers.end());
if (it == mRenderers.end()) {
gfxCriticalNote << "RenderThread cannot find renderer for window "
<< gfx::hexa(aWindowId) << " to resume.";
return false;
}
auto& renderer = it->second;
return renderer->Resume();
bool resumed = renderer->Resume();
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::GraphicsNumActiveRenderers,
(unsigned int)ActiveRendererCount());
return resumed;
}
bool RenderThread::TooManyPendingFrames(wr::WindowId aWindowId) {

Просмотреть файл

@ -282,7 +282,8 @@ class RenderThread final {
/// Can only be called from the render thread.
bool SyncObjectNeeded();
size_t RendererCount();
size_t RendererCount() const;
size_t ActiveRendererCount() const;
void BeginRecordingForWindow(wr::WindowId aWindowId,
const TimeStamp& aRecordingStart,

Просмотреть файл

@ -364,6 +364,16 @@ GraphicsDrawShader:
See file names in gfx/wr/webrender/res/* for the possible values.
type: string
GraphicsNumActiveRenderers:
description: >
Number of webrender renderer instances that are not in a paused state.
type: integer
GraphicsNumRenderers:
description: >
Total number of webrender renderer instances.
type: integer
GraphicsStartupTest:
description: >
Set to 1 by the graphics driver crash guard when it's activated.