Bug 1457466 - Make the GenerateFrame transaction bypass the scene builder thread. r=nical

This allows frames to be generated by the render backend thread even
while the scene builder thread is busy with a long scene build. The
GenerateFrame transaction also contains APZ and OMTA information, so
this allows the user to scroll and view OMTAnimations during long scene
builds.

MozReview-Commit-ID: KG5YC2KwIaH

--HG--
extra : rebase_source : 3ba559aa22a3a036a3b3a034ea20caacdc8c864a
This commit is contained in:
Kartikaya Gupta 2018-05-11 09:09:19 -04:00
Родитель d3693ff0d7
Коммит 2b4b8a09ab
3 изменённых файлов: 19 добавлений и 11 удалений

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

@ -1296,14 +1296,17 @@ WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::In
mAsyncImageManager->SetCompositionTime(TimeStamp::Now());
// TODO: We can improve upon this by using two transactions: one for everything that
// doesn't change the display list (in other words does not cause the scene to be
// re-built), and one for the rest. This way, if an async pipeline needs to re-build
// its display list, other async pipelines can still be rendered while the scene is
// building.
wr::TransactionBuilder txn;
mAsyncImageManager->ApplyAsyncImages(txn);
mApi->SendTransaction(txn);
{
// TODO: We can improve upon this by using two transactions: one for everything that
// doesn't change the display list (in other words does not cause the scene to be
// re-built), and one for the rest. This way, if an async pipeline needs to re-build
// its display list, other async pipelines can still be rendered while the scene is
// building. Those other async pipelines can go in the other transaction that
// we create below.
wr::TransactionBuilder txn;
mAsyncImageManager->ApplyAsyncImages(txn);
mApi->SendTransaction(txn);
}
if (!mAsyncImageManager->GetCompositeUntilTime().IsNull()) {
// Trigger another CompositeToTarget() call because there might be another
@ -1319,6 +1322,11 @@ WebRenderBridgeParent::CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::In
return;
}
// Ensure this GenerateFrame is handled on the render backend thread rather
// than going through the scene builder thread. That way we continue generating
// frames with the old scene even during slow scene builds.
wr::TransactionBuilder txn(/* aUseSceneBuilderThread */ false);
nsTArray<wr::WrOpacityProperty> opacityArray;
nsTArray<wr::WrTransformProperty> transformArray;

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

@ -133,8 +133,8 @@ private:
};
TransactionBuilder::TransactionBuilder()
: mUseSceneBuilderThread(gfxPrefs::WebRenderAsyncSceneBuild())
TransactionBuilder::TransactionBuilder(bool aUseSceneBuilderThread)
: mUseSceneBuilderThread(gfxPrefs::WebRenderAsyncSceneBuild() && aUseSceneBuilderThread)
{
mTxn = wr_transaction_new(mUseSceneBuilderThread);
mResourceUpdates = wr_resource_updates_new();

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

@ -51,7 +51,7 @@ struct Line {
class TransactionBuilder {
public:
TransactionBuilder();
explicit TransactionBuilder(bool aUseSceneBuilderThread = true);
~TransactionBuilder();