Bug 1322650 - Support a 'continuous' mode for SurfaceTexture r=jgilbert
This is needed to support Flash on Android MozReview-Commit-ID: 5yNIoZHonla
This commit is contained in:
@@ -62,7 +62,8 @@ CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
|
||||
|
||||
result = new SurfaceTextureHost(aFlags,
|
||||
surfaceTexture,
|
||||
desc.size());
|
||||
desc.size(),
|
||||
desc.continuous());
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -411,11 +412,15 @@ SurfaceTextureSource::DeallocateDeviceData()
|
||||
|
||||
SurfaceTextureHost::SurfaceTextureHost(TextureFlags aFlags,
|
||||
mozilla::java::GeckoSurfaceTexture::Ref& aSurfTex,
|
||||
gfx::IntSize aSize)
|
||||
gfx::IntSize aSize,
|
||||
bool aContinuousUpdate)
|
||||
: TextureHost(aFlags)
|
||||
, mSurfTex(aSurfTex)
|
||||
, mSize(aSize)
|
||||
, mContinuousUpdate(aContinuousUpdate)
|
||||
{
|
||||
// Continuous update makes no sense with single buffer mode
|
||||
MOZ_ASSERT(!mSurfTex->IsSingleBuffer() || !mContinuousUpdate);
|
||||
}
|
||||
|
||||
SurfaceTextureHost::~SurfaceTextureHost()
|
||||
@@ -430,9 +435,13 @@ SurfaceTextureHost::PrepareTextureSource(CompositableTextureSourceRef& aTexture)
|
||||
return;
|
||||
}
|
||||
|
||||
// This advances the SurfaceTexture's internal buffer queue. We only want to do this
|
||||
// once per transaction. We can then composite that texture as many times as needed.
|
||||
mSurfTex->UpdateTexImage();
|
||||
if (!mContinuousUpdate) {
|
||||
// UpdateTexImage() advances the internal buffer queue, so we only want to call this
|
||||
// once per transactionwhen we are not in continuous mode (as we are here). Otherwise,
|
||||
// the SurfaceTexture content will be de-synced from the rest of the page in subsequent
|
||||
// compositor passes.
|
||||
mSurfTex->UpdateTexImage();
|
||||
}
|
||||
}
|
||||
|
||||
gl::GLContext*
|
||||
@@ -450,6 +459,10 @@ SurfaceTextureHost::Lock()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mContinuousUpdate) {
|
||||
mSurfTex->UpdateTexImage();
|
||||
}
|
||||
|
||||
if (!mTextureSource) {
|
||||
gfx::SurfaceFormat format = gfx::SurfaceFormat::R8G8B8A8;
|
||||
GLenum target = LOCAL_GL_TEXTURE_EXTERNAL; // This is required by SurfaceTexture
|
||||
|
||||
Reference in New Issue
Block a user