Commit 73f411ce authored by reveman@chromium.org's avatar reveman@chromium.org

Re-land: cc: Fail more visibly when sync queries are not working correctly.

Instead of creating an infinite number of sync queries, which will
eventually cause performance issues, log an error message and block
until oldest query has passed when reaching 16 pending queries.

BUG=371530,373360

Review URL: https://codereview.chromium.org/280543003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272565 0039d316-1c4b-4281-b951-d872f2087c98
parent 81140c8c
...@@ -175,6 +175,10 @@ SamplerType SamplerTypeFromTextureTarget(GLenum target) { ...@@ -175,6 +175,10 @@ SamplerType SamplerTypeFromTextureTarget(GLenum target) {
// determine when anti-aliasing is unnecessary. // determine when anti-aliasing is unnecessary.
const float kAntiAliasingEpsilon = 1.0f / 1024.0f; const float kAntiAliasingEpsilon = 1.0f / 1024.0f;
// Block or crash if the number of pending sync queries reach this high as
// something is seriously wrong on the service side if this happens.
const size_t kMaxPendingSyncQueries = 16;
} // anonymous namespace } // anonymous namespace
class GLRenderer::ScopedUseGrContext { class GLRenderer::ScopedUseGrContext {
...@@ -248,6 +252,11 @@ class GLRenderer::SyncQuery { ...@@ -248,6 +252,11 @@ class GLRenderer::SyncQuery {
return !available; return !available;
} }
void Wait() {
unsigned result = 0;
gl_->GetQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &result);
}
private: private:
class Fence : public ResourceProvider::Fence { class Fence : public ResourceProvider::Fence {
public: public:
...@@ -441,6 +450,15 @@ void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { ...@@ -441,6 +450,15 @@ void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) {
scoped_refptr<ResourceProvider::Fence> read_lock_fence; scoped_refptr<ResourceProvider::Fence> read_lock_fence;
if (use_sync_query_) { if (use_sync_query_) {
// Block until oldest sync query has passed if the number of pending queries
// ever reach kMaxPendingSyncQueries.
if (pending_sync_queries_.size() >= kMaxPendingSyncQueries) {
LOG(ERROR) << "Reached limit of pending sync queries.";
pending_sync_queries_.front()->Wait();
DCHECK(!pending_sync_queries_.front()->IsPending());
}
while (!pending_sync_queries_.empty()) { while (!pending_sync_queries_.empty()) {
if (pending_sync_queries_.front()->IsPending()) if (pending_sync_queries_.front()->IsPending())
break; break;
......
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