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

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

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