Bug 1863257 - Remove sync wait in compositor thread of main thread canvas by RemoteTextureMap::WaitForRemoteTextureOwner() r=gfx-reviewers,lsalzman
Calling RemoteTextureTxnScheduler::NotifyTxn() of main thread canvas is deferred to WebRenderAPI for waiting RemoteTextureOwner at WebRenderAPI. When RemoteTextureOwner is not registered yet, WaitingTextureOwner is used to register the callback. WaitingTextureOwner is removed in RemoteTextureMap::SuppressRemoteTextureReadyCheck() when it still exists. Removing sync wait of off main thread canvas is going to be handled by another bug. Differential Revision: https://phabricator.services.mozilla.com/D209647
This commit is contained in:
@@ -213,18 +213,26 @@ class RemoveRenderer : public RendererEvent {
|
||||
layers::SynchronousTask* mTask;
|
||||
};
|
||||
|
||||
TransactionBuilder::TransactionBuilder(WebRenderAPI* aApi,
|
||||
bool aUseSceneBuilderThread)
|
||||
: mUseSceneBuilderThread(aUseSceneBuilderThread),
|
||||
TransactionBuilder::TransactionBuilder(
|
||||
WebRenderAPI* aApi, bool aUseSceneBuilderThread,
|
||||
layers::RemoteTextureTxnScheduler* aRemoteTextureTxnScheduler,
|
||||
layers::RemoteTextureTxnId aRemoteTextureTxnId)
|
||||
: mRemoteTextureTxnScheduler(aRemoteTextureTxnScheduler),
|
||||
mRemoteTextureTxnId(aRemoteTextureTxnId),
|
||||
mUseSceneBuilderThread(aUseSceneBuilderThread),
|
||||
mApiBackend(aApi->GetBackendType()),
|
||||
mOwnsData(true) {
|
||||
mTxn = wr_transaction_new(mUseSceneBuilderThread);
|
||||
}
|
||||
|
||||
TransactionBuilder::TransactionBuilder(WebRenderAPI* aApi, Transaction* aTxn,
|
||||
bool aUseSceneBuilderThread,
|
||||
bool aOwnsData)
|
||||
: mTxn(aTxn),
|
||||
TransactionBuilder::TransactionBuilder(
|
||||
WebRenderAPI* aApi, Transaction* aTxn, bool aUseSceneBuilderThread,
|
||||
bool aOwnsData,
|
||||
layers::RemoteTextureTxnScheduler* aRemoteTextureTxnScheduler,
|
||||
layers::RemoteTextureTxnId aRemoteTextureTxnId)
|
||||
: mRemoteTextureTxnScheduler(aRemoteTextureTxnScheduler),
|
||||
mRemoteTextureTxnId(aRemoteTextureTxnId),
|
||||
mTxn(aTxn),
|
||||
mUseSceneBuilderThread(aUseSceneBuilderThread),
|
||||
mApiBackend(aApi->GetBackendType()),
|
||||
mOwnsData(aOwnsData) {}
|
||||
@@ -473,17 +481,19 @@ void WebRenderAPI::SendTransaction(TransactionBuilder& aTxn) {
|
||||
!mPendingAsyncImagePipelineOps->mList.empty()) {
|
||||
mPendingWrTransactionEvents.emplace(
|
||||
WrTransactionEvent::PendingAsyncImagePipelineOps(
|
||||
std::move(mPendingAsyncImagePipelineOps), this, aTxn.Raw(),
|
||||
aTxn.UseSceneBuilderThread()));
|
||||
std::move(mPendingAsyncImagePipelineOps), this, aTxn));
|
||||
}
|
||||
|
||||
if (!mPendingWrTransactionEvents.empty()) {
|
||||
mPendingWrTransactionEvents.emplace(WrTransactionEvent::Transaction(
|
||||
this, aTxn.Take(), aTxn.UseSceneBuilderThread()));
|
||||
mPendingWrTransactionEvents.emplace(
|
||||
WrTransactionEvent::Transaction(this, aTxn));
|
||||
HandleWrTransactionEvents(RemoteTextureWaitType::AsyncWait);
|
||||
} else {
|
||||
wr_api_send_transaction(mDocHandle, aTxn.Raw(),
|
||||
aTxn.UseSceneBuilderThread());
|
||||
if (aTxn.mRemoteTextureTxnScheduler) {
|
||||
aTxn.mRemoteTextureTxnScheduler->NotifyTxn(aTxn.mRemoteTextureTxnId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,6 +608,10 @@ void WebRenderAPI::HandleWrTransactionEvents(RemoteTextureWaitType aType) {
|
||||
case WrTransactionEvent::Tag::Transaction:
|
||||
wr_api_send_transaction(mDocHandle, front.RawTransaction(),
|
||||
front.UseSceneBuilderThread());
|
||||
if (front.GetTransactionBuilder()->mRemoteTextureTxnScheduler) {
|
||||
front.GetTransactionBuilder()->mRemoteTextureTxnScheduler->NotifyTxn(
|
||||
front.GetTransactionBuilder()->mRemoteTextureTxnId);
|
||||
}
|
||||
break;
|
||||
case WrTransactionEvent::Tag::PendingRemoteTextures: {
|
||||
bool isReady = true;
|
||||
@@ -612,7 +626,7 @@ void WebRenderAPI::HandleWrTransactionEvents(RemoteTextureWaitType aType) {
|
||||
while (!list->mList.empty()) {
|
||||
auto& front = list->mList.front();
|
||||
layers::RemoteTextureMap::Get()->SuppressRemoteTextureReadyCheck(
|
||||
front.mTextureId, front.mForPid);
|
||||
front);
|
||||
list->mList.pop();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user