Bug 916116 - Rename CompositableQuirks. r=bjacob

This commit is contained in:
Nicolas Silva 2013-09-30 14:14:38 +02:00
Родитель 4a148110a7
Коммит 302198d77d
9 изменённых файлов: 57 добавлений и 52 удалений

Просмотреть файл

@ -55,7 +55,7 @@ CompositableHost::AddTextureHost(TextureHost* aTexture)
RefPtr<TextureHost> second = mFirstTexture;
mFirstTexture = aTexture;
aTexture->SetNextSibling(second);
aTexture->SetCompositableQuirks(GetCompositableQuirks());
aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
}
void
@ -164,7 +164,7 @@ CompositableHost::RemoveMaskEffect()
}
// implemented in TextureHostOGL.cpp
TemporaryRef<CompositableQuirks> CreateCompositableQuirksOGL();
TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
/* static */ TemporaryRef<CompositableHost>
CompositableHost::Create(const TextureInfo& aTextureInfo)
@ -196,8 +196,8 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
MOZ_CRASH("Unknown CompositableType");
}
if (result) {
RefPtr<CompositableQuirks> quirks = CreateCompositableQuirksOGL();
result->SetCompositableQuirks(quirks);
RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
result->SetCompositableBackendSpecificData(data);
}
return result;
}

Просмотреть файл

@ -60,16 +60,16 @@ struct EffectChain;
/**
* A base class for doing CompositableHost and platform dependent task on TextureHost.
*/
class CompositableQuirks : public RefCounted<CompositableQuirks>
class CompositableBackendSpecificData : public RefCounted<CompositableBackendSpecificData>
{
public:
CompositableQuirks()
CompositableBackendSpecificData()
{
MOZ_COUNT_CTOR(CompositableQuirks);
MOZ_COUNT_CTOR(CompositableBackendSpecificData);
}
virtual ~CompositableQuirks()
virtual ~CompositableBackendSpecificData()
{
MOZ_COUNT_DTOR(CompositableQuirks);
MOZ_COUNT_DTOR(CompositableBackendSpecificData);
}
virtual void SetCompositor(Compositor* aCompositor) {}
};
@ -99,11 +99,14 @@ public:
virtual CompositableType GetType() = 0;
virtual CompositableQuirks* GetCompositableQuirks() { return mQuirks; }
virtual void SetCompositableQuirks(CompositableQuirks* aQuirks)
virtual CompositableBackendSpecificData* GetCompositableBackendSpecificData()
{
mQuirks = aQuirks;
return mBackendData;
}
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mBackendData = aBackendData;
}
// If base class overrides, it should still call the parent implementation
@ -292,7 +295,7 @@ protected:
TextureInfo mTextureInfo;
Compositor* mCompositor;
Layer* mLayer;
RefPtr<CompositableQuirks> mQuirks;
RefPtr<CompositableBackendSpecificData> mBackendData;
RefPtr<TextureHost> mFirstTexture;
bool mAttached;
bool mKeepAttached;

Просмотреть файл

@ -57,7 +57,7 @@ DeprecatedTextureHost::CreateDeprecatedTextureHost(SurfaceDescriptorType aDescri
aDeprecatedTextureHostFlags,
aTextureFlags);
if (aCompositableHost) {
result->SetCompositableQuirks(aCompositableHost->GetCompositableQuirks());
result->SetCompositableBackendSpecificData(aCompositableHost->GetCompositableBackendSpecificData());
}
return result;
}
@ -144,9 +144,10 @@ CreateBackendIndependentTextureHost(uint64_t aID,
return result;
}
void TextureHost::SetCompositableQuirks(CompositableQuirks* aQuirks)
void
TextureHost::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mQuirks = aQuirks;
mCompositableBackendData = aBackendData;
}
@ -175,9 +176,10 @@ TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
#endif
void TextureSource::SetCompositableQuirks(CompositableQuirks* aQuirks)
void
TextureSource::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mQuirks = aQuirks;
mCompositableBackendData = aBackendData;
}
TextureSource::TextureSource()

Просмотреть файл

