Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1201)

Unified Diff: cc/output/gl_renderer.cc

Issue 280543003: Re-land: cc: Fail more visibly when sync queries are not working correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: signed/unsigned compare fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 8e60f944d4f6f23cf033f15f2f7c619473fe99cf..df3ddfd3b9e865906172309006e8e45d91ded448 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698