Bug 1011572 - Only do platform-sync on layer transactions when !IsSameProcess. r=nical

There's no need to do platform syncing when the compositor is in the same
process as the content thread, as they'll share a connection to the display
server.
This commit is contained in:
Chris Lord 2014-06-11 14:52:20 +01:00
Родитель 1188fbbd28
Коммит 3c0175baa4
7 изменённых файлов: 32 добавлений и 16 удалений

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

@ -18,9 +18,10 @@ using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::layers;
TextureClientX11::TextureClientX11(SurfaceFormat aFormat, TextureFlags aFlags)
TextureClientX11::TextureClientX11(ISurfaceAllocator* aAllocator, SurfaceFormat aFormat, TextureFlags aFlags)
: TextureClient(aFlags),
mFormat(aFormat),
mAllocator(aAllocator),
mLocked(false)
{
MOZ_COUNT_CTOR(TextureClientX11);
@ -51,7 +52,7 @@ TextureClientX11::Unlock()
MOZ_ASSERT(mLocked, "The TextureClient is already Unlocked!");
mLocked = false;
if (mSurface) {
if (mSurface && !mAllocator->IsSameProcess()) {
FinishX(DefaultXDisplay());
}
}
@ -86,6 +87,11 @@ TextureClientX11::AllocateForSurface(IntSize aSize, TextureAllocationFlags aText
// The host is always responsible for freeing the pixmap.
mSurface->ReleasePixmap();
if (!mAllocator->IsSameProcess()) {
FinishX(DefaultXDisplay());
}
return true;
}

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

@ -19,7 +19,7 @@ namespace layers {
class TextureClientX11 : public TextureClient
{
public:
TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TextureFlags::DEFAULT);
TextureClientX11(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat format, TextureFlags aFlags = TextureFlags::DEFAULT);
~TextureClientX11();
@ -51,6 +51,7 @@ class TextureClientX11 : public TextureClient
gfx::SurfaceFormat mFormat;
gfx::IntSize mSize;
RefPtr<gfxXlibSurface> mSurface;
RefPtr<ISurfaceAllocator> mAllocator;
bool mLocked;
};

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

@ -284,7 +284,7 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
type == gfxSurfaceType::Xlib &&
!(aTextureFlags & TextureFlags::ALLOC_FALLBACK))
{
result = new TextureClientX11(aFormat, aTextureFlags);
result = new TextureClientX11(aAllocator, aFormat, aTextureFlags);
}
#ifdef GL_PROVIDER_GLX
if (parentBackend == LayersBackend::LAYERS_OPENGL &&
@ -293,7 +293,7 @@ TextureClient::CreateTextureClientForDrawing(ISurfaceAllocator* aAllocator,
aFormat != SurfaceFormat::A8 &&
gl::sGLXLibrary.UseTextureFromPixmap())
{
result = new TextureClientX11(aFormat, aTextureFlags);
result = new TextureClientX11(aAllocator, aFormat, aTextureFlags);
}
#endif
#endif

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

@ -487,7 +487,10 @@ ImageBridgeChild::EndTransaction()
if (!mTxn->mOperations.empty()) {
cset.AppendElements(&mTxn->mOperations.front(), mTxn->mOperations.size());
}
ShadowLayerForwarder::PlatformSyncBeforeUpdate();
if (!IsSameProcess()) {
ShadowLayerForwarder::PlatformSyncBeforeUpdate();
}
AutoInfallibleTArray<EditReply, 10> replies;

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

@ -101,10 +101,12 @@ ImageBridgeParent::RecvUpdate(const EditArray& aEdits, EditReplyArray* aReply)
aReply->AppendElements(&replyv.front(), replyv.size());
}
// Ensure that any pending operations involving back and front
// buffers have completed, so that neither process stomps on the
// other's buffer contents.
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
if (!IsSameProcess()) {
// Ensure that any pending operations involving back and front
// buffers have completed, so that neither process stomps on the
// other's buffer contents.
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
}
return true;
}

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

@ -551,10 +551,12 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
}
}
// Ensure that any pending operations involving back and front
// buffers have completed, so that neither process stomps on the
// other's buffer contents.
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
if (!IsSameProcess()) {
// Ensure that any pending operations involving back and front
// buffers have completed, so that neither process stomps on the
// other's buffer contents.
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
}
mShadowLayersManager->ShadowLayersUpdated(this, aTransactionId, targetConfig,
isFirstPaint, scheduleComposite, paintSequenceNumber);

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

@ -569,8 +569,10 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
mTxn->mTargetOrientation,
aRegionToClear);
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
PlatformSyncBeforeUpdate();
if (!IsSameProcess()) {
MOZ_LAYERS_LOG(("[LayersForwarder] syncing before send..."));
PlatformSyncBeforeUpdate();
}
profiler_tracing("Paint", "Rasterize", TRACING_INTERVAL_END);
if (mTxn->mSwapRequired) {