зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543616 - Call TextureHost::PrepareForUse() when mCompositableCount becomes from 0 to 1 r=nical
By Bug 1529870, the PrepareForUse() is called in WebRenderImageHost::SetCurrentTextureHost(). It works with single buffer mode android SurfaceTexture for WebGL. But it does not work well with video's SurfaceTexture, since multiple TextureHosts are received and a TextureHost might be skipped. The timing of mCompositableCount becomes from 0 to 1 could be used for calling PrepareForUse(). Differential Revision: https://phabricator.services.mozilla.com/D27044 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1df1c7709c
Коммит
82cce30aea
|
@ -597,7 +597,12 @@ class TextureHost : public AtomicRefCountedWithFinalize<TextureHost> {
|
|||
*/
|
||||
virtual bool HasIntermediateBuffer() const { return false; }
|
||||
|
||||
void AddCompositableRef() { ++mCompositableCount; }
|
||||
void AddCompositableRef() {
|
||||
++mCompositableCount;
|
||||
if (mCompositableCount == 1) {
|
||||
PrepareForUse();
|
||||
}
|
||||
}
|
||||
|
||||
void ReleaseCompositableRef() {
|
||||
--mCompositableCount;
|
||||
|
@ -681,6 +686,11 @@ class TextureHost : public AtomicRefCountedWithFinalize<TextureHost> {
|
|||
|
||||
virtual void UpdatedInternal(const nsIntRegion* Region) {}
|
||||
|
||||
/**
|
||||
* Called when mCompositableCount becomes from 0 to 1.
|
||||
*/
|
||||
virtual void PrepareForUse() {}
|
||||
|
||||
/**
|
||||
* Called when mCompositableCount becomes 0.
|
||||
*/
|
||||
|
|
|
@ -163,14 +163,6 @@ void WebRenderImageHost::SetCurrentTextureHost(TextureHost* aTexture) {
|
|||
if (aTexture == mCurrentTextureHost.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aTexture && aTexture->AsWebRenderTextureHost()) {
|
||||
// If WebRenderTextureHost wraps SurfaceTextureHost, it is important to call
|
||||
// PrepareForUse for each texture that we receive.
|
||||
// See RenderAndroidSurfaceTextureHostOGL::PrepareForUse.
|
||||
aTexture->AsWebRenderTextureHost()->PrepareForUse();
|
||||
}
|
||||
|
||||
mCurrentTextureHost = aTexture;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class WebRenderTextureHost : public TextureHost {
|
|||
|
||||
WebRenderTextureHost* AsWebRenderTextureHost() override { return this; }
|
||||
|
||||
virtual void PrepareForUse();
|
||||
virtual void PrepareForUse() override;
|
||||
|
||||
wr::ExternalImageId GetExternalImageKey() { return mExternalImageId; }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче