Commit 2999ad4e by Geoff Lang Committed by Commit Bot

Flush less frequently in QueryGL.

StandardQueryGL flushes with every pause/resume/end operation to make sure the list of pending queries does not grow too large. This ended up trying to flush the queries as soon as they were ended and unlikely to have results ready. Add a threshold of pending queries before flushing, hopefully delaying the flush calls until the queries are ready. This is a speculative fix for a GPU hang in query flushing. Bug: chromium:1078754 Change-Id: I38300995ee6576dee8c8c26fa9ccad26e269337a Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2401178Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent ef315fdc
......@@ -44,6 +44,9 @@ GLuint64 MergeQueryResults(gl::QueryType type, GLuint64 currentResult, GLuint64
}
}
// Some drivers tend to hang when flushing pending queries. Wait until this number of queries have
// added up before checking if results are ready.
constexpr uint32_t kPauseResumeFlushThreshold = 5;
} // anonymous namespace
namespace rx
......@@ -159,7 +162,12 @@ angle::Result StandardQueryGL::pause(const gl::Context *context)
}
// Flush to make sure the pending queries don't add up too much.
return flush(context, false);
if (mPendingQueries.size() >= kPauseResumeFlushThreshold)
{
ANGLE_TRY(flush(context, false));
}
return angle::Result::Continue;
}
angle::Result StandardQueryGL::resume(const gl::Context *context)
......@@ -167,7 +175,11 @@ angle::Result StandardQueryGL::resume(const gl::Context *context)
if (mActiveQuery == 0)
{
// Flush to make sure the pending queries don't add up too much.
ANGLE_TRY(flush(context, false));
if (mPendingQueries.size() >= kPauseResumeFlushThreshold)
{
ANGLE_TRY(flush(context, false));
}
mFunctions->genQueries(1, &mActiveQuery);
mStateManager->beginQuery(mType, this, mActiveQuery);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment