mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 04:27:41 +00:00
Bug 1073252. Part 1: Track opaqueness of gralloc TextureClient/Host. r=nical
--HG-- extra : rebase_source : de08e7a128bad27250cae94386e8ffea5fa26d6d
This commit is contained in:
parent
77c398977c
commit
b34f5630d6
@ -76,6 +76,8 @@ GrallocImage::SetData(const Data& aData)
|
||||
new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(),
|
||||
gfx::SurfaceFormat::UNKNOWN,
|
||||
gfx::BackendType::NONE);
|
||||
// GrallocImages are all YUV and don't support alpha.
|
||||
textureClient->SetIsOpaque(true);
|
||||
bool result =
|
||||
textureClient->AllocateGralloc(mData.mYSize,
|
||||
HAL_PIXEL_FORMAT_YV12,
|
||||
|
@ -74,6 +74,7 @@ struct NewSurfaceDescriptorGralloc {
|
||||
* Extra size member is necessary. See Bug 850566.
|
||||
*/
|
||||
IntSize size;
|
||||
bool isOpaque;
|
||||
};
|
||||
|
||||
struct SharedSurfaceDescriptor {
|
||||
|
@ -20,19 +20,6 @@ namespace layers {
|
||||
using namespace mozilla::gfx;
|
||||
using namespace android;
|
||||
|
||||
GrallocTextureClientOGL::GrallocTextureClientOGL(MaybeMagicGrallocBufferHandle buffer,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
TextureFlags aFlags)
|
||||
: BufferTextureClient(nullptr, gfx::SurfaceFormat::UNKNOWN, aMoz2dBackend, aFlags)
|
||||
, mGrallocHandle(buffer)
|
||||
, mMappedBuffer(nullptr)
|
||||
, mMediaBuffer(nullptr)
|
||||
{
|
||||
InitWith(buffer, aSize);
|
||||
MOZ_COUNT_CTOR(GrallocTextureClientOGL);
|
||||
}
|
||||
|
||||
GrallocTextureClientOGL::GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
@ -41,6 +28,7 @@ GrallocTextureClientOGL::GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
|
||||
, mGrallocHandle(null_t())
|
||||
, mMappedBuffer(nullptr)
|
||||
, mMediaBuffer(nullptr)
|
||||
, mIsOpaque(gfx::IsOpaque(aFormat))
|
||||
{
|
||||
MOZ_COUNT_CTOR(GrallocTextureClientOGL);
|
||||
}
|
||||
@ -89,7 +77,7 @@ GrallocTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
|
||||
return false;
|
||||
}
|
||||
|
||||
aOutDescriptor = NewSurfaceDescriptorGralloc(mGrallocHandle, mSize);
|
||||
aOutDescriptor = NewSurfaceDescriptorGralloc(mGrallocHandle, mSize, mIsOpaque);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,6 @@ namespace layers {
|
||||
class GrallocTextureClientOGL : public BufferTextureClient
|
||||
{
|
||||
public:
|
||||
GrallocTextureClientOGL(MaybeMagicGrallocBufferHandle buffer,
|
||||
gfx::IntSize aSize,
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
TextureFlags aFlags = TextureFlags::DEFAULT);
|
||||
GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
|
||||
gfx::SurfaceFormat aFormat,
|
||||
gfx::BackendType aMoz2dBackend,
|
||||
@ -95,6 +91,8 @@ public:
|
||||
|
||||
bool AllocateGralloc(gfx::IntSize aYSize, uint32_t aAndroidFormat, uint32_t aUsage);
|
||||
|
||||
void SetIsOpaque(bool aIsOpaque) { mIsOpaque = aIsOpaque; }
|
||||
|
||||
virtual bool Allocate(uint32_t aSize) MOZ_OVERRIDE;
|
||||
|
||||
virtual size_t GetBufferSize() const MOZ_OVERRIDE;
|
||||
@ -147,6 +145,8 @@ protected:
|
||||
gfx::IntSize mSize;
|
||||
|
||||
android::MediaBuffer* mMediaBuffer;
|
||||
|
||||
bool mIsOpaque;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
@ -246,6 +246,7 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
||||
, mDescriptorSize(aDescriptor.size())
|
||||
, mFormat(gfx::SurfaceFormat::UNKNOWN)
|
||||
, mEGLImage(EGL_NO_IMAGE)
|
||||
, mIsOpaque(aDescriptor.isOpaque())
|
||||
{
|
||||
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
|
||||
MOZ_ASSERT(graphicBuffer);
|
||||
|
@ -153,6 +153,7 @@ private:
|
||||
gfx::IntSize mDescriptorSize;
|
||||
gfx::SurfaceFormat mFormat;
|
||||
EGLImage mEGLImage;
|
||||
bool mIsOpaque;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
Loading…
x
Reference in New Issue
Block a user