зеркало из https://github.com/mozilla/gecko-dev.git
Bug 966446 - Handle GrallocBufferActor::ActorDestroy for new texture. r=nical
This commit is contained in:
Родитель
b8837d8b4c
Коммит
23c4f9b1c3
|
@ -411,6 +411,9 @@ public:
|
||||||
// to forget about the shmem _without_ releasing it.
|
// to forget about the shmem _without_ releasing it.
|
||||||
virtual void OnShutdown() {}
|
virtual void OnShutdown() {}
|
||||||
|
|
||||||
|
// Forget buffer actor. Used only for hacky fix for bug 966446.
|
||||||
|
virtual void ForgetBufferActor() {}
|
||||||
|
|
||||||
virtual const char *Name() { return "TextureHost"; }
|
virtual const char *Name() { return "TextureHost"; }
|
||||||
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,7 @@ int64_t GrallocReporter::sAmount = 0;
|
||||||
|
|
||||||
GrallocBufferActor::GrallocBufferActor()
|
GrallocBufferActor::GrallocBufferActor()
|
||||||
: mAllocBytes(0)
|
: mAllocBytes(0)
|
||||||
|
, mTextureHost(nullptr)
|
||||||
{
|
{
|
||||||
static bool registered;
|
static bool registered;
|
||||||
if (!registered) {
|
if (!registered) {
|
||||||
|
@ -304,12 +305,18 @@ GrallocBufferActor::Create(const gfx::IntSize& aSize,
|
||||||
return actor;
|
return actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// used only for hacky fix for bug 862324
|
|
||||||
void GrallocBufferActor::ActorDestroy(ActorDestroyReason)
|
void GrallocBufferActor::ActorDestroy(ActorDestroyReason)
|
||||||
{
|
{
|
||||||
|
// used only for hacky fix for bug 862324
|
||||||
for (size_t i = 0; i < mDeprecatedTextureHosts.Length(); i++) {
|
for (size_t i = 0; i < mDeprecatedTextureHosts.Length(); i++) {
|
||||||
mDeprecatedTextureHosts[i]->ForgetBuffer();
|
mDeprecatedTextureHosts[i]->ForgetBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used only for hacky fix for bug 966446.
|
||||||
|
if (mTextureHost) {
|
||||||
|
mTextureHost->ForgetBufferActor();
|
||||||
|
mTextureHost = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// used only for hacky fix for bug 862324
|
// used only for hacky fix for bug 862324
|
||||||
|
@ -327,6 +334,16 @@ void GrallocBufferActor::RemoveDeprecatedTextureHost(DeprecatedTextureHost* aDep
|
||||||
MOZ_ASSERT(!mDeprecatedTextureHosts.Contains(aDeprecatedTextureHost));
|
MOZ_ASSERT(!mDeprecatedTextureHosts.Contains(aDeprecatedTextureHost));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GrallocBufferActor::AddTextureHost(TextureHost* aTextureHost)
|
||||||
|
{
|
||||||
|
mTextureHost = aTextureHost;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GrallocBufferActor::RemoveTextureHost()
|
||||||
|
{
|
||||||
|
mTextureHost = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/*static*/ bool
|
/*static*/ bool
|
||||||
LayerManagerComposite::SupportsDirectTexturing()
|
LayerManagerComposite::SupportsDirectTexturing()
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,6 +90,9 @@ public:
|
||||||
void AddDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
void AddDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
||||||
void RemoveDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
void RemoveDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
||||||
|
|
||||||
|
void AddTextureHost(TextureHost* aTextureHost);
|
||||||
|
void RemoveTextureHost();
|
||||||
|
|
||||||
android::GraphicBuffer* GetGraphicBuffer();
|
android::GraphicBuffer* GetGraphicBuffer();
|
||||||
|
|
||||||
void InitFromHandle(const MagicGrallocBufferHandle& aHandle);
|
void InitFromHandle(const MagicGrallocBufferHandle& aHandle);
|
||||||
|
@ -107,6 +110,9 @@ private:
|
||||||
// see bug 865908 about fixing this.
|
// see bug 865908 about fixing this.
|
||||||
nsAutoTArray<DeprecatedTextureHost*, 2> mDeprecatedTextureHosts;
|
nsAutoTArray<DeprecatedTextureHost*, 2> mDeprecatedTextureHosts;
|
||||||
|
|
||||||
|
// Used only for hacky fix for bug 966446.
|
||||||
|
TextureHost* mTextureHost;
|
||||||
|
|
||||||
friend class ISurfaceAllocator;
|
friend class ISurfaceAllocator;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -236,6 +236,8 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
||||||
mGrallocActor =
|
mGrallocActor =
|
||||||
static_cast<GrallocBufferActor*>(aDescriptor.bufferParent());
|
static_cast<GrallocBufferActor*>(aDescriptor.bufferParent());
|
||||||
|
|
||||||
|
mGrallocActor->AddTextureHost(this);
|
||||||
|
|
||||||
android::GraphicBuffer* graphicBuffer = mGrallocActor->GetGraphicBuffer();
|
android::GraphicBuffer* graphicBuffer = mGrallocActor->GetGraphicBuffer();
|
||||||
|
|
||||||
mSize = aDescriptor.size();
|
mSize = aDescriptor.size();
|
||||||
|
@ -250,6 +252,10 @@ GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
|
||||||
GrallocTextureHostOGL::~GrallocTextureHostOGL()
|
GrallocTextureHostOGL::~GrallocTextureHostOGL()
|
||||||
{
|
{
|
||||||
mTextureSource = nullptr;
|
mTextureSource = nullptr;
|
||||||
|
if (mGrallocActor) {
|
||||||
|
mGrallocActor->RemoveTextureHost();
|
||||||
|
mGrallocActor = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -288,7 +294,9 @@ GrallocTextureHostOGL::DeallocateSharedData()
|
||||||
if (mTextureSource) {
|
if (mTextureSource) {
|
||||||
mTextureSource->ForgetBuffer();
|
mTextureSource->ForgetBuffer();
|
||||||
}
|
}
|
||||||
PGrallocBufferParent::Send__delete__(mGrallocActor);
|
if (mGrallocActor) {
|
||||||
|
PGrallocBufferParent::Send__delete__(mGrallocActor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -112,6 +112,12 @@ public:
|
||||||
|
|
||||||
virtual const char* Name() MOZ_OVERRIDE { return "GrallocTextureHostOGL"; }
|
virtual const char* Name() MOZ_OVERRIDE { return "GrallocTextureHostOGL"; }
|
||||||
|
|
||||||
|
// Forget buffer actor. Used only for hacky fix for bug 966446.
|
||||||
|
virtual void ForgetBufferActor()
|
||||||
|
{
|
||||||
|
mGrallocActor = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GrallocBufferActor* mGrallocActor;
|
GrallocBufferActor* mGrallocActor;
|
||||||
RefPtr<GrallocTextureSourceOGL> mTextureSource;
|
RefPtr<GrallocTextureSourceOGL> mTextureSource;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче