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

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

Issue 2776923003: cc: Partial draw without partial swap support. (Closed)
Patch Set: avoid BufferQueue::RecreateBuffer changes Created 3 years, 8 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
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2440 } 2440 }
2441 } 2441 }
2442 2442
2443 void GLRenderer::FinishDrawingFrame() { 2443 void GLRenderer::FinishDrawingFrame() {
2444 if (use_sync_query_) { 2444 if (use_sync_query_) {
2445 DCHECK(current_sync_query_); 2445 DCHECK(current_sync_query_);
2446 current_sync_query_->End(); 2446 current_sync_query_->End();
2447 pending_sync_queries_.push_back(std::move(current_sync_query_)); 2447 pending_sync_queries_.push_back(std::move(current_sync_query_));
2448 } 2448 }
2449 2449
2450 swap_buffer_rect_.Union(current_frame()->root_damage_rect); 2450 damage_rect_.Union(current_frame()->root_damage_rect);
2451 if (overdraw_feedback_) 2451 if (overdraw_feedback_)
2452 FlushOverdrawFeedback(swap_buffer_rect_); 2452 FlushOverdrawFeedback(damage_rect_);
2453 2453
2454 if (use_swap_with_bounds_) 2454 if (use_swap_with_bounds_)
2455 swap_content_bounds_ = current_frame()->root_content_bounds; 2455 swap_content_bounds_ = current_frame()->root_content_bounds;
2456 2456
2457 current_framebuffer_lock_ = nullptr; 2457 current_framebuffer_lock_ = nullptr;
2458 2458
2459 gl_->Disable(GL_BLEND); 2459 gl_->Disable(GL_BLEND);
2460 blend_shadow_ = false; 2460 blend_shadow_ = false;
2461 2461
2462 ScheduleCALayers(); 2462 ScheduleCALayers();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 DCHECK(visible_); 2610 DCHECK(visible_);
2611 2611
2612 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers"); 2612 TRACE_EVENT0("cc", "GLRenderer::SwapBuffers");
2613 // We're done! Time to swapbuffers! 2613 // We're done! Time to swapbuffers!
2614 2614
2615 gfx::Size surface_size = surface_size_for_swap_buffers(); 2615 gfx::Size surface_size = surface_size_for_swap_buffers();
2616 2616
2617 OutputSurfaceFrame output_frame; 2617 OutputSurfaceFrame output_frame;
2618 output_frame.latency_info = std::move(latency_info); 2618 output_frame.latency_info = std::move(latency_info);
2619 output_frame.size = surface_size; 2619 output_frame.size = surface_size;
2620 output_frame.damage_rect = damage_rect_;
2620 if (use_swap_with_bounds_) { 2621 if (use_swap_with_bounds_) {
2621 output_frame.content_bounds = std::move(swap_content_bounds_); 2622 output_frame.content_bounds = std::move(swap_content_bounds_);
2622 } else if (use_partial_swap_) { 2623 } else if (use_partial_swap_) {
2623 // If supported, we can save significant bandwidth by only swapping the 2624 // If supported, we can save significant bandwidth by only swapping the
2624 // damaged/scissored region (clamped to the viewport). 2625 // damaged/scissored region (clamped to the viewport).
2625 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); 2626 gfx::Rect swap_buffer_rect = damage_rect_;
2627 swap_buffer_rect.Intersect(gfx::Rect(surface_size));
2626 int flipped_y_pos_of_rect_bottom = surface_size.height() - 2628 int flipped_y_pos_of_rect_bottom = surface_size.height() -
2627 swap_buffer_rect_.y() - 2629 swap_buffer_rect.y() -
2628 swap_buffer_rect_.height(); 2630 swap_buffer_rect.height();
2629 output_frame.sub_buffer_rect = 2631 output_frame.sub_buffer_rect =
2630 gfx::Rect(swap_buffer_rect_.x(), 2632 gfx::Rect(swap_buffer_rect.x(),
2631 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom 2633 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom
2632 : swap_buffer_rect_.y(), 2634 : swap_buffer_rect.y(),
2633 swap_buffer_rect_.width(), swap_buffer_rect_.height()); 2635 swap_buffer_rect.width(), swap_buffer_rect.height());
2634 } else if (swap_buffer_rect_.IsEmpty() && allow_empty_swap_) { 2636 } else if (damage_rect_.IsEmpty() && allow_empty_swap_) {
2635 output_frame.sub_buffer_rect = swap_buffer_rect_; 2637 output_frame.sub_buffer_rect = gfx::Rect();
2636 } 2638 }
2637 2639
2638 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_)); 2640 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_));
2639 pending_overlay_resources_.clear(); 2641 pending_overlay_resources_.clear();
2640 2642
2641 output_surface_->SwapBuffers(std::move(output_frame)); 2643 output_surface_->SwapBuffers(std::move(output_frame));
2642 2644
2643 swap_buffer_rect_ = gfx::Rect(); 2645 damage_rect_ = gfx::Rect();
2644 } 2646 }
2645 2647
2646 void GLRenderer::SwapBuffersComplete() { 2648 void GLRenderer::SwapBuffersComplete() {
2647 if (settings_->release_overlay_resources_after_gpu_query) { 2649 if (settings_->release_overlay_resources_after_gpu_query) {
2648 // Once a resource has been swap-ACKed, send a query to the GPU process to 2650 // Once a resource has been swap-ACKed, send a query to the GPU process to
2649 // ask if the resource is no longer being consumed by the system compositor. 2651 // ask if the resource is no longer being consumed by the system compositor.
2650 // The response will come with the next swap-ACK. 2652 // The response will come with the next swap-ACK.
2651 if (!swapping_overlay_resources_.empty()) { 2653 if (!swapping_overlay_resources_.empty()) {
2652 for (OverlayResourceLock& lock : swapping_overlay_resources_.front()) { 2654 for (OverlayResourceLock& lock : swapping_overlay_resources_.front()) {
2653 unsigned texture = lock->texture_id(); 2655 unsigned texture = lock->texture_id();
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
3596 return; 3598 return;
3597 3599
3598 // Report GPU overdraw as a percentage of |max_result|. 3600 // Report GPU overdraw as a percentage of |max_result|.
3599 TRACE_COUNTER1( 3601 TRACE_COUNTER1(
3600 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3602 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3601 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / 3603 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) /
3602 max_result); 3604 max_result);
3603 } 3605 }
3604 3606
3605 } // namespace cc 3607 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698