Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |