| 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 "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_descriptor_posix.h" | 9 #include "base/file_descriptor_posix.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 } | 329 } |
| 330 | 330 |
| 331 return true; | 331 return true; |
| 332 } | 332 } |
| 333 | 333 |
| 334 bool DrmGpuDisplayManager::GetHDCPState(const DrmDisplaySnapshot& output, | 334 bool DrmGpuDisplayManager::GetHDCPState(const DrmDisplaySnapshot& output, |
| 335 HDCPState* state) { | 335 HDCPState* state) { |
| 336 ScopedDrmConnectorPtr connector( | 336 ScopedDrmConnectorPtr connector( |
| 337 output.drm()->GetConnector(output.connector())); | 337 output.drm()->GetConnector(output.connector())); |
| 338 if (!connector) { | 338 if (!connector) { |
| 339 LOG(ERROR) << "Failed to get connector " << output.connector(); | 339 PLOG(ERROR) << "Failed to get connector " << output.connector(); |
| 340 return false; | 340 return false; |
| 341 } | 341 } |
| 342 | 342 |
| 343 ScopedDrmPropertyPtr hdcp_property( | 343 ScopedDrmPropertyPtr hdcp_property( |
| 344 output.drm()->GetProperty(connector.get(), kContentProtection)); | 344 output.drm()->GetProperty(connector.get(), kContentProtection)); |
| 345 if (!hdcp_property) { | 345 if (!hdcp_property) { |
| 346 LOG(ERROR) << "'" << kContentProtection << "' property doesn't exist."; | 346 PLOG(ERROR) << "'" << kContentProtection << "' property doesn't exist."; |
| 347 return false; | 347 return false; |
| 348 } | 348 } |
| 349 | 349 |
| 350 DCHECK_LT(static_cast<int>(hdcp_property->prop_id), connector->count_props); | 350 DCHECK_LT(static_cast<int>(hdcp_property->prop_id), connector->count_props); |
| 351 int hdcp_state_idx = connector->prop_values[hdcp_property->prop_id]; | 351 int hdcp_state_idx = connector->prop_values[hdcp_property->prop_id]; |
| 352 DCHECK_LT(hdcp_state_idx, hdcp_property->count_enums); | 352 DCHECK_LT(hdcp_state_idx, hdcp_property->count_enums); |
| 353 | 353 |
| 354 std::string name(hdcp_property->enums[hdcp_state_idx].name); | 354 std::string name(hdcp_property->enums[hdcp_state_idx].name); |
| 355 for (size_t i = 0; i < arraysize(kContentProtectionStates); ++i) { | 355 for (size_t i = 0; i < arraysize(kContentProtectionStates); ++i) { |
| 356 if (name == kContentProtectionStates[i].name) { | 356 if (name == kContentProtectionStates[i].name) { |
| 357 *state = kContentProtectionStates[i].state; | 357 *state = kContentProtectionStates[i].state; |
| 358 VLOG(3) << "HDCP state: " << *state << " (" << name << ")"; | 358 VLOG(3) << "HDCP state: " << *state << " (" << name << ")"; |
| 359 return true; | 359 return true; |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 LOG(ERROR) << "Unknown content protection value '" << name << "'"; | 363 LOG(ERROR) << "Unknown content protection value '" << name << "'"; |
| 364 return false; | 364 return false; |
| 365 } | 365 } |
| 366 | 366 |
| 367 bool DrmGpuDisplayManager::SetHDCPState(const DrmDisplaySnapshot& output, | 367 bool DrmGpuDisplayManager::SetHDCPState(const DrmDisplaySnapshot& output, |
| 368 HDCPState state) { | 368 HDCPState state) { |
| 369 ScopedDrmConnectorPtr connector( | 369 ScopedDrmConnectorPtr connector( |
| 370 output.drm()->GetConnector(output.connector())); | 370 output.drm()->GetConnector(output.connector())); |
| 371 if (!connector) { | 371 if (!connector) { |
| 372 LOG(ERROR) << "Failed to get connector " << output.connector(); | 372 PLOG(ERROR) << "Failed to get connector " << output.connector(); |
| 373 return false; | 373 return false; |
| 374 } | 374 } |
| 375 | 375 |
| 376 ScopedDrmPropertyPtr hdcp_property( | 376 ScopedDrmPropertyPtr hdcp_property( |
| 377 output.drm()->GetProperty(connector.get(), kContentProtection)); | 377 output.drm()->GetProperty(connector.get(), kContentProtection)); |
| 378 if (!hdcp_property) { | 378 if (!hdcp_property) { |
| 379 LOG(ERROR) << "'" << kContentProtection << "' property doesn't exist."; | 379 PLOG(ERROR) << "'" << kContentProtection << "' property doesn't exist."; |
| 380 return false; | 380 return false; |
| 381 } | 381 } |
| 382 | 382 |
| 383 return output.drm()->SetProperty( | 383 return output.drm()->SetProperty( |
| 384 output.connector(), hdcp_property->prop_id, | 384 output.connector(), hdcp_property->prop_id, |
| 385 GetContentProtectionValue(hdcp_property.get(), state)); | 385 GetContentProtectionValue(hdcp_property.get(), state)); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void DrmGpuDisplayManager::NotifyScreenManager( | 388 void DrmGpuDisplayManager::NotifyScreenManager( |
| 389 const std::vector<DrmDisplaySnapshot*>& new_displays, | 389 const std::vector<DrmDisplaySnapshot*>& new_displays, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 406 | 406 |
| 407 if (it == old_displays.end()) { | 407 if (it == old_displays.end()) { |
| 408 screen_manager_->AddDisplayController(new_displays[i]->drm(), | 408 screen_manager_->AddDisplayController(new_displays[i]->drm(), |
| 409 new_displays[i]->crtc(), | 409 new_displays[i]->crtc(), |
| 410 new_displays[i]->connector()); | 410 new_displays[i]->connector()); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 } | 413 } |
| 414 | 414 |
| 415 } // namespace ui | 415 } // namespace ui |
| OLD | NEW |