@ -39,7 +39,7 @@ namespace layers {
class Compositor;
class CompositableHost;
class CompositableQuirks;
class CompositableBackendSpecificData;
class SurfaceDescriptor;
class ISurfaceAllocator;
class TextureSourceOGL;
@ -118,10 +118,10 @@ public:
*/
virtual TileIterator* AsTileIterator() { return nullptr; }
virtual void SetCompositableQuirks(CompositableQuirks* aQuirks);
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
protected:
RefPtr<CompositableQuirks> mQuirks;
RefPtr<CompositableBackendSpecificData> mCompositableBackendData;
};
@ -382,7 +382,7 @@ public:
return LayerRenderState();
}
virtual void SetCompositableQuirks(CompositableQuirks* aQuirks);
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
#ifdef MOZ_LAYERS_HAVE_LOG
virtual const char *Name() { return "TextureHost"; }
@ -393,7 +393,7 @@ protected:
uint64_t mID;
RefPtr<TextureHost> mNextTexture;
TextureFlags mFlags;
RefPtr<CompositableQuirks> mQuirks;
RefPtr<CompositableBackendSpecificData> mCompositableBackendData;
};
/**

Просмотреть файл

@ -239,7 +239,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
op.textureFlags());
MOZ_ASSERT(tex.get());
tex->SetCompositor(compositable->GetCompositor());
// set CompositableQuirks
// set CompositableBackendSpecificData
// on gonk, create EGLImage if possible.
// create EGLImage during buffer swap could reduce the graphic driver's task
// during rendering.

Просмотреть файл

@ -166,9 +166,9 @@ GrallocTextureSourceOGL::GetFormat() const {
}
void
GrallocTextureSourceOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
GrallocTextureSourceOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mQuirks = aQuirks;
mCompositableBackendData = aBackendData;
if (!mCompositor) {
return;
@ -326,16 +326,16 @@ GrallocTextureSourceOGL::GetAsSurface() {
GLuint
GrallocTextureSourceOGL::GetGLTexture()
{
mQuirks->SetCompositor(mCompositor);
return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
mCompositableBackendData->SetCompositor(mCompositor);
return static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->GetTexture();
}
void
GrallocTextureHostOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
GrallocTextureHostOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mQuirks = aQuirks;
mCompositableBackendData = aBackendData;
if (mTextureSource) {
mTextureSource->SetCompositableQuirks(aQuirks);
mTextureSource->SetCompositableBackendSpecificData(aBackendData);
}
}

Просмотреть файл

@ -47,7 +47,7 @@ public:
return LOCAL_GL_CLAMP_TO_EDGE;
}
virtual void SetCompositableQuirks(CompositableQuirks* aQuirks) MOZ_OVERRIDE;
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
void DeallocateDeviceData();
@ -106,7 +106,7 @@ public:
virtual already_AddRefed<gfxImageSurface> GetAsSurface() MOZ_OVERRIDE;
virtual void SetCompositableQuirks(CompositableQuirks* aQuirks) MOZ_OVERRIDE;
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
bool IsValid() const;

Просмотреть файл

@ -41,11 +41,11 @@ namespace layers {
class Compositor;
TemporaryRef<CompositableQuirks>
CreateCompositableQuirksOGL()
TemporaryRef<CompositableBackendSpecificData>
CreateCompositableBackendSpecificDataOGL()
{
#ifdef MOZ_WIDGET_GONK
return new CompositableQuirksGonkOGL();
return new CompositableDataGonkOGL();
#else
return nullptr;
#endif
@ -166,27 +166,27 @@ WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
return LOCAL_GL_CLAMP_TO_EDGE;
}
CompositableQuirksGonkOGL::CompositableQuirksGonkOGL()
CompositableDataGonkOGL::CompositableDataGonkOGL()
: mTexture(0)
{
}
CompositableQuirksGonkOGL::~CompositableQuirksGonkOGL()
CompositableDataGonkOGL::~CompositableDataGonkOGL()
{
DeleteTextureIfPresent();
}
gl::GLContext*
CompositableQuirksGonkOGL::gl() const
CompositableDataGonkOGL::gl() const
{
return mCompositor ? mCompositor->gl() : nullptr;
}
void CompositableQuirksGonkOGL::SetCompositor(Compositor* aCompositor)
void CompositableDataGonkOGL::SetCompositor(Compositor* aCompositor)
{
mCompositor = static_cast<CompositorOGL*>(aCompositor);
}
GLuint CompositableQuirksGonkOGL::GetTexture()
GLuint CompositableDataGonkOGL::GetTexture()
{
if (!mTexture) {
gl()->MakeCurrent();
@ -196,7 +196,7 @@ GLuint CompositableQuirksGonkOGL::GetTexture()
}
void
CompositableQuirksGonkOGL::DeleteTextureIfPresent()
CompositableDataGonkOGL::DeleteTextureIfPresent()
{
if (mTexture) {
gl()->MakeCurrent();
@ -507,7 +507,7 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage
}
#ifdef MOZ_WIDGET_GONK
if (mQuirks) {
if (mCompositableBackendData) {
// on gonk, this class is used as a fallback from gralloc buffer.
// There is a case this class is used with GrallocDeprecatedTextureHostOGL
// under same CompositableHost. if it happens, a gralloc buffer of
@ -515,7 +515,7 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage
// when the gralloc buffer is not rendered.
// Establish the unbound by deleting the texture.
// See Bug 916264.
static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->DeleteTextureIfPresent();
static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->DeleteTextureIfPresent();
}
#endif
@ -1268,8 +1268,8 @@ GrallocDeprecatedTextureHostOGL::GetRenderState()
GLuint
GrallocDeprecatedTextureHostOGL::GetGLTexture()
{
mQuirks->SetCompositor(mCompositor);
return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
mCompositableBackendData->SetCompositor(mCompositor);
return static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get())->GetTexture();
}
#endif // MOZ_WIDGET_GONK

Просмотреть файл

@ -55,19 +55,19 @@ class CompositorOGL;
class TextureImageDeprecatedTextureHostOGL;
/**
* CompositableQuirks implementation for the Gonk OpenGL backend.
* CompositableBackendSpecificData implementation for the Gonk OpenGL backend.
* Share a same texture between TextureHosts in the same CompositableHost.
* By shareing the texture among the TextureHosts, number of texture allocations
* can be reduced than texture allocation in every TextureHosts.
* From Bug 912134, use only one texture among all TextureHosts degrade
* the rendering performance.
* CompositableQuirksGonkOGL chooses in a middile of them.
* CompositableDataGonkOGL chooses in a middile of them.
*/
class CompositableQuirksGonkOGL : public CompositableQuirks
class CompositableDataGonkOGL : public CompositableBackendSpecificData
{
public:
CompositableQuirksGonkOGL();
virtual ~CompositableQuirksGonkOGL();
CompositableDataGonkOGL();
virtual ~CompositableDataGonkOGL();
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
GLuint GetTexture();