| 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 <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/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 output_surface_->context_provider()->ContextGL()->ShallowFinishCHROMIUM(); | 152 output_surface_->context_provider()->ContextGL()->ShallowFinishCHROMIUM(); |
| 153 } | 153 } |
| 154 swapped_since_resize_ = false; | 154 swapped_since_resize_ = false; |
| 155 current_surface_size_ = size; | 155 current_surface_size_ = size; |
| 156 if (scheduler_) | 156 if (scheduler_) |
| 157 scheduler_->DisplayResized(); | 157 scheduler_->DisplayResized(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void Display::SetColorSpace(const gfx::ColorSpace& color_space) { | 160 void Display::SetColorSpace(const gfx::ColorSpace& color_space) { |
| 161 device_color_space_ = color_space; | 161 device_color_space_ = color_space; |
| 162 if (aggregator_) |
| 163 aggregator_->SetOutputColorSpace(device_color_space_); |
| 162 } | 164 } |
| 163 | 165 |
| 164 void Display::SetOutputIsSecure(bool secure) { | 166 void Display::SetOutputIsSecure(bool secure) { |
| 165 if (secure == output_is_secure_) | 167 if (secure == output_is_secure_) |
| 166 return; | 168 return; |
| 167 output_is_secure_ = secure; | 169 output_is_secure_ = secure; |
| 168 | 170 |
| 169 if (aggregator_) { | 171 if (aggregator_) { |
| 170 aggregator_->set_output_is_secure(secure); | 172 aggregator_->set_output_is_secure(secure); |
| 171 // Force a redraw. | 173 // Force a redraw. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 renderer_->Initialize(); | 210 renderer_->Initialize(); |
| 209 renderer_->SetVisible(visible_); | 211 renderer_->SetVisible(visible_); |
| 210 | 212 |
| 211 // TODO(jbauman): Outputting an incomplete quad list doesn't work when using | 213 // TODO(jbauman): Outputting an incomplete quad list doesn't work when using |
| 212 // overlays. | 214 // overlays. |
| 213 bool output_partial_list = renderer_->use_partial_swap() && | 215 bool output_partial_list = renderer_->use_partial_swap() && |
| 214 !output_surface_->GetOverlayCandidateValidator(); | 216 !output_surface_->GetOverlayCandidateValidator(); |
| 215 aggregator_.reset(new SurfaceAggregator( | 217 aggregator_.reset(new SurfaceAggregator( |
| 216 surface_manager_, resource_provider_.get(), output_partial_list)); | 218 surface_manager_, resource_provider_.get(), output_partial_list)); |
| 217 aggregator_->set_output_is_secure(output_is_secure_); | 219 aggregator_->set_output_is_secure(output_is_secure_); |
| 220 aggregator_->SetOutputColorSpace(device_color_space_); |
| 218 } | 221 } |
| 219 | 222 |
| 220 void Display::UpdateRootSurfaceResourcesLocked() { | 223 void Display::UpdateRootSurfaceResourcesLocked() { |
| 221 Surface* surface = surface_manager_->GetSurfaceForId(current_surface_id_); | 224 Surface* surface = surface_manager_->GetSurfaceForId(current_surface_id_); |
| 222 bool root_surface_resources_locked = !surface || !surface->HasActiveFrame(); | 225 bool root_surface_resources_locked = !surface || !surface->HasActiveFrame(); |
| 223 if (scheduler_) | 226 if (scheduler_) |
| 224 scheduler_->SetRootSurfaceResourcesLocked(root_surface_resources_locked); | 227 scheduler_->SetRootSurfaceResourcesLocked(root_surface_resources_locked); |
| 225 } | 228 } |
| 226 | 229 |
| 227 void Display::DidLoseContextProvider() { | 230 void Display::DidLoseContextProvider() { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 if (software_renderer_) { | 310 if (software_renderer_) { |
| 308 software_renderer_->SetDisablePictureQuadImageFiltering( | 311 software_renderer_->SetDisablePictureQuadImageFiltering( |
| 309 disable_image_filtering); | 312 disable_image_filtering); |
| 310 } else { | 313 } else { |
| 311 // This should only be set for software draws in synchronous compositor. | 314 // This should only be set for software draws in synchronous compositor. |
| 312 DCHECK(!disable_image_filtering); | 315 DCHECK(!disable_image_filtering); |
| 313 } | 316 } |
| 314 | 317 |
| 315 renderer_->DecideRenderPassAllocationsForFrame(frame.render_pass_list); | 318 renderer_->DecideRenderPassAllocationsForFrame(frame.render_pass_list); |
| 316 renderer_->DrawFrame(&frame.render_pass_list, device_scale_factor_, | 319 renderer_->DrawFrame(&frame.render_pass_list, device_scale_factor_, |
| 317 device_color_space_, current_surface_size_); | 320 current_surface_size_); |
| 318 } else { | 321 } else { |
| 319 TRACE_EVENT_INSTANT0("cc", "Draw skipped.", TRACE_EVENT_SCOPE_THREAD); | 322 TRACE_EVENT_INSTANT0("cc", "Draw skipped.", TRACE_EVENT_SCOPE_THREAD); |
| 320 } | 323 } |
| 321 | 324 |
| 322 bool should_swap = should_draw && size_matches; | 325 bool should_swap = should_draw && size_matches; |
| 323 if (should_swap) { | 326 if (should_swap) { |
| 324 swapped_since_resize_ = true; | 327 swapped_since_resize_ = true; |
| 325 for (auto& latency : frame.metadata.latency_info) { | 328 for (auto& latency : frame.metadata.latency_info) { |
| 326 TRACE_EVENT_WITH_FLOW1( | 329 TRACE_EVENT_WITH_FLOW1( |
| 327 "input,benchmark", "LatencyInfo.Flow", | 330 "input,benchmark", "LatencyInfo.Flow", |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 const SurfaceId& Display::CurrentSurfaceId() { | 400 const SurfaceId& Display::CurrentSurfaceId() { |
| 398 return current_surface_id_; | 401 return current_surface_id_; |
| 399 } | 402 } |
| 400 | 403 |
| 401 void Display::ForceImmediateDrawAndSwapIfPossible() { | 404 void Display::ForceImmediateDrawAndSwapIfPossible() { |
| 402 if (scheduler_) | 405 if (scheduler_) |
| 403 scheduler_->ForceImmediateSwapIfPossible(); | 406 scheduler_->ForceImmediateSwapIfPossible(); |
| 404 } | 407 } |
| 405 | 408 |
| 406 } // namespace cc | 409 } // namespace cc |
| OLD | NEW |