| 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/host/drm_display_host_manager.h" | 5 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <xf86drm.h> | 9 #include <xf86drm.h> |
| 10 | 10 |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/task_scheduler/post_task.h" | 17 #include "base/task_scheduler/post_task.h" |
| 18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" | 19 #include "base/threading/thread_task_runner_handle.h" |
| 20 #include "ui/display/types/display_snapshot.h" | 20 #include "ui/display/types/display_snapshot.h" |
| 21 #include "ui/events/ozone/device/device_event.h" | 21 #include "ui/events/ozone/device/device_event.h" |
| 22 #include "ui/events/ozone/device/device_manager.h" | 22 #include "ui/events/ozone/device/device_manager.h" |
| 23 #include "ui/ozone/platform/drm/common/drm_util.h" | 23 #include "ui/ozone/platform/drm/common/drm_util.h" |
| 24 #include "ui/ozone/platform/drm/host/drm_device_handle.h" | 24 #include "ui/ozone/platform/drm/host/drm_device_handle.h" |
| 25 #include "ui/ozone/platform/drm/host/drm_display_host.h" | 25 #include "ui/ozone/platform/drm/host/drm_display_host.h" |
| 26 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" | 26 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" |
| 27 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" |
| 27 #include "ui/ozone/platform/drm/host/gpu_thread_adapter.h" | 28 #include "ui/ozone/platform/drm/host/gpu_thread_adapter.h" |
| 28 | 29 |
| 29 namespace ui { | 30 namespace ui { |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 typedef base::Callback<void(const base::FilePath&, | 34 typedef base::Callback<void(const base::FilePath&, |
| 34 const base::FilePath&, | 35 const base::FilePath&, |
| 35 std::unique_ptr<DrmDeviceHandle>)> | 36 std::unique_ptr<DrmDeviceHandle>)> |
| 36 OnOpenDeviceReplyCallback; | 37 OnOpenDeviceReplyCallback; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 int64_t display_id_; | 106 int64_t display_id_; |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 } // namespace | 109 } // namespace |
| 109 | 110 |
| 110 DrmDisplayHostManager::DrmDisplayHostManager( | 111 DrmDisplayHostManager::DrmDisplayHostManager( |
| 111 GpuThreadAdapter* proxy, | 112 GpuThreadAdapter* proxy, |
| 112 DeviceManager* device_manager, | 113 DeviceManager* device_manager, |
| 114 DrmOverlayManager* overlay_manager, |
| 113 InputControllerEvdev* input_controller) | 115 InputControllerEvdev* input_controller) |
| 114 : proxy_(proxy), | 116 : proxy_(proxy), |
| 115 device_manager_(device_manager), | 117 device_manager_(device_manager), |
| 118 overlay_manager_(overlay_manager), |
| 116 input_controller_(input_controller), | 119 input_controller_(input_controller), |
| 117 primary_graphics_card_path_(GetPrimaryDisplayCardPath()), | 120 primary_graphics_card_path_(GetPrimaryDisplayCardPath()), |
| 118 weak_ptr_factory_(this) { | 121 weak_ptr_factory_(this) { |
| 119 { | 122 { |
| 120 // First device needs to be treated specially. We need to open this | 123 // First device needs to be treated specially. We need to open this |
| 121 // synchronously since the GPU process will need it to initialize the | 124 // synchronously since the GPU process will need it to initialize the |
| 122 // graphics state. | 125 // graphics state. |
| 123 base::ThreadRestrictions::ScopedAllowIO allow_io; | 126 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 124 | 127 |
| 125 base::FilePath primary_graphics_card_path_sysfs = | 128 base::FilePath primary_graphics_card_path_sysfs = |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 FROM_HERE, | 387 FROM_HERE, |
| 385 base::Bind(&DrmDisplayHostManager::RunUpdateDisplaysCallback, | 388 base::Bind(&DrmDisplayHostManager::RunUpdateDisplaysCallback, |
| 386 weak_ptr_factory_.GetWeakPtr(), get_displays_callback_)); | 389 weak_ptr_factory_.GetWeakPtr(), get_displays_callback_)); |
| 387 get_displays_callback_.Reset(); | 390 get_displays_callback_.Reset(); |
| 388 } | 391 } |
| 389 } | 392 } |
| 390 | 393 |
| 391 void DrmDisplayHostManager::GpuConfiguredDisplay(int64_t display_id, | 394 void DrmDisplayHostManager::GpuConfiguredDisplay(int64_t display_id, |
| 392 bool status) { | 395 bool status) { |
| 393 DrmDisplayHost* display = GetDisplay(display_id); | 396 DrmDisplayHost* display = GetDisplay(display_id); |
| 394 if (display) | 397 if (display) { |
| 395 display->OnDisplayConfigured(status); | 398 display->OnDisplayConfigured(status); |
| 396 else | 399 overlay_manager_->ResetCache(); |
| 400 } else { |
| 397 LOG(ERROR) << "Couldn't find display with id=" << display_id; | 401 LOG(ERROR) << "Couldn't find display with id=" << display_id; |
| 402 } |
| 398 } | 403 } |
| 399 | 404 |
| 400 void DrmDisplayHostManager::GpuReceivedHDCPState(int64_t display_id, | 405 void DrmDisplayHostManager::GpuReceivedHDCPState(int64_t display_id, |
| 401 bool status, | 406 bool status, |
| 402 display::HDCPState state) { | 407 display::HDCPState state) { |
| 403 DrmDisplayHost* display = GetDisplay(display_id); | 408 DrmDisplayHost* display = GetDisplay(display_id); |
| 404 if (display) | 409 if (display) |
| 405 display->OnHDCPStateReceived(status, state); | 410 display->OnHDCPStateReceived(status, state); |
| 406 else | 411 else |
| 407 LOG(ERROR) << "Couldn't find display with id=" << display_id; | 412 LOG(ERROR) << "Couldn't find display with id=" << display_id; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 469 |
| 465 callback.Run(snapshots); | 470 callback.Run(snapshots); |
| 466 } | 471 } |
| 467 | 472 |
| 468 void DrmDisplayHostManager::NotifyDisplayDelegate() const { | 473 void DrmDisplayHostManager::NotifyDisplayDelegate() const { |
| 469 if (delegate_) | 474 if (delegate_) |
| 470 delegate_->OnConfigurationChanged(); | 475 delegate_->OnConfigurationChanged(); |
| 471 } | 476 } |
| 472 | 477 |
| 473 } // namespace ui | 478 } // namespace ui |
| OLD | NEW |