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

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

Issue 2693023002: Use SwapBuffersWithBounds on Chromecast (Closed)
Patch Set: Created 3 years, 10 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 const auto& context_caps = 394 const auto& context_caps =
395 output_surface_->context_provider()->ContextCapabilities(); 395 output_surface_->context_provider()->ContextCapabilities();
396 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); 396 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle);
397 397
398 use_discard_framebuffer_ = context_caps.discard_framebuffer; 398 use_discard_framebuffer_ = context_caps.discard_framebuffer;
399 use_sync_query_ = context_caps.sync_query; 399 use_sync_query_ = context_caps.sync_query;
400 use_blend_equation_advanced_ = context_caps.blend_equation_advanced; 400 use_blend_equation_advanced_ = context_caps.blend_equation_advanced;
401 use_blend_equation_advanced_coherent_ = 401 use_blend_equation_advanced_coherent_ =
402 context_caps.blend_equation_advanced_coherent; 402 context_caps.blend_equation_advanced_coherent;
403 use_occlusion_query_ = context_caps.occlusion_query; 403 use_occlusion_query_ = context_caps.occlusion_query;
404 use_swap_with_bounds_ = context_caps.swap_buffers_with_bounds;
404 405
405 InitializeSharedObjects(); 406 InitializeSharedObjects();
406 } 407 }
407 408
408 GLRenderer::~GLRenderer() { 409 GLRenderer::~GLRenderer() {
409 CleanupSharedObjects(); 410 CleanupSharedObjects();
410 411
411 if (context_visibility_) { 412 if (context_visibility_) {
412 auto* context_provider = output_surface_->context_provider(); 413 auto* context_provider = output_surface_->context_provider();
413 auto* cache_controller = context_provider->CacheController(); 414 auto* cache_controller = context_provider->CacheController();
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 swap_buffer_rect_.width(), swap_buffer_rect_.height()); 2647 swap_buffer_rect_.width(), swap_buffer_rect_.height());
2647 } else { 2648 } else {
2648 // Expand the swap rect to the full surface unless it's empty, and empty 2649 // Expand the swap rect to the full surface unless it's empty, and empty
2649 // swap is allowed. 2650 // swap is allowed.
2650 if (!swap_buffer_rect_.IsEmpty() || !allow_empty_swap_) { 2651 if (!swap_buffer_rect_.IsEmpty() || !allow_empty_swap_) {
2651 swap_buffer_rect_ = gfx::Rect(surface_size); 2652 swap_buffer_rect_ = gfx::Rect(surface_size);
2652 } 2653 }
2653 output_frame.sub_buffer_rect = swap_buffer_rect_; 2654 output_frame.sub_buffer_rect = swap_buffer_rect_;
2654 } 2655 }
2655 2656
2657 if (use_swap_with_bounds_) {
2658 overlay_processor_->GetContentBounds(&output_frame.content_bounds);
2659 }
2660
2656 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_)); 2661 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_));
2657 pending_overlay_resources_.clear(); 2662 pending_overlay_resources_.clear();
2658 2663
2659 output_surface_->SwapBuffers(std::move(output_frame)); 2664 output_surface_->SwapBuffers(std::move(output_frame));
2660 2665
2661 swap_buffer_rect_ = gfx::Rect(); 2666 swap_buffer_rect_ = gfx::Rect();
2662 } 2667 }
2663 2668
2664 void GLRenderer::SwapBuffersComplete() { 2669 void GLRenderer::SwapBuffersComplete() {
2665 if (settings_->release_overlay_resources_after_gpu_query) { 2670 if (settings_->release_overlay_resources_after_gpu_query) {
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
3526 return; 3531 return;
3527 3532
3528 // Report GPU overdraw as a percentage of |max_result|. 3533 // Report GPU overdraw as a percentage of |max_result|.
3529 TRACE_COUNTER1( 3534 TRACE_COUNTER1(
3530 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3535 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3531 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / 3536 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) /
3532 max_result); 3537 max_result);
3533 } 3538 }
3534 3539
3535 } // namespace cc 3540 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698