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

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

Issue 2829543003: gpu: Empty swaps for surfaceless output surfaces. (Closed)
Patch Set: fix cc_unittests 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/direct_renderer.h" 5 #include "cc/output/direct_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 DirectRenderer::~DirectRenderer() = default; 87 DirectRenderer::~DirectRenderer() = default;
88 88
89 void DirectRenderer::Initialize() { 89 void DirectRenderer::Initialize() {
90 overlay_processor_->Initialize(); 90 overlay_processor_->Initialize();
91 91
92 auto* context_provider = output_surface_->context_provider(); 92 auto* context_provider = output_surface_->context_provider();
93 93
94 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap(); 94 use_partial_swap_ = settings_->partial_swap_enabled && CanPartialSwap();
95 allow_empty_swap_ = use_partial_swap_; 95 allow_empty_swap_ = use_partial_swap_;
96 allow_partial_swap_ = use_partial_swap_;
96 if (context_provider) { 97 if (context_provider) {
97 if (context_provider->ContextCapabilities().commit_overlay_planes) 98 if (context_provider->ContextCapabilities().commit_overlay_planes)
98 allow_empty_swap_ = true; 99 allow_empty_swap_ = true;
99 if (context_provider->ContextCapabilities().dc_layers) 100 if (context_provider->ContextCapabilities().dc_layers)
100 supports_dc_layers_ = true; 101 supports_dc_layers_ = true;
102 if (context_provider->ContextCapabilities()
103 .disable_non_empty_post_sub_buffers) {
104 allow_partial_swap_ = false;
jbauman 2017/04/20 21:30:06 If you just set use_partial_swap_=false here, then
reveman 2017/04/20 22:11:40 Good idea. Done.
105 }
101 } 106 }
102 107
103 initialized_ = true; 108 initialized_ = true;
104 } 109 }
105 110
106 // static 111 // static
107 gfx::RectF DirectRenderer::QuadVertexRect() { 112 gfx::RectF DirectRenderer::QuadVertexRect() {
108 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); 113 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f);
109 } 114 }
110 115
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 current_frame()->root_damage_rect = 341 current_frame()->root_damage_rect =
337 current_frame()->root_render_pass->output_rect; 342 current_frame()->root_render_pass->output_rect;
338 } 343 }
339 344
340 // We can skip all drawing if the damage rect is now empty. 345 // We can skip all drawing if the damage rect is now empty.
341 bool skip_drawing_root_render_pass = 346 bool skip_drawing_root_render_pass =
342 current_frame()->root_damage_rect.IsEmpty() && allow_empty_swap_; 347 current_frame()->root_damage_rect.IsEmpty() && allow_empty_swap_;
343 348
344 // If we have to draw but don't support partial swap, the whole output should 349 // If we have to draw but don't support partial swap, the whole output should
345 // be considered damaged. 350 // be considered damaged.
346 if (!skip_drawing_root_render_pass && !use_partial_swap_) 351 if (!skip_drawing_root_render_pass && !allow_partial_swap_)
347 current_frame()->root_damage_rect = root_render_pass->output_rect; 352 current_frame()->root_damage_rect = root_render_pass->output_rect;
348 353
349 if (skip_drawing_root_render_pass) { 354 if (!skip_drawing_root_render_pass)
Daniele Castagna 2017/04/19 19:10:36 In the comment you removed it mentioned that calli
reveman 2017/04/19 23:59:03 Yes, that was kind of a hack. Before this we still
350 // If any of the overlays is the output surface, then ensure that the
351 // backbuffer be allocated (allocation of the backbuffer is a side-effect
352 // of BindFramebufferToOutputSurface).
353 for (auto& overlay : current_frame()->overlay_list) {
354 if (overlay.use_output_surface_for_resource) {
355 BindFramebufferToOutputSurface();
356 break;
357 }
358 }
359 } else {
360 DrawRenderPassAndExecuteCopyRequests(root_render_pass); 355 DrawRenderPassAndExecuteCopyRequests(root_render_pass);
361 }
362 356
363 FinishDrawingFrame(); 357 FinishDrawingFrame();
364 render_passes_in_draw_order->clear(); 358 render_passes_in_draw_order->clear();
365 render_pass_filters_.clear(); 359 render_pass_filters_.clear();
366 render_pass_background_filters_.clear(); 360 render_pass_background_filters_.clear();
367 361
368 current_frame_valid_ = false; 362 current_frame_valid_ = false;
369 } 363 }
370 364
371 gfx::Rect DirectRenderer::DrawingFrame::ComputeScissorRectForRenderPass() 365 gfx::Rect DirectRenderer::DrawingFrame::ComputeScissorRectForRenderPass()
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) { 657 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
664 return render_pass->output_rect.size(); 658 return render_pass->output_rect.size();
665 } 659 }
666 660
667 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { 661 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) {
668 current_frame_valid_ = true; 662 current_frame_valid_ = true;
669 current_frame_ = frame; 663 current_frame_ = frame;
670 } 664 }
671 665
672 } // namespace cc 666 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698