Bug 1200595 - Buffer TextureData implementation. r=mattwoodrow

This commit is contained in:
Nicolas Silva
2015-10-15 17:53:33 +02:00
parent e2ae37b6d3
commit 75de75b2f5
19 changed files with 851 additions and 697 deletions

View File

@@ -112,6 +112,7 @@ GrallocTextureClientOGL::WaitForBufferOwnership(bool aWaitReleaseFence)
bool
GrallocTextureClientOGL::Lock(OpenMode aMode)
{
MOZ_ASSERT(!mIsLocked);
MOZ_ASSERT(IsValid());
if (!IsValid() || !IsAllocated()) {
return false;
@@ -148,13 +149,15 @@ GrallocTextureClientOGL::Lock(OpenMode aMode)
NS_WARNING("Couldn't lock graphic buffer");
return false;
}
return BufferTextureClient::Lock(aMode);
mIsLocked = true;
return true;
}
void
GrallocTextureClientOGL::Unlock()
{
BufferTextureClient::Unlock();
MOZ_ASSERT(mIsLocked);
mIsLocked = false;
mDrawTarget = nullptr;
if (mMappedBuffer) {
mMappedBuffer = nullptr;
@@ -162,14 +165,6 @@ GrallocTextureClientOGL::Unlock()
}
}
uint8_t*
GrallocTextureClientOGL::GetBuffer() const
{
MOZ_ASSERT(IsValid());
NS_WARN_IF_FALSE(mMappedBuffer, "Trying to get a gralloc buffer without getting the lock?");
return mMappedBuffer;
}
static gfx::SurfaceFormat
SurfaceFormatForPixelFormat(android::PixelFormat aFormat)
{
@@ -379,22 +374,6 @@ GrallocTextureClientOGL::IsAllocated() const
return !!mGraphicBuffer.get();
}
bool
GrallocTextureClientOGL::Allocate(uint32_t aSize)
{
// see Bug 908196
MOZ_CRASH("This method should never be called.");
return false;
}
size_t
GrallocTextureClientOGL::GetBufferSize() const
{
// see Bug 908196
MOZ_CRASH("This method should never be called.");
return 0;
}
/*static*/ already_AddRefed<TextureClient>
GrallocTextureClientOGL::FromSharedSurface(gl::SharedSurface* abstractSurf,
TextureFlags flags)