From 1623100c46c608a5880c0f529fa5292a8d73804c Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Tue, 25 Sep 2012 16:20:41 +1200 Subject: [PATCH] b=763449 Finish X requests on mROFrontBuffer before deleting shadow layer r=cjones --HG-- extra : rebase_source : 7381b234a29d648afdf76eff1f1e89f6e5cd88b5 --- gfx/layers/basic/BasicThebesLayer.cpp | 11 +++++++++++ gfx/layers/basic/BasicThebesLayer.h | 6 +----- gfx/layers/ipc/ShadowLayerUtilsX11.cpp | 2 +- gfx/layers/ipc/ShadowLayers.h | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/gfx/layers/basic/BasicThebesLayer.cpp b/gfx/layers/basic/BasicThebesLayer.cpp index 6ed02c06a4b8..28005a44f352 100644 --- a/gfx/layers/basic/BasicThebesLayer.cpp +++ b/gfx/layers/basic/BasicThebesLayer.cpp @@ -281,6 +281,17 @@ private: AutoBufferTracker& operator=(const AutoBufferTracker&) MOZ_DELETE; }; +BasicShadowableThebesLayer::~BasicShadowableThebesLayer() +{ + // Finish any use of mROFrontBuffer since the last ForwardTransaction(), + // before the Shadow frees the surface. + if (OptionalThebesBuffer::Tnull_t != mROFrontBuffer.type()) { + ShadowLayerForwarder::PlatformSyncBeforeUpdate(); + } + DestroyBackBuffer(); + MOZ_COUNT_DTOR(BasicShadowableThebesLayer); +} + void BasicShadowableThebesLayer::PaintThebes(gfxContext* aContext, Layer* aMaskLayer, diff --git a/gfx/layers/basic/BasicThebesLayer.h b/gfx/layers/basic/BasicThebesLayer.h index 96cea5ac0b33..317f9cd8eb2f 100644 --- a/gfx/layers/basic/BasicThebesLayer.h +++ b/gfx/layers/basic/BasicThebesLayer.h @@ -121,11 +121,7 @@ public: { MOZ_COUNT_CTOR(BasicShadowableThebesLayer); } - virtual ~BasicShadowableThebesLayer() - { - DestroyBackBuffer(); - MOZ_COUNT_DTOR(BasicShadowableThebesLayer); - } + virtual ~BasicShadowableThebesLayer(); virtual void PaintThebes(gfxContext* aContext, Layer* aMaskLayer, diff --git a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp index 1cac2e17e045..1a0ca235fff7 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp @@ -177,7 +177,7 @@ ShadowLayerForwarder::PlatformSyncBeforeUpdate() // operations on the back buffers before handing them to the // parent, otherwise the surface might be used by the parent's // Display in between two operations queued by our Display. - XSync(DefaultXDisplay(), False); + FinishX(DefaultXDisplay()); } } diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 6d3723c0ef4c..57f191dc8fb2 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -319,6 +319,8 @@ public: virtual int32_t GetMaxTextureSize() const { return mMaxTextureSize; } void SetMaxTextureSize(int32_t aMaxTextureSize) { mMaxTextureSize = aMaxTextureSize; } + static void PlatformSyncBeforeUpdate(); + protected: ShadowLayerForwarder(); @@ -379,8 +381,6 @@ private: bool PlatformDestroySharedSurface(SurfaceDescriptor* aSurface); - static void PlatformSyncBeforeUpdate(); - Transaction* mTxn; int32_t mMaxTextureSize; LayersBackend mParentBackend;