mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1119019 - Avoid destroying a SharedSurface before its TextureClient/Host pair. r=sotaro
This commit is contained in:
parent
5600f01996
commit
0b465c61eb
@ -403,5 +403,20 @@ CanvasClientSharedSurface::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
|
|||||||
forwarder->UseTexture(this, mFrontTex);
|
forwarder->UseTexture(this, mFrontTex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CanvasClientSharedSurface::ClearSurfaces()
|
||||||
|
{
|
||||||
|
if (mFrontTex && (mFront || mPrevFront)) {
|
||||||
|
// Force a synchronous destruction so that the TextureHost does not
|
||||||
|
// outlive the SharedSurface. This won't be needed once TextureClient/Host
|
||||||
|
// and SharedSurface are merged.
|
||||||
|
mFrontTex->ForceRemove(true /* sync */);
|
||||||
|
mFrontTex = nullptr;
|
||||||
|
}
|
||||||
|
// It is important to destroy the SharedSurface *after* the TextureClient.
|
||||||
|
mFront = nullptr;
|
||||||
|
mPrevFront = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,25 +119,30 @@ private:
|
|||||||
|
|
||||||
RefPtr<TextureClient> mFrontTex;
|
RefPtr<TextureClient> mFrontTex;
|
||||||
|
|
||||||
|
void ClearSurfaces();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CanvasClientSharedSurface(CompositableForwarder* aLayerForwarder,
|
CanvasClientSharedSurface(CompositableForwarder* aLayerForwarder,
|
||||||
TextureFlags aFlags);
|
TextureFlags aFlags);
|
||||||
|
|
||||||
|
~CanvasClientSharedSurface()
|
||||||
|
{
|
||||||
|
ClearSurfaces();
|
||||||
|
}
|
||||||
|
|
||||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE {
|
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE {
|
||||||
return TextureInfo(CompositableType::IMAGE);
|
return TextureInfo(CompositableType::IMAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Clear() MOZ_OVERRIDE {
|
virtual void Clear() MOZ_OVERRIDE {
|
||||||
mFront = nullptr;
|
ClearSurfaces();
|
||||||
mPrevFront = nullptr;
|
|
||||||
mFrontTex = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Update(gfx::IntSize aSize,
|
virtual void Update(gfx::IntSize aSize,
|
||||||
ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
|
ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual void OnDetach() MOZ_OVERRIDE {
|
virtual void OnDetach() MOZ_OVERRIDE {
|
||||||
CanvasClientSharedSurface::Clear();
|
ClearSurfaces();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -503,10 +503,10 @@ TextureClient::KeepUntilFullDeallocation(KeepAlive* aKeep)
|
|||||||
mActor->mKeep = aKeep;
|
mActor->mKeep = aKeep;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureClient::ForceRemove()
|
void TextureClient::ForceRemove(bool sync)
|
||||||
{
|
{
|
||||||
if (mValid && mActor) {
|
if (mValid && mActor) {
|
||||||
if (GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
|
if (sync || GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
|
||||||
MOZ_PERFORMANCE_WARNING("gfx", "TextureClient/Host pair requires synchronous deallocation");
|
MOZ_PERFORMANCE_WARNING("gfx", "TextureClient/Host pair requires synchronous deallocation");
|
||||||
if (mActor->IPCOpen()) {
|
if (mActor->IPCOpen()) {
|
||||||
mActor->SendClearTextureHostSync();
|
mActor->SendClearTextureHostSync();
|
||||||
|
@ -426,8 +426,10 @@ public:
|
|||||||
* If the texture flags contain TextureFlags::DEALLOCATE_CLIENT, the destruction
|
* If the texture flags contain TextureFlags::DEALLOCATE_CLIENT, the destruction
|
||||||
* will be synchronously coordinated with the compositor side, otherwise it
|
* will be synchronously coordinated with the compositor side, otherwise it
|
||||||
* will be done asynchronously.
|
* will be done asynchronously.
|
||||||
|
* If sync is true, the destruction will be synchronous regardless of the
|
||||||
|
* texture's flags (bad for performance, use with care).
|
||||||
*/
|
*/
|
||||||
void ForceRemove();
|
void ForceRemove(bool sync = false);
|
||||||
|
|
||||||
virtual void SetReleaseFenceHandle(FenceHandle aReleaseFenceHandle)
|
virtual void SetReleaseFenceHandle(FenceHandle aReleaseFenceHandle)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user