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