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_NATIVE_DISPLAY_DELEGATE_HOST_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ |
6 #define UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <queue> | 9 #include <queue> |
10 #include <set> | |
11 | 10 |
| 11 #include "base/containers/scoped_ptr_hash_map.h" |
12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | |
16 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
17 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
18 #include "ui/display/types/native_display_delegate.h" | 17 #include "ui/display/types/native_display_delegate.h" |
19 #include "ui/events/ozone/device/device_event.h" | 18 #include "ui/events/ozone/device/device_event.h" |
20 #include "ui/events/ozone/device/device_event_observer.h" | 19 #include "ui/events/ozone/device/device_event_observer.h" |
21 #include "ui/ozone/public/gpu_platform_support_host.h" | 20 #include "ui/ozone/public/gpu_platform_support_host.h" |
22 | 21 |
23 namespace ui { | 22 namespace ui { |
24 | 23 |
25 class DeviceManager; | 24 class DeviceManager; |
26 class DisplayManager; | 25 class DisplayManager; |
| 26 class DrmDeviceHandle; |
27 class DrmGpuPlatformSupportHost; | 27 class DrmGpuPlatformSupportHost; |
28 | 28 |
29 struct DisplaySnapshot_Params; | 29 struct DisplaySnapshot_Params; |
30 | 30 |
31 class DrmNativeDisplayDelegate : public NativeDisplayDelegate, | 31 class DrmNativeDisplayDelegate : public NativeDisplayDelegate, |
32 public DeviceEventObserver, | 32 public DeviceEventObserver, |
33 public GpuPlatformSupportHost { | 33 public GpuPlatformSupportHost { |
34 public: | 34 public: |
35 DrmNativeDisplayDelegate(DrmGpuPlatformSupportHost* proxy, | 35 DrmNativeDisplayDelegate(DrmGpuPlatformSupportHost* proxy, |
36 DeviceManager* device_manager, | 36 DeviceManager* device_manager, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 }; | 90 }; |
91 | 91 |
92 void OnUpdateNativeDisplays( | 92 void OnUpdateNativeDisplays( |
93 const std::vector<DisplaySnapshot_Params>& displays); | 93 const std::vector<DisplaySnapshot_Params>& displays); |
94 void OnDisplayConfigured(int64_t display_id, bool status); | 94 void OnDisplayConfigured(int64_t display_id, bool status); |
95 | 95 |
96 void ProcessEvent(); | 96 void ProcessEvent(); |
97 | 97 |
98 // Called as a result of finishing to process the display hotplug event. These | 98 // Called as a result of finishing to process the display hotplug event. These |
99 // are responsible for dequing the event and scheduling the next event. | 99 // are responsible for dequing the event and scheduling the next event. |
100 void OnAddGraphicsDevice(const base::FilePath& path, base::File file); | 100 void OnAddGraphicsDevice(const base::FilePath& path, |
| 101 scoped_ptr<DrmDeviceHandle> handle); |
101 void OnUpdateGraphicsDevice(); | 102 void OnUpdateGraphicsDevice(); |
102 void OnRemoveGraphicsDevice(const base::FilePath& path); | 103 void OnRemoveGraphicsDevice(const base::FilePath& path); |
103 | 104 |
104 void OnHDCPStateReceived(int64_t display_id, bool status, HDCPState state); | 105 void OnHDCPStateReceived(int64_t display_id, bool status, HDCPState state); |
105 void OnHDCPStateUpdated(int64_t display_id, bool status); | 106 void OnHDCPStateUpdated(int64_t display_id, bool status); |
106 | 107 |
107 void RunUpdateDisplaysCallback(const GetDisplaysCallback& callback) const; | 108 void RunUpdateDisplaysCallback(const GetDisplaysCallback& callback) const; |
108 | 109 |
109 DrmGpuPlatformSupportHost* proxy_; // Not owned. | 110 DrmGpuPlatformSupportHost* proxy_; // Not owned. |
110 DeviceManager* device_manager_; // Not owned. | 111 DeviceManager* device_manager_; // Not owned. |
(...skipping 23 matching lines...) Expand all Loading... |
134 // Used to serialize display event processing. This is done since | 135 // Used to serialize display event processing. This is done since |
135 // opening/closing DRM devices cannot be done on the UI thread and are handled | 136 // opening/closing DRM devices cannot be done on the UI thread and are handled |
136 // on a worker thread. Thus, we need to queue events in order to process them | 137 // on a worker thread. Thus, we need to queue events in order to process them |
137 // in the correct order. | 138 // in the correct order. |
138 std::queue<DisplayEvent> event_queue_; | 139 std::queue<DisplayEvent> event_queue_; |
139 | 140 |
140 // True if a display event is currently being processed on a worker thread. | 141 // True if a display event is currently being processed on a worker thread. |
141 bool task_pending_; | 142 bool task_pending_; |
142 | 143 |
143 // Keeps track of all the active DRM devices. | 144 // Keeps track of all the active DRM devices. |
144 std::set<base::FilePath> drm_devices_; | 145 base::ScopedPtrHashMap<base::FilePath, scoped_ptr<DrmDeviceHandle>> |
| 146 drm_devices_; |
145 | 147 |
146 base::WeakPtrFactory<DrmNativeDisplayDelegate> weak_ptr_factory_; | 148 base::WeakPtrFactory<DrmNativeDisplayDelegate> weak_ptr_factory_; |
147 | 149 |
148 DISALLOW_COPY_AND_ASSIGN(DrmNativeDisplayDelegate); | 150 DISALLOW_COPY_AND_ASSIGN(DrmNativeDisplayDelegate); |
149 }; | 151 }; |
150 | 152 |
151 } // namespace ui | 153 } // namespace ui |
152 | 154 |
153 #endif // UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ | 155 #endif // UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ |
OLD | NEW |