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

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

Issue 2829543003: gpu: Empty swaps for surfaceless output surfaces. (Closed)
Patch Set: new workaround 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 | « no previous file | cc/output/overlay_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 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (context_provider) { 96 if (context_provider) {
97 if (context_provider->ContextCapabilities().commit_overlay_planes) 97 if (context_provider->ContextCapabilities().commit_overlay_planes)
98 allow_empty_swap_ = true; 98 allow_empty_swap_ = true;
99 if (context_provider->ContextCapabilities().dc_layers) 99 if (context_provider->ContextCapabilities().dc_layers)
100 supports_dc_layers_ = true; 100 supports_dc_layers_ = true;
101 if (context_provider->ContextCapabilities()
102 .disable_non_empty_post_sub_buffers) {
103 use_partial_swap_ = false;
104 }
101 } 105 }
102 106
103 initialized_ = true; 107 initialized_ = true;
104 } 108 }
105 109
106 // static 110 // static
107 gfx::RectF DirectRenderer::QuadVertexRect() { 111 gfx::RectF DirectRenderer::QuadVertexRect() {
108 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f); 112 return gfx::RectF(-0.5f, -0.5f, 1.f, 1.f);
109 } 113 }
110 114
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 343
340 // We can skip all drawing if the damage rect is now empty. 344 // We can skip all drawing if the damage rect is now empty.
341 bool skip_drawing_root_render_pass = 345 bool skip_drawing_root_render_pass =
342 current_frame()->root_damage_rect.IsEmpty() && allow_empty_swap_; 346 current_frame()->root_damage_rect.IsEmpty() && allow_empty_swap_;
343 347
344 // If we have to draw but don't support partial swap, the whole output should 348 // If we have to draw but don't support partial swap, the whole output should
345 // be considered damaged. 349 // be considered damaged.
346 if (!skip_drawing_root_render_pass && !use_partial_swap_) 350 if (!skip_drawing_root_render_pass && !use_partial_swap_)
347 current_frame()->root_damage_rect = root_render_pass->output_rect; 351 current_frame()->root_damage_rect = root_render_pass->output_rect;
348 352
349 if (skip_drawing_root_render_pass) { 353 if (!skip_drawing_root_render_pass)
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); 354 DrawRenderPassAndExecuteCopyRequests(root_render_pass);
361 }
362 355
363 FinishDrawingFrame(); 356 FinishDrawingFrame();
364 render_passes_in_draw_order->clear(); 357 render_passes_in_draw_order->clear();
365 render_pass_filters_.clear(); 358 render_pass_filters_.clear();
366 render_pass_background_filters_.clear(); 359 render_pass_background_filters_.clear();
367 360
368 current_frame_valid_ = false; 361 current_frame_valid_ = false;
369 } 362 }
370 363
371 gfx::Rect DirectRenderer::DrawingFrame::ComputeScissorRectForRenderPass() 364 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) { 656 gfx::Size DirectRenderer::RenderPassTextureSize(const RenderPass* render_pass) {
664 return render_pass->output_rect.size(); 657 return render_pass->output_rect.size();
665 } 658 }
666 659
667 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) { 660 void DirectRenderer::SetCurrentFrameForTesting(const DrawingFrame& frame) {
668 current_frame_valid_ = true; 661 current_frame_valid_ = true;
669 current_frame_ = frame; 662 current_frame_ = frame;
670 } 663 }
671 664
672 } // namespace cc 665 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698