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_DRI_NATIVE_DISPLAY_DELEGATE_PROXY_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_PROXY_H_ |
6 #define UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_PROXY_H_ | 6 #define UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_PROXY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "ui/display/types/native_display_delegate.h" | 15 #include "ui/display/types/native_display_delegate.h" |
15 #include "ui/events/ozone/device/device_event_observer.h" | 16 #include "ui/events/ozone/device/device_event_observer.h" |
16 #include "ui/ozone/public/gpu_platform_support_host.h" | 17 #include "ui/ozone/public/gpu_platform_support_host.h" |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
19 | 20 |
20 class DeviceManager; | 21 class DeviceManager; |
21 class DisplayManager; | 22 class DisplayManager; |
22 class DriGpuPlatformSupportHost; | 23 class DriGpuPlatformSupportHost; |
23 | 24 |
24 struct DisplaySnapshot_Params; | 25 struct DisplaySnapshot_Params; |
25 | 26 |
26 class NativeDisplayDelegateProxy : public NativeDisplayDelegate, | 27 class NativeDisplayDelegateProxy : public NativeDisplayDelegate, |
27 public DeviceEventObserver, | 28 public DeviceEventObserver, |
28 public GpuPlatformSupportHost { | 29 public GpuPlatformSupportHost { |
29 public: | 30 public: |
30 NativeDisplayDelegateProxy(DriGpuPlatformSupportHost* proxy, | 31 NativeDisplayDelegateProxy(DriGpuPlatformSupportHost* proxy, |
31 DeviceManager* device_manager, | 32 DeviceManager* device_manager, |
32 DisplayManager* display_manager); | 33 DisplayManager* display_manager, |
| 34 const base::FilePath& primary_graphics_card_path); |
33 ~NativeDisplayDelegateProxy() override; | 35 ~NativeDisplayDelegateProxy() override; |
34 | 36 |
35 // NativeDisplayDelegate overrides: | 37 // NativeDisplayDelegate overrides: |
36 void Initialize() override; | 38 void Initialize() override; |
37 void GrabServer() override; | 39 void GrabServer() override; |
38 void UngrabServer() override; | 40 void UngrabServer() override; |
39 bool TakeDisplayControl() override; | 41 bool TakeDisplayControl() override; |
40 bool RelinquishDisplayControl() override; | 42 bool RelinquishDisplayControl() override; |
41 void SyncWithServer() override; | 43 void SyncWithServer() override; |
42 void SetBackgroundColor(uint32_t color_argb) override; | 44 void SetBackgroundColor(uint32_t color_argb) override; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void OnUpdateNativeDisplays( | 76 void OnUpdateNativeDisplays( |
75 const std::vector<DisplaySnapshot_Params>& displays); | 77 const std::vector<DisplaySnapshot_Params>& displays); |
76 void OnDisplayConfigured(int64_t display_id, bool status); | 78 void OnDisplayConfigured(int64_t display_id, bool status); |
77 | 79 |
78 void OnNewGraphicsDevice(const base::FilePath& path, base::File file); | 80 void OnNewGraphicsDevice(const base::FilePath& path, base::File file); |
79 | 81 |
80 DriGpuPlatformSupportHost* proxy_; // Not owned. | 82 DriGpuPlatformSupportHost* proxy_; // Not owned. |
81 DeviceManager* device_manager_; // Not owned. | 83 DeviceManager* device_manager_; // Not owned. |
82 DisplayManager* display_manager_; // Not owned. | 84 DisplayManager* display_manager_; // Not owned. |
83 | 85 |
| 86 // File path for the primary graphics card which is opened by default in the |
| 87 // GPU process. We'll avoid opening this in hotplug events since it will race |
| 88 // with the GPU process trying to open it and aquire DRM master. |
| 89 const base::FilePath primary_graphics_card_path_; |
| 90 |
84 // Keeps track if there is a dummy display. This happens on initialization | 91 // Keeps track if there is a dummy display. This happens on initialization |
85 // when there is no connection to the GPU to update the displays. | 92 // when there is no connection to the GPU to update the displays. |
86 bool has_dummy_display_; | 93 bool has_dummy_display_; |
87 | 94 |
88 ScopedVector<DisplaySnapshot> displays_; | 95 ScopedVector<DisplaySnapshot> displays_; |
89 ObserverList<NativeDisplayObserver> observers_; | 96 ObserverList<NativeDisplayObserver> observers_; |
90 | 97 |
91 GetDisplaysCallback get_displays_callback_; | 98 GetDisplaysCallback get_displays_callback_; |
92 | 99 |
93 // Map between display_id and the configuration callback. | 100 // Map between display_id and the configuration callback. |
94 std::map<int64_t, ConfigureCallback> configure_callback_map_; | 101 std::map<int64_t, ConfigureCallback> configure_callback_map_; |
95 | 102 |
96 base::WeakPtrFactory<NativeDisplayDelegateProxy> weak_ptr_factory_; | 103 base::WeakPtrFactory<NativeDisplayDelegateProxy> weak_ptr_factory_; |
97 | 104 |
98 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateProxy); | 105 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateProxy); |
99 }; | 106 }; |
100 | 107 |
101 } // namespace ui | 108 } // namespace ui |
102 | 109 |
103 #endif // UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_PROXY_H_ | 110 #endif // UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_PROXY_H_ |
OLD | NEW |