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 "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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 PLOG(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 std::string name; |
| 351 int hdcp_state_idx = connector->prop_values[hdcp_property->prop_id]; | 351 for (int prop_idx = 0; prop_idx < connector->count_props; ++prop_idx) { |
|
spang
2015/03/26 17:56:29
Please factor out the property search.
dnicoara
2015/04/14 21:57:17
Done.
| |
| 352 DCHECK_LT(hdcp_state_idx, hdcp_property->count_enums); | 352 if (connector->props[prop_idx] != hdcp_property->prop_id) |
| 353 continue; | |
| 353 | 354 |
| 354 std::string name(hdcp_property->enums[hdcp_state_idx].name); | 355 for (int enum_idx = 0; enum_idx < hdcp_property->count_enums; ++enum_idx) { |
|
spang
2015/03/26 17:56:29
It'll be a lot clearer if you do.
drm_mode_proper
dnicoara
2015/04/14 21:57:17
Done.
| |
| 356 if (hdcp_property->enums[enum_idx].value == | |
| 357 connector->prop_values[prop_idx]) { | |
| 358 name = hdcp_property->enums[enum_idx].name; | |
| 359 break; | |
| 360 } | |
| 361 } | |
| 362 | |
| 363 break; | |
| 364 } | |
| 365 | |
| 355 for (size_t i = 0; i < arraysize(kContentProtectionStates); ++i) { | 366 for (size_t i = 0; i < arraysize(kContentProtectionStates); ++i) { |
| 356 if (name == kContentProtectionStates[i].name) { | 367 if (name == kContentProtectionStates[i].name) { |
| 357 *state = kContentProtectionStates[i].state; | 368 *state = kContentProtectionStates[i].state; |
| 358 VLOG(3) << "HDCP state: " << *state << " (" << name << ")"; | 369 VLOG(3) << "HDCP state: " << *state << " (" << name << ")"; |
| 359 return true; | 370 return true; |
| 360 } | 371 } |
| 361 } | 372 } |
| 362 | 373 |
| 363 LOG(ERROR) << "Unknown content protection value '" << name << "'"; | 374 LOG(ERROR) << "Unknown content protection value '" << name << "'"; |
| 364 return false; | 375 return false; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 | 417 |
| 407 if (it == old_displays.end()) { | 418 if (it == old_displays.end()) { |
| 408 screen_manager_->AddDisplayController(new_displays[i]->drm(), | 419 screen_manager_->AddDisplayController(new_displays[i]->drm(), |
| 409 new_displays[i]->crtc(), | 420 new_displays[i]->crtc(), |
| 410 new_displays[i]->connector()); | 421 new_displays[i]->connector()); |
| 411 } | 422 } |
| 412 } | 423 } |
| 413 } | 424 } |
| 414 | 425 |
| 415 } // namespace ui | 426 } // namespace ui |
| OLD | NEW |