mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 961289 - Assign sequence numbers to paints on the client side and forward them to the compositor. r=BenWa,kats
--HG-- extra : source : d5331eaed1c789ac0248e8710a7b4a167ae349b6
This commit is contained in:
parent
29b911b41e
commit
535bbba72d
@ -95,8 +95,11 @@ Collect(AsyncPanZoomController* aApzc, nsTArray< nsRefPtr<AsyncPanZoomController
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, Layer* aRoot,
|
||||
bool aIsFirstPaint, uint64_t aFirstPaintLayersId)
|
||||
APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||
Layer* aRoot,
|
||||
bool aIsFirstPaint,
|
||||
uint64_t aFirstPaintLayersId,
|
||||
uint32_t aPaintSequenceNumber)
|
||||
{
|
||||
if (AsyncPanZoomController::GetThreadAssertionsEnabled()) {
|
||||
Compositor::AssertOnCompositorThread();
|
||||
@ -144,7 +147,8 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||
gfx3DMatrix aTransform,
|
||||
AsyncPanZoomController* aParent,
|
||||
AsyncPanZoomController* aNextSibling,
|
||||
bool aIsFirstPaint, uint64_t aFirstPaintLayersId,
|
||||
bool aIsFirstPaint,
|
||||
uint64_t aFirstPaintLayersId,
|
||||
nsTArray< nsRefPtr<AsyncPanZoomController> >* aApzcsToDestroy)
|
||||
{
|
||||
mTreeLock.AssertCurrentThreadOwns();
|
||||
@ -298,7 +302,8 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||
for (Layer* child = aLayer->GetLastChild(); child; child = child->GetPrevSibling()) {
|
||||
gfx::TreeAutoIndent indent(mApzcTreeLog);
|
||||
next = UpdatePanZoomControllerTree(aCompositor, child, childLayersId, aTransform, aParent, next,
|
||||
aIsFirstPaint, aFirstPaintLayersId, aApzcsToDestroy);
|
||||
aIsFirstPaint, aFirstPaintLayersId,
|
||||
aPaintSequenceNumber, aApzcsToDestroy);
|
||||
}
|
||||
|
||||
// Return the APZC that should be the sibling of other APZCs as we continue
|
||||
|
@ -104,9 +104,16 @@ public:
|
||||
* to included a first-paint. If this is true, the part of
|
||||
* the tree that is affected by the first-paint flag is
|
||||
* indicated by the aFirstPaintLayersId parameter.
|
||||
* @param aPaintSequenceNumber The sequence number of the paint that triggered
|
||||
* this layer update. Note that every layer child
|
||||
* process' layer subtree has its own sequence
|
||||
* numbers.
|
||||
*/
|
||||
void UpdatePanZoomControllerTree(CompositorParent* aCompositor, Layer* aRoot,
|
||||
bool aIsFirstPaint, uint64_t aFirstPaintLayersId);
|
||||
void UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||
Layer* aRoot,
|
||||
bool aIsFirstPaint,
|
||||
uint64_t aFirstPaintLayersId,
|
||||
uint32_t aPaintSequenceNumber);
|
||||
|
||||
/**
|
||||
* General handler for incoming input events. Manipulates the frame metrics
|
||||
|
@ -47,6 +47,7 @@ ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
||||
, mTransactionIncomplete(false)
|
||||
, mCompositorMightResample(false)
|
||||
, mNeedsComposite(false)
|
||||
, mPaintSequenceNumber(0)
|
||||
, mForwarder(new ShadowLayerForwarder)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientLayerManager);
|
||||
@ -159,6 +160,11 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
|
||||
if (aTarget && XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
mShadowTarget = aTarget;
|
||||
}
|
||||
|
||||
// If this is a new paint, increment the paint sequence number.
|
||||
if (!mIsRepeatTransaction) {
|
||||
++mPaintSequenceNumber;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -405,7 +411,8 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite)
|
||||
// forward this transaction's changeset to our LayerManagerComposite
|
||||
bool sent;
|
||||
AutoInfallibleTArray<EditReply, 10> replies;
|
||||
if (HasShadowManager() && mForwarder->EndTransaction(&replies, mRegionToClear, aScheduleComposite, &sent)) {
|
||||
if (HasShadowManager() && mForwarder->EndTransaction(&replies, mRegionToClear,
|
||||
aScheduleComposite, mPaintSequenceNumber, &sent)) {
|
||||
for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
|
||||
const EditReply& reply = replies[i];
|
||||
|
||||
|
@ -232,6 +232,10 @@ private:
|
||||
bool mCompositorMightResample;
|
||||
bool mNeedsComposite;
|
||||
|
||||
// An incrementing sequence number for paints.
|
||||
// Incremented in BeginTransaction(), but not for repeat transactions.
|
||||
uint32_t mPaintSequenceNumber;
|
||||
|
||||
RefPtr<ShadowLayerForwarder> mForwarder;
|
||||
nsAutoTArray<RefPtr<TextureClientPool>,2> mTexturePools;
|
||||
nsAutoTArray<dom::OverfillCallback*,0> mOverfillCallbacks;
|
||||
|
@ -521,13 +521,15 @@ CompositorParent::ScheduleTask(CancelableTask* task, int time)
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint, bool aScheduleComposite)
|
||||
CompositorParent::NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint,
|
||||
bool aScheduleComposite, uint32_t aPaintSequenceNumber)
|
||||
{
|
||||
if (mApzcTreeManager &&
|
||||
mLayerManager &&
|
||||
mLayerManager->GetRoot()) {
|
||||
AutoResolveRefLayers resolve(mCompositionManager);
|
||||
mApzcTreeManager->UpdatePanZoomControllerTree(this, mLayerManager->GetRoot(), aIsFirstPaint, aId);
|
||||
mApzcTreeManager->UpdatePanZoomControllerTree(this, mLayerManager->GetRoot(),
|
||||
aIsFirstPaint, aId, aPaintSequenceNumber);
|
||||
|
||||
mLayerManager->NotifyShadowTreeTransaction();
|
||||
}
|
||||
@ -768,7 +770,8 @@ void
|
||||
CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite)
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber)
|
||||
{
|
||||
ScheduleRotationOnCompositorThread(aTargetConfig, aIsFirstPaint);
|
||||
|
||||
@ -784,7 +787,8 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
|
||||
if (mApzcTreeManager) {
|
||||
AutoResolveRefLayers resolve(mCompositionManager);
|
||||
mApzcTreeManager->UpdatePanZoomControllerTree(this, root, aIsFirstPaint, mRootLayerTreeID);
|
||||
mApzcTreeManager->UpdatePanZoomControllerTree(this, root, aIsFirstPaint,
|
||||
mRootLayerTreeID, aPaintSequenceNumber);
|
||||
}
|
||||
|
||||
if (root) {
|
||||
@ -1131,7 +1135,8 @@ public:
|
||||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite) MOZ_OVERRIDE;
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber) MOZ_OVERRIDE;
|
||||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
|
||||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||
@ -1291,7 +1296,8 @@ CrossProcessCompositorParent::ShadowLayersUpdated(
|
||||
LayerTransactionParent* aLayerTree,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite)
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber)
|
||||
{
|
||||
uint64_t id = aLayerTree->GetId();
|
||||
|
||||
@ -1310,7 +1316,8 @@ CrossProcessCompositorParent::ShadowLayersUpdated(
|
||||
}
|
||||
UpdateIndirectTree(id, shadowRoot, aTargetConfig);
|
||||
|
||||
state->mParent->NotifyShadowTreeTransaction(id, aIsFirstPaint, aScheduleComposite);
|
||||
state->mParent->NotifyShadowTreeTransaction(id, aIsFirstPaint, aScheduleComposite,
|
||||
aPaintSequenceNumber);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -97,7 +97,8 @@ public:
|
||||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite) MOZ_OVERRIDE;
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber) MOZ_OVERRIDE;
|
||||
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
|
||||
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
|
||||
const TimeStamp& aTime) MOZ_OVERRIDE;
|
||||
@ -128,7 +129,8 @@ public:
|
||||
bool ScheduleResumeOnCompositorThread(int width, int height);
|
||||
|
||||
virtual void ScheduleComposition();
|
||||
void NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint, bool aScheduleComposite);
|
||||
void NotifyShadowTreeTransaction(uint64_t aId, bool aIsFirstPaint,
|
||||
bool aScheduleComposite, uint32_t aPaintSequenceNumber);
|
||||
|
||||
/**
|
||||
* Check rotation info and schedule a rendering task if needed.
|
||||
|
@ -179,9 +179,11 @@ bool
|
||||
LayerTransactionParent::RecvUpdateNoSwap(const InfallibleTArray<Edit>& cset,
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite)
|
||||
const bool& scheduleComposite,
|
||||
const uint32_t& paintSequenceNumber)
|
||||
{
|
||||
return RecvUpdate(cset, targetConfig, isFirstPaint, scheduleComposite, nullptr);
|
||||
return RecvUpdate(cset, targetConfig, isFirstPaint, scheduleComposite,
|
||||
paintSequenceNumber, nullptr);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -189,6 +191,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite,
|
||||
const uint32_t& paintSequenceNumber,
|
||||
InfallibleTArray<EditReply>* reply)
|
||||
{
|
||||
profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START);
|
||||
@ -547,7 +550,8 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
|
||||
// other's buffer contents.
|
||||
LayerManagerComposite::PlatformSyncBeforeReplyUpdate();
|
||||
|
||||
mShadowLayersManager->ShadowLayersUpdated(this, targetConfig, isFirstPaint, scheduleComposite);
|
||||
mShadowLayersManager->ShadowLayersUpdated(this, targetConfig, isFirstPaint,
|
||||
scheduleComposite, paintSequenceNumber);
|
||||
|
||||
#ifdef COMPOSITOR_PERFORMANCE_WARNING
|
||||
int compositeTime = (int)(mozilla::TimeStamp::Now() - updateStart).ToMilliseconds();
|
||||
|
@ -89,12 +89,14 @@ protected:
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite,
|
||||
const uint32_t& paintSequenceNumber,
|
||||
EditReplyArray* reply) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvUpdateNoSwap(const EditArray& cset,
|
||||
const TargetConfig& targetConfig,
|
||||
const bool& isFirstPaint,
|
||||
const bool& scheduleComposite) MOZ_OVERRIDE;
|
||||
const bool& scheduleComposite,
|
||||
const uint32_t& paintSequenceNumber) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvClearCachedResources() MOZ_OVERRIDE;
|
||||
virtual bool RecvForceComposite() MOZ_OVERRIDE;
|
||||
|
@ -51,7 +51,8 @@ parent:
|
||||
|
||||
// The isFirstPaint flag can be used to indicate that this is the first update
|
||||
// for a particular document.
|
||||
sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite)
|
||||
sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint,
|
||||
bool scheduleComposite, uint32_t paintSequenceNumber)
|
||||
returns (EditReply[] reply);
|
||||
|
||||
// Testing APIs
|
||||
@ -78,7 +79,8 @@ parent:
|
||||
|
||||
// We don't need to send a sync transaction if
|
||||
// no transaction operate require a swap.
|
||||
async UpdateNoSwap(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite);
|
||||
async UpdateNoSwap(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint,
|
||||
bool scheduleComposite, uint32_t paintSequenceNumber);
|
||||
|
||||
// Drop any front buffers that might be retained on the compositor
|
||||
// side.
|
||||
|
@ -439,6 +439,7 @@ bool
|
||||
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
const nsIntRegion& aRegionToClear,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool* aSent)
|
||||
{
|
||||
*aSent = false;
|
||||
@ -549,7 +550,8 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
if (!HasShadowManager() ||
|
||||
!mShadowManager->IPCOpen() ||
|
||||
!mShadowManager->SendUpdate(cset, targetConfig, mIsFirstPaint,
|
||||
aScheduleComposite, aReplies)) {
|
||||
aScheduleComposite, aPaintSequenceNumber,
|
||||
aReplies)) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
||||
return false;
|
||||
}
|
||||
@ -560,7 +562,8 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
RenderTraceScope rendertrace3("Forward NoSwap Transaction", "000093");
|
||||
if (!HasShadowManager() ||
|
||||
!mShadowManager->IPCOpen() ||
|
||||
!mShadowManager->SendUpdateNoSwap(cset, targetConfig, mIsFirstPaint, aScheduleComposite)) {
|
||||
!mShadowManager->SendUpdateNoSwap(cset, targetConfig, mIsFirstPaint,
|
||||
aPaintSequenceNumber, aScheduleComposite)) {
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] WARNING: sending transaction failed!"));
|
||||
return false;
|
||||
}
|
||||
|
@ -292,6 +292,7 @@ public:
|
||||
bool EndTransaction(InfallibleTArray<EditReply>* aReplies,
|
||||
const nsIntRegion& aRegionToClear,
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber,
|
||||
bool* aSent);
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,8 @@ public:
|
||||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite) = 0;
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber) = 0;
|
||||
|
||||
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) { return nullptr; }
|
||||
|
||||
|
@ -1130,9 +1130,11 @@ TEST_F(APZCTreeManagerTester, HitTesting1) {
|
||||
EXPECT_EQ(gfx3DMatrix(), transformToApzc);
|
||||
EXPECT_EQ(gfx3DMatrix(), transformToGecko);
|
||||
|
||||
uint32_t paintSequenceNumber = 0;
|
||||
|
||||
// Now we have a root APZC that will match the page
|
||||
SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID);
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0);
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 15), transformToApzc, transformToGecko);
|
||||
EXPECT_EQ(root->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
||||
// expect hit point at LayerIntPoint(15, 15)
|
||||
@ -1141,7 +1143,7 @@ TEST_F(APZCTreeManagerTester, HitTesting1) {
|
||||
|
||||
// Now we have a sub APZC with a better fit
|
||||
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 1);
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0);
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
||||
EXPECT_NE(root->AsContainerLayer()->GetAsyncPanZoomController(), layers[3]->AsContainerLayer()->GetAsyncPanZoomController());
|
||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 15), transformToApzc, transformToGecko);
|
||||
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
||||
@ -1153,7 +1155,7 @@ TEST_F(APZCTreeManagerTester, HitTesting1) {
|
||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 15), transformToApzc, transformToGecko);
|
||||
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
||||
SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 2);
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0);
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 15), transformToApzc, transformToGecko);
|
||||
EXPECT_EQ(layers[4]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
|
||||
// expect hit point at LayerIntPoint(15, 15)
|
||||
@ -1206,7 +1208,7 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
||||
SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 80, 80));
|
||||
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 0, 80, 80));
|
||||
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0);
|
||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, 0);
|
||||
|
||||
// At this point, the following holds (all coordinates in screen pixels):
|
||||
// layers[0] has content from (0,0)-(200,200), clipped by composition bounds (0,0)-(100,100)
|
||||
|
@ -811,7 +811,8 @@ void
|
||||
RenderFrameParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite)
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber)
|
||||
{
|
||||
// View map must only contain views that are associated with the current
|
||||
// shadow layer tree. We must always update the map when shadow layers
|
||||
|
@ -81,7 +81,8 @@ public:
|
||||
virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
|
||||
const TargetConfig& aTargetConfig,
|
||||
bool aIsFirstPaint,
|
||||
bool aScheduleComposite) MOZ_OVERRIDE;
|
||||
bool aScheduleComposite,
|
||||
uint32_t aPaintSequenceNumber) MOZ_OVERRIDE;
|
||||
|
||||
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
nsSubDocumentFrame* aFrame,
|
||||
|
Loading…
Reference in New Issue
Block a user