summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-14 00:26:41 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-14 00:26:41 +0000
commit2fb7a1437a51535645a551d195e4d1ddfd79d7ac (patch)
tree3cf1635112140aa5ba1dc7bcea16f80879ed23b9 /cc
parent732ba2ccaeec188901634502b6fe8982c1e99076 (diff)
downloadchromium_src-2fb7a1437a51535645a551d195e4d1ddfd79d7ac.zip
chromium_src-2fb7a1437a51535645a551d195e4d1ddfd79d7ac.tar.gz
chromium_src-2fb7a1437a51535645a551d195e4d1ddfd79d7ac.tar.bz2
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 Review URL: https://codereview.chromium.org/280543003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270265 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/output/gl_renderer.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 8e60f94..df3ddfd 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -175,6 +175,10 @@ SamplerType SamplerTypeFromTextureTarget(GLenum target) {
// determine when anti-aliasing is unnecessary.
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
class GLRenderer::ScopedUseGrContext {
@@ -248,6 +252,11 @@ class GLRenderer::SyncQuery {
return !available;
}
+ void Wait() {
+ unsigned result = 0;
+ gl_->GetQueryObjectuivEXT(query_id_, GL_QUERY_RESULT_EXT, &result);
+ }
+
private:
class Fence : public ResourceProvider::Fence {
public:
@@ -441,6 +450,15 @@ void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) {
scoped_refptr<ResourceProvider::Fence> read_lock_fence;
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()) {
if (pending_sync_queries_.front()->IsPending())
break;