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_DRI_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ |
6 #define UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ | 6 #define UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" | 11 #include "ui/ozone/common/gpu/ozone_gpu_message_params.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
| 14 class FileDescriptor; |
14 class FilePath; | 15 class FilePath; |
15 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
16 } | 17 } |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
19 | 20 |
20 class DeviceManager; | 21 class DeviceManager; |
21 class DisplaySnapshotDri; | 22 class DisplaySnapshotDri; |
22 class DisplayMode; | 23 class DisplayMode; |
23 class DisplayModeDri; | 24 class DisplayModeDri; |
24 class DriWrapper; | 25 class DriWrapper; |
| 26 class DrmDeviceGenerator; |
25 class ScreenManager; | 27 class ScreenManager; |
26 | 28 |
27 class NativeDisplayDelegateDri { | 29 class NativeDisplayDelegateDri { |
28 public: | 30 public: |
29 NativeDisplayDelegateDri(ScreenManager* screen_manager, | 31 NativeDisplayDelegateDri(ScreenManager* screen_manager, |
30 const scoped_refptr<DriWrapper>& primary_device); | 32 const scoped_refptr<DriWrapper>& primary_device, |
| 33 scoped_ptr<DrmDeviceGenerator> device_generator); |
31 ~NativeDisplayDelegateDri(); | 34 ~NativeDisplayDelegateDri(); |
32 | 35 |
33 void InitializeIOTaskRunner( | 36 void InitializeIOTaskRunner( |
34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 37 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
35 | 38 |
36 void ForceDPMSOn(); | 39 void ForceDPMSOn(); |
37 | 40 |
38 // Returns a list of the connected displays. When this is called the list of | 41 // Returns a list of the connected displays. When this is called the list of |
39 // displays is refreshed. | 42 // displays is refreshed. |
40 std::vector<DisplaySnapshot_Params> GetDisplays(); | 43 std::vector<DisplaySnapshot_Params> GetDisplays(); |
41 | 44 |
42 bool ConfigureDisplay(int64_t id, | 45 bool ConfigureDisplay(int64_t id, |
43 const DisplayMode_Params& mode, | 46 const DisplayMode_Params& mode, |
44 const gfx::Point& origin); | 47 const gfx::Point& origin); |
45 bool DisableDisplay(int64_t id); | 48 bool DisableDisplay(int64_t id); |
46 | 49 |
47 // Takes/releases the control of the DRM devices. | 50 // Takes/releases the control of the DRM devices. |
48 bool TakeDisplayControl(); | 51 bool TakeDisplayControl(); |
49 bool RelinquishDisplayControl(); | 52 bool RelinquishDisplayControl(); |
50 | 53 |
51 // Called on DRM hotplug events to add/remove a DRM device. | 54 // Called on DRM hotplug events to add/remove a DRM device. |
52 void AddGraphicsDevice(const base::FilePath& path); | 55 void AddGraphicsDevice(const base::FilePath& path, |
| 56 const base::FileDescriptor& fd); |
53 void RemoveGraphicsDevice(const base::FilePath& path); | 57 void RemoveGraphicsDevice(const base::FilePath& path); |
54 | 58 |
55 private: | 59 private: |
56 DisplaySnapshotDri* FindDisplaySnapshot(int64_t id); | 60 DisplaySnapshotDri* FindDisplaySnapshot(int64_t id); |
57 const DisplayModeDri* FindDisplayMode(const gfx::Size& size, | 61 const DisplayModeDri* FindDisplayMode(const gfx::Size& size, |
58 bool is_interlaced, | 62 bool is_interlaced, |
59 float refresh_rate); | 63 float refresh_rate); |
60 | 64 |
61 void RefreshDisplayList(); | 65 void RefreshDisplayList(); |
62 bool Configure(const DisplaySnapshotDri& output, | 66 bool Configure(const DisplaySnapshotDri& output, |
63 const DisplayModeDri* mode, | 67 const DisplayModeDri* mode, |
64 const gfx::Point& origin); | 68 const gfx::Point& origin); |
65 | 69 |
66 bool GetHDCPState(const DisplaySnapshotDri& output, HDCPState* state); | 70 bool GetHDCPState(const DisplaySnapshotDri& output, HDCPState* state); |
67 bool SetHDCPState(const DisplaySnapshotDri& output, HDCPState state); | 71 bool SetHDCPState(const DisplaySnapshotDri& output, HDCPState state); |
68 | 72 |
69 // Notify ScreenManager of all the displays that were present before the | 73 // Notify ScreenManager of all the displays that were present before the |
70 // update but are gone after the update. | 74 // update but are gone after the update. |
71 void NotifyScreenManager( | 75 void NotifyScreenManager( |
72 const std::vector<DisplaySnapshotDri*>& new_displays, | 76 const std::vector<DisplaySnapshotDri*>& new_displays, |
73 const std::vector<DisplaySnapshotDri*>& old_displays) const; | 77 const std::vector<DisplaySnapshotDri*>& old_displays) const; |
74 | 78 |
75 ScreenManager* screen_manager_; // Not owned. | 79 ScreenManager* screen_manager_; // Not owned. |
| 80 scoped_ptr<DrmDeviceGenerator> drm_device_generator_; |
76 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 81 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
77 std::vector<scoped_refptr<DriWrapper>> devices_; | 82 std::vector<scoped_refptr<DriWrapper>> devices_; |
78 // Modes can be shared between different displays, so we need to keep track | 83 // Modes can be shared between different displays, so we need to keep track |
79 // of them independently for cleanup. | 84 // of them independently for cleanup. |
80 ScopedVector<const DisplayMode> cached_modes_; | 85 ScopedVector<const DisplayMode> cached_modes_; |
81 ScopedVector<DisplaySnapshotDri> cached_displays_; | 86 ScopedVector<DisplaySnapshotDri> cached_displays_; |
82 | 87 |
83 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateDri); | 88 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateDri); |
84 }; | 89 }; |
85 | 90 |
86 } // namespace ui | 91 } // namespace ui |
87 | 92 |
88 #endif // UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ | 93 #endif // UI_OZONE_PLATFORM_DRI_NATIVE_DISPLAY_DELEGATE_DRI_H_ |
OLD | NEW |