Bug 873944 - Add FlushRendering API to the compositor interface. r=nrc

This commit is contained in:
Matt Woodrow 2013-06-18 19:58:43 +12:00
parent 969df6ba9d
commit c764b148d3
6 changed files with 39 additions and 0 deletions

View File

@ -466,6 +466,15 @@ public:
*/
virtual void SetIsFirstPaint() {}
/**
* Make sure that the previous transaction has been entirely
* completed.
*
* Note: This may sychronously wait on a remote compositor
* to complete rendering.
*/
virtual void FlushRendering() { }
// We always declare the following logging symbols, because it's
// extremely tricky to conditionally declare them. However, for
// ifndef MOZ_LAYERS_HAVE_LOG builds, they only have trivial

View File

@ -260,6 +260,16 @@ ClientLayerManager::MakeSnapshotIfRequired()
mShadowTarget = nullptr;
}
void
ClientLayerManager::FlushRendering()
{
if (mWidget) {
if (CompositorChild* remoteRenderer = mWidget->GetRemoteRenderer()) {
remoteRenderer->SendFlushRendering();
}
}
}
void
ClientLayerManager::ForwardTransaction()
{

View File

@ -53,6 +53,8 @@ public:
virtual already_AddRefed<ColorLayer> CreateColorLayer();
virtual already_AddRefed<RefLayer> CreateRefLayer();
virtual void FlushRendering() MOZ_OVERRIDE;
ShadowableLayer* Hold(Layer* aLayer);
bool HasShadowManager() const { return ShadowLayerForwarder::HasShadowManager(); }

View File

@ -249,6 +249,18 @@ CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
return true;
}
bool
CompositorParent::RecvFlushRendering()
{
// If we're waiting to do a composite, then cancel it
// and do it immediately instead.
if (mCurrentCompositeTask) {
mCurrentCompositeTask->Cancel();
ComposeToTarget(nullptr);
}
return true;
}
void
CompositorParent::ActorDestroy(ActorDestroyReason why)
{
@ -743,6 +755,7 @@ public:
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
SurfaceDescriptor* aOutSnapshot)
{ return true; }
virtual bool RecvFlushRendering() MOZ_OVERRIDE { return true; }
virtual PLayerTransactionParent*
AllocPLayerTransaction(const LayersBackend& aBackendType,

View File

@ -55,6 +55,7 @@ public:
virtual bool RecvResume() MOZ_OVERRIDE;
virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
SurfaceDescriptor* aOutSnapshot);
virtual bool RecvFlushRendering() MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;

View File

@ -53,6 +53,10 @@ parent:
sync MakeSnapshot(SurfaceDescriptor inSnapshot)
returns (SurfaceDescriptor outSnapshot);
// Make sure any pending composites are started immediately and
// block until they are completed.
sync FlushRendering();
sync PLayerTransaction(LayersBackend layersBackendHint, uint64_t id)
returns (TextureFactoryIdentifier textureFactoryIdentifier);
};