Bug 897452 - Part 2 - PTexture deallocation logic - r=sotaro,bjacob

This commit is contained in:
Nicolas Silva
2013-12-11 20:44:45 -05:00
parent 7b1119166c
commit f7cec039bc
24 changed files with 259 additions and 110 deletions

View File

@@ -95,6 +95,7 @@ GrallocTextureSourceOGL::GrallocTextureSourceOGL(CompositorOGL* aCompositor,
, mGraphicBuffer(aGraphicBuffer)
, mEGLImage(0)
, mFormat(aFormat)
, mNeedsReset(true)
{
MOZ_ASSERT(mGraphicBuffer.get());
}
@@ -169,6 +170,14 @@ GrallocTextureSourceOGL::GetFormat() const {
void
GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
if (mCompositableBackendData != aBackendData) {
mNeedsReset = true;
}
if (!mNeedsReset) {
return;
}
mCompositableBackendData = aBackendData;
if (!mCompositor) {
@@ -187,6 +196,7 @@ GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendS
// create new EGLImage
mEGLImage = gl()->CreateEGLImageForNativeBuffer(mGraphicBuffer->getNativeBuffer());
gl()->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
mNeedsReset = false;
}
gfx::IntSize
@@ -273,6 +283,14 @@ GrallocTextureHostOGL::DeallocateSharedData()
PGrallocBufferParent::Send__delete__(mGrallocActor);
}
void
GrallocTextureHostOGL::ForgetSharedData()
{
if (mTextureSource) {
mTextureSource->ForgetBuffer();
}
}
void
GrallocTextureHostOGL::DeallocateDeviceData()
{