Bug 1797055 - Force crash early if compositor is resumed with abandoned Surface. r=geckoview-reviewers,m_kato

In bug 1772839 we were seeing a large number of crashes due to
encountering a webrender error after exhausting all fallback
configurations. At least in some cases, this was due to the compositor
being resumed with an Android Surface that was already in an abandoned
state, meaning we can never succeed in creating an EGL Surface.

We added a check for this condition, and a workaround, to the
GeckoView java code. However, we are still seeing crash reports
matching this signature. To help determine whether these are also due
to the Surface being abandoned, or due to some other reason, this
patch adds a deliberate crash much earlier in the pipeline if we
detect an abandoned Surface.

Differential Revision: https://phabricator.services.mozilla.com/D160042
This commit is contained in:
Jamie Nicol 2022-10-27 08:01:28 +00:00
Родитель 71ea2e2ec1
Коммит 6511f3c4e5
2 изменённых файлов: 16 добавлений и 0 удалений

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

@ -9,6 +9,7 @@
#include "mozilla/gfx/Logging.h"
#include "mozilla/widget/PlatformWidgetTypes.h"
#include "nsWindow.h"
#include "SurfaceViewWrapperSupport.h"
namespace mozilla {
namespace widget {
@ -83,6 +84,13 @@ bool AndroidCompositorWidget::OnResumeComposition() {
return false;
}
// If our Surface is in an abandoned state then we will never succesfully
// create an EGL Surface, and will eventually crash. Better to explicitly
// crash now.
if (SurfaceViewWrapperSupport::IsSurfaceAbandoned(mSurface)) {
MOZ_CRASH("Compositor resumed with abandoned Surface");
}
return true;
}

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

@ -34,6 +34,7 @@
#include "MotionEvent.h"
#include "ScopedGLHelpers.h"
#include "ScreenHelperAndroid.h"
#include "SurfaceViewWrapperSupport.h"
#include "TouchResampler.h"
#include "WidgetUtils.h"
#include "WindowRenderer.h"
@ -1229,6 +1230,13 @@ class LayerViewSupport final
jni::Object::Param aSurfaceControl) {
MOZ_ASSERT(AndroidBridge::IsJavaUiThread());
// If our Surface is in an abandoned state then we will never succesfully
// create an EGL Surface, and will eventually crash. Better to explicitly
// crash now.
if (SurfaceViewWrapperSupport::IsSurfaceAbandoned(aSurface)) {
MOZ_CRASH("Compositor resumed with abandoned Surface");
}
mWidth = aWidth;
mHeight = aHeight;
mSurfaceControl =