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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 411643002: Early wait on texture resource sync points in gl_renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move WaitOnResourceSyncPoints to gl_renderer. Add mailbox test for gl_renderer. Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 always_clear = true; 451 always_clear = true;
452 #endif 452 #endif
453 if (always_clear || frame->current_render_pass->has_transparent_background) { 453 if (always_clear || frame->current_render_pass->has_transparent_background) {
454 GLbitfield clear_bits = GL_COLOR_BUFFER_BIT; 454 GLbitfield clear_bits = GL_COLOR_BUFFER_BIT;
455 if (always_clear) 455 if (always_clear)
456 clear_bits |= GL_STENCIL_BUFFER_BIT; 456 clear_bits |= GL_STENCIL_BUFFER_BIT;
457 gl_->Clear(clear_bits); 457 gl_->Clear(clear_bits);
458 } 458 }
459 } 459 }
460 460
461 static ResourceProvider::ResourceId WaitOnResourceSyncPoints(
462 ResourceProvider* resource_provider,
463 ResourceProvider::ResourceId resource_id) {
464 resource_provider->WaitSyncPointIfNeeded(resource_id);
465 return resource_id;
466 }
467
461 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { 468 void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) {
462 if (frame->device_viewport_rect.IsEmpty()) 469 if (frame->device_viewport_rect.IsEmpty())
463 return; 470 return;
464 471
465 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame"); 472 TRACE_EVENT0("cc", "GLRenderer::BeginDrawingFrame");
466 473
467 scoped_refptr<ResourceProvider::Fence> read_lock_fence; 474 scoped_refptr<ResourceProvider::Fence> read_lock_fence;
468 if (use_sync_query_) { 475 if (use_sync_query_) {
469 // Block until oldest sync query has passed if the number of pending queries 476 // Block until oldest sync query has passed if the number of pending queries
470 // ever reach kMaxPendingSyncQueries. 477 // ever reach kMaxPendingSyncQueries.
(...skipping 14 matching lines...) Expand all
485 current_sync_query_ = available_sync_queries_.empty() 492 current_sync_query_ = available_sync_queries_.empty()
486 ? make_scoped_ptr(new SyncQuery(gl_)) 493 ? make_scoped_ptr(new SyncQuery(gl_))
487 : available_sync_queries_.take_front(); 494 : available_sync_queries_.take_front();
488 495
489 read_lock_fence = current_sync_query_->Begin(); 496 read_lock_fence = current_sync_query_->Begin();
490 } else { 497 } else {
491 read_lock_fence = make_scoped_refptr(new FallbackFence(gl_)); 498 read_lock_fence = make_scoped_refptr(new FallbackFence(gl_));
492 } 499 }
493 resource_provider_->SetReadLockFence(read_lock_fence.get()); 500 resource_provider_->SetReadLockFence(read_lock_fence.get());
494 501
502 // Insert WaitSyncPointCHROMIUM on quad resources prior to drawing the frame,
503 // so that drawing can proceed without GL context switching interruptions.
504 DrawQuad::ResourceIteratorCallback wait_on_resource_syncpoints_callback =
505 base::Bind(&WaitOnResourceSyncPoints, resource_provider_);
506
507 for (size_t i = 0; i < frame->render_passes_in_draw_order->size(); ++i) {
508 RenderPass* pass = frame->render_passes_in_draw_order->at(i);
509 for (size_t j = 0; j < pass->quad_list.size(); ++j) {
510 DrawQuad* quad = pass->quad_list[j];
511 quad->IterateResources(wait_on_resource_syncpoints_callback);
512 }
513 }
514
495 // TODO(enne): Do we need to reinitialize all of this state per frame? 515 // TODO(enne): Do we need to reinitialize all of this state per frame?
496 ReinitializeGLState(); 516 ReinitializeGLState();
497 } 517 }
498 518
499 void GLRenderer::DoNoOp() { 519 void GLRenderer::DoNoOp() {
500 GLC(gl_, gl_->BindFramebuffer(GL_FRAMEBUFFER, 0)); 520 GLC(gl_, gl_->BindFramebuffer(GL_FRAMEBUFFER, 0));
501 GLC(gl_, gl_->Flush()); 521 GLC(gl_, gl_->Flush());
502 } 522 }
503 523
504 void GLRenderer::DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) { 524 void GLRenderer::DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) {
(...skipping 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after
3197 context_support_->ScheduleOverlayPlane( 3217 context_support_->ScheduleOverlayPlane(
3198 overlay.plane_z_order, 3218 overlay.plane_z_order,
3199 overlay.transform, 3219 overlay.transform,
3200 pending_overlay_resources_.back()->texture_id(), 3220 pending_overlay_resources_.back()->texture_id(),
3201 overlay.display_rect, 3221 overlay.display_rect,
3202 overlay.uv_rect); 3222 overlay.uv_rect);
3203 } 3223 }
3204 } 3224 }
3205 3225
3206 } // namespace cc 3226 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698