forked from mirrors/gecko-dev
Bug 1860203 - Add timeout check to WebRenderAPI::CheckIsRemoteTextureReady() r=gfx-reviewers,lsalzman
From Bug 1858047, it seems better to add timeout check to WebRenderAPI::CheckIsRemoteTextureReady(). Differential Revision: https://phabricator.services.mozilla.com/D191507
This commit is contained in:
parent
53b2e98767
commit
f007a1547f
2 changed files with 24 additions and 4 deletions
|
|
@ -481,7 +481,7 @@ layers::RemoteTextureInfoList* WebRenderAPI::GetPendingRemoteTextureInfoList() {
|
|||
}
|
||||
|
||||
bool WebRenderAPI::CheckIsRemoteTextureReady(
|
||||
layers::RemoteTextureInfoList* aList) {
|
||||
layers::RemoteTextureInfoList* aList, const TimeStamp& aTimeStamp) {
|
||||
MOZ_ASSERT(layers::CompositorThreadHolder::IsInCompositorThread());
|
||||
MOZ_ASSERT(aList);
|
||||
MOZ_ASSERT(gfx::gfxVars::UseCanvasRenderThread());
|
||||
|
|
@ -497,11 +497,25 @@ bool WebRenderAPI::CheckIsRemoteTextureReady(
|
|||
layers::CompositorThread()->Dispatch(runnable.forget());
|
||||
};
|
||||
|
||||
const auto maxWaitDurationMs = 10000;
|
||||
const auto now = TimeStamp::Now();
|
||||
const auto waitDurationMs =
|
||||
static_cast<uint32_t>((now - aTimeStamp).ToMilliseconds());
|
||||
|
||||
const auto isTimeout = waitDurationMs > maxWaitDurationMs;
|
||||
if (isTimeout) {
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
|
||||
gfxCriticalNote << "RemoteTexture ready timeout";
|
||||
}
|
||||
|
||||
bool isReady = true;
|
||||
while (!aList->mList.empty() && isReady) {
|
||||
auto& front = aList->mList.front();
|
||||
isReady &= layers::RemoteTextureMap::Get()->CheckRemoteTextureReady(
|
||||
front, callback);
|
||||
if (isTimeout) {
|
||||
isReady = true;
|
||||
}
|
||||
if (isReady) {
|
||||
aList->mList.pop();
|
||||
}
|
||||
|
|
@ -546,7 +560,8 @@ void WebRenderAPI::HandleWrTransactionEvents(RemoteTextureWaitType aType) {
|
|||
case WrTransactionEvent::Tag::PendingRemoteTextures:
|
||||
bool isReady = true;
|
||||
if (aType == RemoteTextureWaitType::AsyncWait) {
|
||||
isReady = CheckIsRemoteTextureReady(front.RemoteTextureInfoList());
|
||||
isReady = CheckIsRemoteTextureReady(front.RemoteTextureInfoList(),
|
||||
front.mTimeStamp);
|
||||
} else if (aType == RemoteTextureWaitType::FlushWithWait) {
|
||||
WaitRemoteTextureReady(front.RemoteTextureInfoList());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -323,7 +323,8 @@ class WebRenderAPI final {
|
|||
void WaitFlushed();
|
||||
|
||||
void UpdateDebugFlags(uint32_t aFlags);
|
||||
bool CheckIsRemoteTextureReady(layers::RemoteTextureInfoList* aList);
|
||||
bool CheckIsRemoteTextureReady(layers::RemoteTextureInfoList* aList,
|
||||
const TimeStamp& aTimeStamp);
|
||||
void WaitRemoteTextureReady(layers::RemoteTextureInfoList* aList);
|
||||
|
||||
enum class RemoteTextureWaitType : uint8_t {
|
||||
|
|
@ -341,6 +342,7 @@ class WebRenderAPI final {
|
|||
PendingRemoteTextures,
|
||||
};
|
||||
const Tag mTag;
|
||||
const TimeStamp mTimeStamp;
|
||||
|
||||
struct TransactionWrapper {
|
||||
TransactionWrapper(wr::Transaction* aTxn, bool aUseSceneBuilderThread)
|
||||
|
|
@ -359,13 +361,16 @@ class WebRenderAPI final {
|
|||
private:
|
||||
WrTransactionEvent(const Tag aTag,
|
||||
UniquePtr<TransactionWrapper>&& aTransaction)
|
||||
: mTag(aTag), mTransaction(std::move(aTransaction)) {
|
||||
: mTag(aTag),
|
||||
mTimeStamp(TimeStamp::Now()),
|
||||
mTransaction(std::move(aTransaction)) {
|
||||
MOZ_ASSERT(mTag == Tag::Transaction);
|
||||
}
|
||||
WrTransactionEvent(
|
||||
const Tag aTag,
|
||||
UniquePtr<layers::RemoteTextureInfoList>&& aPendingRemoteTextures)
|
||||
: mTag(aTag),
|
||||
mTimeStamp(TimeStamp::Now()),
|
||||
mPendingRemoteTextures(std::move(aPendingRemoteTextures)) {
|
||||
MOZ_ASSERT(mTag == Tag::PendingRemoteTextures);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue