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 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_DISPLAY_HOST_MANAGER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_DRM_DISPLAY_HOST_MANAGER_H_ |
6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_DISPLAY_HOST_MANAGER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_DRM_DISPLAY_HOST_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
11 #include <queue> | 12 #include <queue> |
12 | 13 |
13 #include "base/file_descriptor_posix.h" | 14 #include "base/file_descriptor_posix.h" |
14 #include "base/files/scoped_file.h" | 15 #include "base/files/scoped_file.h" |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "ui/display/types/native_display_delegate.h" | 19 #include "ui/display/types/native_display_delegate.h" |
20 #include "ui/events/ozone/device/device_event.h" | 20 #include "ui/events/ozone/device/device_event.h" |
21 #include "ui/events/ozone/device/device_event_observer.h" | 21 #include "ui/events/ozone/device/device_event_observer.h" |
22 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 22 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
23 #include "ui/ozone/platform/drm/host/gpu_thread_observer.h" | 23 #include "ui/ozone/platform/drm/host/gpu_thread_observer.h" |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 | 26 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 base::FilePath path; | 80 base::FilePath path; |
81 }; | 81 }; |
82 | 82 |
83 // Handle hotplug events sequentially. | 83 // Handle hotplug events sequentially. |
84 void ProcessEvent(); | 84 void ProcessEvent(); |
85 | 85 |
86 // Called as a result of finishing to process the display hotplug event. These | 86 // Called as a result of finishing to process the display hotplug event. These |
87 // are responsible for dequing the event and scheduling the next event. | 87 // are responsible for dequing the event and scheduling the next event. |
88 void OnAddGraphicsDevice(const base::FilePath& path, | 88 void OnAddGraphicsDevice(const base::FilePath& path, |
89 const base::FilePath& sysfs_path, | 89 const base::FilePath& sysfs_path, |
90 scoped_ptr<DrmDeviceHandle> handle); | 90 std::unique_ptr<DrmDeviceHandle> handle); |
91 void OnUpdateGraphicsDevice(); | 91 void OnUpdateGraphicsDevice(); |
92 void OnRemoveGraphicsDevice(const base::FilePath& path); | 92 void OnRemoveGraphicsDevice(const base::FilePath& path); |
93 | 93 |
94 void RunUpdateDisplaysCallback(const GetDisplaysCallback& callback) const; | 94 void RunUpdateDisplaysCallback(const GetDisplaysCallback& callback) const; |
95 | 95 |
96 void NotifyDisplayDelegate() const; | 96 void NotifyDisplayDelegate() const; |
97 | 97 |
98 GpuThreadAdapter* proxy_; // Not owned. | 98 GpuThreadAdapter* proxy_; // Not owned. |
99 DeviceManager* device_manager_; // Not owned. | 99 DeviceManager* device_manager_; // Not owned. |
100 InputControllerEvdev* input_controller_; // Not owned. | 100 InputControllerEvdev* input_controller_; // Not owned. |
101 | 101 |
102 DrmNativeDisplayDelegate* delegate_ = nullptr; // Not owned. | 102 DrmNativeDisplayDelegate* delegate_ = nullptr; // Not owned. |
103 | 103 |
104 // File path for the primary graphics card which is opened by default in the | 104 // File path for the primary graphics card which is opened by default in the |
105 // GPU process. We'll avoid opening this in hotplug events since it will race | 105 // GPU process. We'll avoid opening this in hotplug events since it will race |
106 // with the GPU process trying to open it and aquire DRM master. | 106 // with the GPU process trying to open it and aquire DRM master. |
107 base::FilePath primary_graphics_card_path_; | 107 base::FilePath primary_graphics_card_path_; |
108 | 108 |
109 // Keeps track if there is a dummy display. This happens on initialization | 109 // Keeps track if there is a dummy display. This happens on initialization |
110 // when there is no connection to the GPU to update the displays. | 110 // when there is no connection to the GPU to update the displays. |
111 bool has_dummy_display_ = false; | 111 bool has_dummy_display_ = false; |
112 | 112 |
113 std::vector<scoped_ptr<DrmDisplayHost>> displays_; | 113 std::vector<std::unique_ptr<DrmDisplayHost>> displays_; |
114 | 114 |
115 GetDisplaysCallback get_displays_callback_; | 115 GetDisplaysCallback get_displays_callback_; |
116 | 116 |
117 bool display_externally_controlled_ = false; | 117 bool display_externally_controlled_ = false; |
118 bool display_control_change_pending_ = false; | 118 bool display_control_change_pending_ = false; |
119 DisplayControlCallback take_display_control_callback_; | 119 DisplayControlCallback take_display_control_callback_; |
120 DisplayControlCallback relinquish_display_control_callback_; | 120 DisplayControlCallback relinquish_display_control_callback_; |
121 | 121 |
122 // Used to serialize display event processing. This is done since | 122 // Used to serialize display event processing. This is done since |
123 // opening/closing DRM devices cannot be done on the UI thread and are handled | 123 // opening/closing DRM devices cannot be done on the UI thread and are handled |
124 // on a worker thread. Thus, we need to queue events in order to process them | 124 // on a worker thread. Thus, we need to queue events in order to process them |
125 // in the correct order. | 125 // in the correct order. |
126 std::queue<DisplayEvent> event_queue_; | 126 std::queue<DisplayEvent> event_queue_; |
127 | 127 |
128 // True if a display event is currently being processed on a worker thread. | 128 // True if a display event is currently being processed on a worker thread. |
129 bool task_pending_ = false; | 129 bool task_pending_ = false; |
130 | 130 |
131 // Keeps track of all the active DRM devices. The key is the device path, the | 131 // Keeps track of all the active DRM devices. The key is the device path, the |
132 // value is the sysfs path which has been resolved from the device path. | 132 // value is the sysfs path which has been resolved from the device path. |
133 std::map<base::FilePath, base::FilePath> drm_devices_; | 133 std::map<base::FilePath, base::FilePath> drm_devices_; |
134 | 134 |
135 // This is used to cache the primary DRM device until the channel is | 135 // This is used to cache the primary DRM device until the channel is |
136 // established. | 136 // established. |
137 scoped_ptr<DrmDeviceHandle> primary_drm_device_handle_; | 137 std::unique_ptr<DrmDeviceHandle> primary_drm_device_handle_; |
138 | 138 |
139 base::WeakPtrFactory<DrmDisplayHostManager> weak_ptr_factory_; | 139 base::WeakPtrFactory<DrmDisplayHostManager> weak_ptr_factory_; |
140 | 140 |
141 DISALLOW_COPY_AND_ASSIGN(DrmDisplayHostManager); | 141 DISALLOW_COPY_AND_ASSIGN(DrmDisplayHostManager); |
142 }; | 142 }; |
143 | 143 |
144 } // namespace ui | 144 } // namespace ui |
145 | 145 |
146 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_DISPLAY_HOST_MANAGER_H_ | 146 #endif // UI_OZONE_PLATFORM_DRM_HOST_DRM_DISPLAY_HOST_MANAGER_H_ |
OLD | NEW |