Backed out changeset 397c9cd6a5e3 (bug 1808840) for causing wr failures on imageBitmapRendering-transferFromImageBitmap-webgl.html.

This commit is contained in:
Iulian Moraru 2023-01-06 19:15:19 +02:00
Родитель ae86a3014b
Коммит 651978900d
3 изменённых файлов: 11 добавлений и 22 удалений

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

@ -64,7 +64,17 @@ wr::WrExternalImage RenderAndroidSurfaceTextureHost::Lock(uint8_t aChannelIndex,
return InvalidToWrExternalImage();
}
UpdateTexImageIfNecessary();
if (mContinuousUpdate) {
MOZ_ASSERT(!mSurfTex->IsSingleBuffer());
mSurfTex->UpdateTexImage();
} else if (mPrepareStatus == STATUS_UPDATE_TEX_IMAGE_NEEDED) {
MOZ_ASSERT(!mSurfTex->IsSingleBuffer());
// When SurfaceTexture is not single buffer mode, call UpdateTexImage() once
// just before rendering. During playing video, one SurfaceTexture is used
// for all RenderAndroidSurfaceTextureHosts of video.
mSurfTex->UpdateTexImage();
mPrepareStatus = STATUS_PREPARED;
}
const auto uvs = GetUvCoords(mSize);
return NativeTextureToWrExternalImage(mSurfTex->GetTexName(), uvs.first.x,
@ -175,20 +185,6 @@ void RenderAndroidSurfaceTextureHost::NotifyNotUsed() {
mPrepareStatus = STATUS_NONE;
}
void RenderAndroidSurfaceTextureHost::UpdateTexImageIfNecessary() {
if (mContinuousUpdate) {
MOZ_ASSERT(!mSurfTex->IsSingleBuffer());
mSurfTex->UpdateTexImage();
} else if (mPrepareStatus == STATUS_UPDATE_TEX_IMAGE_NEEDED) {
MOZ_ASSERT(!mSurfTex->IsSingleBuffer());
// When SurfaceTexture is not single buffer mode, call UpdateTexImage() once
// just before rendering. During playing video, one SurfaceTexture is used
// for all RenderAndroidSurfaceTextureHosts of video.
mSurfTex->UpdateTexImage();
mPrepareStatus = STATUS_PREPARED;
}
}
gfx::SurfaceFormat RenderAndroidSurfaceTextureHost::GetFormat() const {
MOZ_ASSERT(mFormat == gfx::SurfaceFormat::R8G8B8A8 ||
mFormat == gfx::SurfaceFormat::R8G8B8X8);
@ -241,8 +237,6 @@ RenderAndroidSurfaceTextureHost::ReadTexImage() {
bool RenderAndroidSurfaceTextureHost::MapPlane(RenderCompositor* aCompositor,
uint8_t aChannelIndex,
PlaneInfo& aPlaneInfo) {
UpdateTexImageIfNecessary();
RefPtr<gfx::DataSourceSurface> readback = ReadTexImage();
if (!readback) {
return false;

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

@ -52,8 +52,6 @@ class RenderAndroidSurfaceTextureHost final : public RenderTextureHostSWGL {
return this;
}
void UpdateTexImageIfNecessary();
mozilla::java::GeckoSurfaceTexture::GlobalRef mSurfTex;
const gfx::IntSize mSize;
const gfx::SurfaceFormat mFormat;

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

@ -196,9 +196,6 @@ void RenderCompositorOGLSWGL::HandleExternalImage(
GLenum wrapMode = LOCAL_GL_CLAMP_TO_EDGE;
auto* host = aExternalImage->AsRenderAndroidSurfaceTextureHost();
host->UpdateTexImageIfNecessary();
// We need to hold the texture source separately from the effect,
// since the effect doesn't hold a strong reference.
RefPtr<SurfaceTextureSource> layer = new SurfaceTextureSource(