Bug 1739908 p1: Remove PersistentBufferProviderShared::mTextureLockIsUnreliable. r=lsalzman

This measure was originally put in to help with what was believed to be an issue
with ClearCachedResources, but we now think it was down to textures being
re-forwarded on tab switch when already read locked.
A change in bug 1717209 fixed this, so I think we can safely remove
mTextureLockIsUnreliable, which would cause some compilcations with the
following patch.

Differential Revision: https://phabricator.services.mozilla.com/D132601
This commit is contained in:
Bob Owen 2021-12-07 09:36:18 +00:00
parent d68d355602
commit 771e081464
2 changed files with 2 additions and 15 deletions

View File

@ -326,9 +326,7 @@ PersistentBufferProviderShared::BorrowDrawTarget(
// First try to reuse the current back buffer. If we can do that it means
// we can skip copying its content to the new back buffer.
if ((mTextureLockIsUnreliable.isSome() &&
mTextureLockIsUnreliable == mBack) ||
(tex && tex->IsReadLocked())) {
if (tex && tex->IsReadLocked()) {
// The back buffer is currently used by the compositor, we can't draw
// into it.
tex = nullptr;
@ -337,9 +335,7 @@ PersistentBufferProviderShared::BorrowDrawTarget(
if (!tex) {
// Try to grab an already allocated texture if any is available.
for (uint32_t i = 0; i < mTextures.length(); ++i) {
if (!mTextures[i]->IsReadLocked() &&
!(mTextureLockIsUnreliable.isSome() &&
mTextureLockIsUnreliable.ref() == i)) {
if (!mTextures[i]->IsReadLocked()) {
mBack = Some(i);
tex = mTextures[i];
break;
@ -429,9 +425,6 @@ PersistentBufferProviderShared::BorrowDrawTarget(
}
}
// Clear dirty texture, since new back texture is selected.
mTextureLockIsUnreliable = Nothing();
mDrawTarget = tex->BorrowDrawTarget();
if (mDrawTarget) {
// This is simply to ensure the DrawTarget gets initialized, and will detect
@ -590,9 +583,6 @@ void PersistentBufferProviderShared::ClearCachedResources() {
mFront = Some<uint32_t>(mTextures.length() - 1);
}
}
// Set front texture as dirty texture.
// The texture's read lock is unreliable after this function call.
mTextureLockIsUnreliable = mFront;
}
void PersistentBufferProviderShared::Destroy() {

View File

@ -202,9 +202,6 @@ class PersistentBufferProviderShared : public PersistentBufferProvider,
Maybe<uint32_t> mBack;
// Offset of the texture in mTextures that is presented to the compositor.
Maybe<uint32_t> mFront;
// Offset of the texture in mTextures which texture's readlock is unreliable.
// Therefore it should not be used as next back buffer.
Maybe<uint32_t> mTextureLockIsUnreliable;
RefPtr<gfx::DrawTarget> mDrawTarget;
RefPtr<gfx::SourceSurface> mSnapshot;