Bug 1685046: Hoist release asserts in RenderCompositorNativeOGL::Bind to crash earlier. r=jrmuizel

This change spreads the release asserts to functions that are invoked by other
callers, potentially increasing the cases where the assert will fail. This is
being done intentionally; we want additional information on the reasons for
the crashes.

Differential Revision: https://phabricator.services.mozilla.com/D101063
This commit is contained in:
Brad Werth 2021-01-11 15:49:09 +00:00
Родитель bd6683cb18
Коммит 3e6d3530c3
2 изменённых файлов: 6 добавлений и 19 удалений

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

@ -618,11 +618,7 @@ void NativeLayerCA::InvalidateRegionThroughoutSwapchain(const MutexAutoLock&,
}
bool NativeLayerCA::NextSurface(const MutexAutoLock& aLock) {
if (mSize.IsEmpty()) {
NSLog(@"NextSurface returning false because of invalid mSize (%d, %d).", mSize.width,
mSize.height);
return false;
}
MOZ_RELEASE_ASSERT(!mSize.IsEmpty(), "NextSurface invalid mSize.");
MOZ_RELEASE_ASSERT(
!mInProgressSurface,
@ -632,10 +628,7 @@ bool NativeLayerCA::NextSurface(const MutexAutoLock& aLock) {
Maybe<SurfaceWithInvalidRegion> surf = GetUnusedSurfaceAndCleanUp(aLock);
if (!surf) {
CFTypeRefPtr<IOSurfaceRef> newSurf = mSurfacePoolHandle->ObtainSurfaceFromPool(mSize);
if (!newSurf) {
NSLog(@"NextSurface returning false because IOSurfaceCreate failed to create the surface.");
return false;
}
MOZ_RELEASE_ASSERT(newSurf, "NextSurface IOSurfaceCreate failed to create the surface.");
surf = Some(SurfaceWithInvalidRegion{newSurf, IntRect({}, mSize)});
}
@ -710,15 +703,11 @@ Maybe<GLuint> NativeLayerCA::NextSurfaceAsFramebuffer(const IntRect& aDisplayRec
const IntRegion& aUpdateRegion,
bool aNeedsDepth) {
MutexAutoLock lock(mMutex);
if (!NextSurface(lock)) {
return Nothing();
}
NextSurface(lock);
Maybe<GLuint> fbo =
mSurfacePoolHandle->GetFramebufferForSurface(mInProgressSurface->mSurface, aNeedsDepth);
if (!fbo) {
return Nothing();
}
MOZ_RELEASE_ASSERT(fbo, "GetFramebufferForSurface failed.");
HandlePartialUpdate(
lock, aDisplayRect, aUpdateRegion,
@ -727,9 +716,8 @@ Maybe<GLuint> NativeLayerCA::NextSurfaceAsFramebuffer(const IntRect& aDisplayRec
MOZ_RELEASE_ASSERT(mSurfacePoolHandle->gl());
mSurfacePoolHandle->gl()->MakeCurrent();
Maybe<GLuint> sourceFBO = mSurfacePoolHandle->GetFramebufferForSurface(validSource, false);
if (!sourceFBO) {
return;
}
MOZ_RELEASE_ASSERT(sourceFBO,
"GetFramebufferForSurface failed during HandlePartialUpdate.");
for (auto iter = copyRegion.RectIter(); !iter.Done(); iter.Next()) {
gfx::IntRect r = iter.Get();
if (mSurfaceIsFlipped) {

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

@ -527,7 +527,6 @@ void RenderCompositorNativeOGL::Bind(wr::NativeTileId aId,
Maybe<GLuint> fbo = mCurrentlyBoundNativeLayer->NextSurfaceAsFramebuffer(
validRect, dirtyRect, true);
MOZ_RELEASE_ASSERT(fbo); // TODO: make fallible
*aFboId = *fbo;
*aOffset = wr::DeviceIntPoint{0, 0};