Bug 1265638 - Reset some properties when the backend of SharedSurface is switching from Basic to layer-accelerated backend. r=jgilbert

MozReview-Commit-ID: JWXA79i3aEC
This commit is contained in:
Morris Tseng
2016-04-26 11:08:56 +08:00
parent 268f9b518c
commit 2e5febe3d7
3 changed files with 23 additions and 11 deletions

View File

@@ -422,20 +422,26 @@ CanvasClientSharedSurface::UpdateRenderer(gfx::IntSize aSize, Renderer& aRendere
auto layersBackend = shadowForwarder->GetCompositorBackendType();
mReadbackClient = TexClientFromReadback(surf, forwarder, flags, layersBackend);
if (asyncRenderer) {
// Above codes will readback the GLContext to mReadbackClient
// in order to send frame to compositor. We copy from this
// TextureClient directly by calling CopyFromTextureClient().
// Therefore, if main-thread want the content of GLContext,
// it don't have to readback it again.
asyncRenderer->CopyFromTextureClient(mReadbackClient);
}
newFront = mReadbackClient;
} else {
mReadbackClient = nullptr;
}
if (asyncRenderer) {
// If surface type is Basic, above codes will readback
// the GLContext to mReadbackClient in order to send frame to
// compositor. We copy from this TextureClient directly by
// calling CopyFromTextureClient().
// Therefore, if main-thread want the content of GLContext,
// it doesn't have to readback from GLContext again.
//
// Otherwise, if surface type isn't Basic, we will read from
// SharedSurface directly from main-thread. We still pass
// mReadbackClient which is nullptr here to tell
// AsyncCanvasRenderer reset some properties.
asyncRenderer->CopyFromTextureClient(mReadbackClient);
}
MOZ_ASSERT(newFront);
if (!newFront) {
// May happen in a release build in case of memory pressure.