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

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

Issue 1426453006: Resize output_rect of aggregated CompositorFrame to enable it to be drawn when resizing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/surfaces/display_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 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 "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 stored_latency_info_.end()); 211 stored_latency_info_.end());
212 stored_latency_info_.clear(); 212 stored_latency_info_.clear();
213 bool have_copy_requests = false; 213 bool have_copy_requests = false;
214 for (const auto* pass : frame_data->render_pass_list) { 214 for (const auto* pass : frame_data->render_pass_list) {
215 have_copy_requests |= !pass->copy_requests.empty(); 215 have_copy_requests |= !pass->copy_requests.empty();
216 } 216 }
217 217
218 gfx::Size surface_size; 218 gfx::Size surface_size;
219 bool have_damage = false; 219 bool have_damage = false;
220 if (!frame_data->render_pass_list.empty()) { 220 if (!frame_data->render_pass_list.empty()) {
221 surface_size = frame_data->render_pass_list.back()->output_rect.size(); 221 RenderPass& last_render_pass = *frame_data->render_pass_list.back();
222 have_damage = 222 if (last_render_pass.output_rect.size() != current_surface_size_ &&
223 !frame_data->render_pass_list.back()->damage_rect.size().IsEmpty(); 223 last_render_pass.damage_rect == last_render_pass.output_rect &&
224 !current_surface_size_.IsEmpty()) {
225 // Resize the output rect to the current surface size so that we won't
226 // skip the draw and so that the GL swap won't stretch the output.
227 last_render_pass.output_rect.set_size(current_surface_size_);
228 last_render_pass.damage_rect = last_render_pass.output_rect;
229 }
230 surface_size = last_render_pass.output_rect.size();
231 have_damage = !last_render_pass.damage_rect.size().IsEmpty();
224 } 232 }
225 233
226 bool size_matches = surface_size == current_surface_size_; 234 bool size_matches = surface_size == current_surface_size_;
227 if (!size_matches) 235 if (!size_matches)
228 TRACE_EVENT_INSTANT0("cc", "Size missmatch.", TRACE_EVENT_SCOPE_THREAD); 236 TRACE_EVENT_INSTANT0("cc", "Size mismatch.", TRACE_EVENT_SCOPE_THREAD);
brianderson 2015/11/04 01:40:25 In what cases would we hit this trace after this p
229 237
230 bool should_draw = !frame->metadata.latency_info.empty() || 238 bool should_draw = !frame->metadata.latency_info.empty() ||
231 have_copy_requests || (have_damage && size_matches); 239 have_copy_requests || (have_damage && size_matches);
232 240
233 // If the surface is suspended then the resources to be used by the draw are 241 // If the surface is suspended then the resources to be used by the draw are
234 // likely destroyed. 242 // likely destroyed.
235 if (output_surface_->SurfaceIsSuspendForRecycle()) { 243 if (output_surface_->SurfaceIsSuspendForRecycle()) {
236 TRACE_EVENT_INSTANT0("cc", "Surface is suspended for recycle.", 244 TRACE_EVENT_INSTANT0("cc", "Surface is suspended for recycle.",
237 TRACE_EVENT_SCOPE_THREAD); 245 TRACE_EVENT_SCOPE_THREAD);
238 should_draw = false; 246 should_draw = false;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 360
353 if (surface_id == current_surface_id_) 361 if (surface_id == current_surface_id_)
354 UpdateRootSurfaceResourcesLocked(); 362 UpdateRootSurfaceResourcesLocked();
355 } 363 }
356 364
357 SurfaceId Display::CurrentSurfaceId() { 365 SurfaceId Display::CurrentSurfaceId() {
358 return current_surface_id_; 366 return current_surface_id_;
359 } 367 }
360 368
361 } // namespace cc 369 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698