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

Side by Side Diff: cc/surfaces/display.cc

Issue 2855723002: Don't submit frames with no render passes in cc tests (Closed)
Patch Set: c Created 3 years, 7 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/surfaces/compositor_frame_sink_support_unittest.cc ('k') | cc/surfaces/surface.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/surfaces/display.h" 5 #include "cc/surfaces/display.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 stored_latency_info_.begin(), 276 stored_latency_info_.begin(),
277 stored_latency_info_.end()); 277 stored_latency_info_.end());
278 stored_latency_info_.clear(); 278 stored_latency_info_.clear();
279 bool have_copy_requests = false; 279 bool have_copy_requests = false;
280 for (const auto& pass : frame.render_pass_list) { 280 for (const auto& pass : frame.render_pass_list) {
281 have_copy_requests |= !pass->copy_requests.empty(); 281 have_copy_requests |= !pass->copy_requests.empty();
282 } 282 }
283 283
284 gfx::Size surface_size; 284 gfx::Size surface_size;
285 bool have_damage = false; 285 bool have_damage = false;
286 if (!frame.render_pass_list.empty()) { 286 RenderPass& last_render_pass = *frame.render_pass_list.back();
287 RenderPass& last_render_pass = *frame.render_pass_list.back(); 287 if (last_render_pass.output_rect.size() != current_surface_size_ &&
288 if (last_render_pass.output_rect.size() != current_surface_size_ && 288 last_render_pass.damage_rect == last_render_pass.output_rect &&
289 last_render_pass.damage_rect == last_render_pass.output_rect && 289 !current_surface_size_.IsEmpty()) {
290 !current_surface_size_.IsEmpty()) { 290 // Resize the output rect to the current surface size so that we won't
291 // Resize the output rect to the current surface size so that we won't 291 // skip the draw and so that the GL swap won't stretch the output.
292 // skip the draw and so that the GL swap won't stretch the output. 292 last_render_pass.output_rect.set_size(current_surface_size_);
293 last_render_pass.output_rect.set_size(current_surface_size_); 293 last_render_pass.damage_rect = last_render_pass.output_rect;
294 last_render_pass.damage_rect = last_render_pass.output_rect;
295 }
296 surface_size = last_render_pass.output_rect.size();
297 have_damage = !last_render_pass.damage_rect.size().IsEmpty();
298 } 294 }
295 surface_size = last_render_pass.output_rect.size();
296 have_damage = !last_render_pass.damage_rect.size().IsEmpty();
299 297
300 bool size_matches = surface_size == current_surface_size_; 298 bool size_matches = surface_size == current_surface_size_;
301 if (!size_matches) 299 if (!size_matches)
302 TRACE_EVENT_INSTANT0("cc", "Size mismatch.", TRACE_EVENT_SCOPE_THREAD); 300 TRACE_EVENT_INSTANT0("cc", "Size mismatch.", TRACE_EVENT_SCOPE_THREAD);
303 301
304 bool should_draw = have_copy_requests || (have_damage && size_matches); 302 bool should_draw = have_copy_requests || (have_damage && size_matches);
305 303
306 // If the surface is suspended then the resources to be used by the draw are 304 // If the surface is suspended then the resources to be used by the draw are
307 // likely destroyed. 305 // likely destroyed.
308 if (output_surface_->SurfaceIsSuspendForRecycle()) { 306 if (output_surface_->SurfaceIsSuspendForRecycle()) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 const SurfaceId& Display::CurrentSurfaceId() { 415 const SurfaceId& Display::CurrentSurfaceId() {
418 return current_surface_id_; 416 return current_surface_id_;
419 } 417 }
420 418
421 void Display::ForceImmediateDrawAndSwapIfPossible() { 419 void Display::ForceImmediateDrawAndSwapIfPossible() {
422 if (scheduler_) 420 if (scheduler_)
423 scheduler_->ForceImmediateSwapIfPossible(); 421 scheduler_->ForceImmediateSwapIfPossible();
424 } 422 }
425 423
426 } // namespace cc 424 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/compositor_frame_sink_support_unittest.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698