Bug 1481995 - Remove WebRenderBridgeParent::mForceRendering r=nical

This commit is contained in:
sotaro 2018-08-10 08:10:11 +09:00
parent e1682c9e96
commit bf2bee5c8e
4 changed files with 28 additions and 9 deletions

View File

@ -348,5 +348,12 @@ CompositorVsyncScheduler::GetLastComposeTime() const
return mLastCompose; return mLastCompose;
} }
void
CompositorVsyncScheduler::UpdateLastComposeTime()
{
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
mLastCompose = TimeStamp::Now();
}
} // namespace layers } // namespace layers
} // namespace mozilla } // namespace mozilla

View File

@ -93,6 +93,12 @@ public:
*/ */
const TimeStamp& GetLastComposeTime() const; const TimeStamp& GetLastComposeTime() const;
/**
* Update LastCompose TimeStamp to current timestamp.
* The function is typically used when composition is handled outside the CompositorVsyncScheduler.
*/
void UpdateLastComposeTime();
private: private:
virtual ~CompositorVsyncScheduler(); virtual ~CompositorVsyncScheduler();

View File

@ -200,7 +200,6 @@ WebRenderBridgeParent::WebRenderBridgeParent(CompositorBridgeParentBase* aCompos
, mIdNamespace(aApi->GetNamespace()) , mIdNamespace(aApi->GetNamespace())
, mPaused(false) , mPaused(false)
, mDestroyed(false) , mDestroyed(false)
, mForceRendering(false)
, mReceivedDisplayList(false) , mReceivedDisplayList(false)
{ {
MOZ_ASSERT(mAsyncImageManager); MOZ_ASSERT(mAsyncImageManager);
@ -221,7 +220,6 @@ WebRenderBridgeParent::WebRenderBridgeParent(const wr::PipelineId& aPipelineId)
, mIdNamespace{0} , mIdNamespace{0}
, mPaused(false) , mPaused(false)
, mDestroyed(true) , mDestroyed(true)
, mForceRendering(false)
, mReceivedDisplayList(false) , mReceivedDisplayList(false)
{ {
} }
@ -1041,9 +1039,12 @@ WebRenderBridgeParent::FlushFrameGeneration()
// This forces a new GenerateFrame transaction to be sent to the render // This forces a new GenerateFrame transaction to be sent to the render
// backend thread, if one is pending. This doesn't block on any other threads. // backend thread, if one is pending. This doesn't block on any other threads.
mForceRendering = true; if (mCompositorScheduler->NeedsComposite()) {
mCompositorScheduler->FlushPendingComposite(); mCompositorScheduler->CancelCurrentCompositeTask();
mForceRendering = false; // Update timestamp of scheduler for APZ and animation.
mCompositorScheduler->UpdateLastComposeTime();
MaybeGenerateFrame(/* aForceGenerateFrame */ true);
}
} }
void void
@ -1497,14 +1498,18 @@ WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::In
return; return;
} }
if (!mForceRendering && if (wr::RenderThread::Get()->TooManyPendingFrames(mApi->GetId())) {
wr::RenderThread::Get()->TooManyPendingFrames(mApi->GetId())) {
// Render thread is busy, try next time. // Render thread is busy, try next time.
mCompositorScheduler->ScheduleComposition(); mCompositorScheduler->ScheduleComposition();
mPreviousFrameTimeStamp = TimeStamp(); mPreviousFrameTimeStamp = TimeStamp();
return; return;
} }
MaybeGenerateFrame(/* aForceGenerateFrame */ false);
}
void
WebRenderBridgeParent::MaybeGenerateFrame(bool aForceGenerateFrame)
{
TimeStamp start = TimeStamp::Now(); TimeStamp start = TimeStamp::Now();
mAsyncImageManager->SetCompositionTime(start); mAsyncImageManager->SetCompositionTime(start);
@ -1531,7 +1536,7 @@ WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::In
if (!mAsyncImageManager->GetAndResetWillGenerateFrame() && if (!mAsyncImageManager->GetAndResetWillGenerateFrame() &&
fastTxn.IsEmpty() && fastTxn.IsEmpty() &&
!mForceRendering) { !aForceGenerateFrame) {
// Could skip generating frame now. // Could skip generating frame now.
mPreviousFrameTimeStamp = TimeStamp(); mPreviousFrameTimeStamp = TimeStamp();
return; return;

View File

@ -252,6 +252,8 @@ private:
void FlushFrameGeneration(); void FlushFrameGeneration();
void FlushFramePresentation(); void FlushFramePresentation();
void MaybeGenerateFrame(bool aForceGenerateFrame);
private: private:
struct PendingTransactionId { struct PendingTransactionId {
PendingTransactionId(const wr::Epoch& aEpoch, PendingTransactionId(const wr::Epoch& aEpoch,
@ -313,7 +315,6 @@ private:
bool mPaused; bool mPaused;
bool mDestroyed; bool mDestroyed;
bool mForceRendering;
bool mReceivedDisplayList; bool mReceivedDisplayList;
}; };