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" | 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 FilePath; | 14 class FilePath; |
15 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
16 struct FileDescriptor; | 16 struct FileDescriptor; |
17 } | 17 } |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 class DeviceManager; | 21 class DeviceManager; |
22 class DisplayMode; | 22 class DisplayMode; |
23 class DrmDevice; | 23 class DrmDevice; |
24 class DrmDeviceGenerator; | 24 class DrmDeviceGenerator; |
25 class DrmDisplaySnapshot; | 25 class DrmDisplaySnapshot; |
26 class DrmDisplayMode; | 26 class DrmDisplayMode; |
27 class ScreenManager; | 27 class ScreenManager; |
28 | 28 |
| 29 struct GammaRampRGBEntry; |
| 30 |
29 class DrmGpuDisplayManager { | 31 class DrmGpuDisplayManager { |
30 public: | 32 public: |
31 DrmGpuDisplayManager(ScreenManager* screen_manager, | 33 DrmGpuDisplayManager(ScreenManager* screen_manager, |
32 const scoped_refptr<DrmDevice>& primary_device, | 34 const scoped_refptr<DrmDevice>& primary_device, |
33 scoped_ptr<DrmDeviceGenerator> device_generator); | 35 scoped_ptr<DrmDeviceGenerator> device_generator); |
34 ~DrmGpuDisplayManager(); | 36 ~DrmGpuDisplayManager(); |
35 | 37 |
36 void InitializeIOTaskRunner( | 38 void InitializeIOTaskRunner( |
37 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
38 | 40 |
39 // 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 |
40 // displays is refreshed. | 42 // displays is refreshed. |
41 std::vector<DisplaySnapshot_Params> GetDisplays(); | 43 std::vector<DisplaySnapshot_Params> GetDisplays(); |
42 | 44 |
43 bool ConfigureDisplay(int64_t id, | 45 bool ConfigureDisplay(int64_t id, |
44 const DisplayMode_Params& mode, | 46 const DisplayMode_Params& mode, |
45 const gfx::Point& origin); | 47 const gfx::Point& origin); |
46 bool DisableDisplay(int64_t id); | 48 bool DisableDisplay(int64_t id); |
47 | 49 |
48 // Takes/releases the control of the DRM devices. | 50 // Takes/releases the control of the DRM devices. |
49 bool TakeDisplayControl(); | 51 bool TakeDisplayControl(); |
50 bool RelinquishDisplayControl(); | 52 bool RelinquishDisplayControl(); |
51 | 53 |
52 // Called on DRM hotplug events to add/remove a DRM device. | 54 // Called on DRM hotplug events to add/remove a DRM device. |
53 void AddGraphicsDevice(const base::FilePath& path, | 55 void AddGraphicsDevice(const base::FilePath& path, |
54 const base::FileDescriptor& fd); | 56 const base::FileDescriptor& fd); |
55 void RemoveGraphicsDevice(const base::FilePath& path); | 57 void RemoveGraphicsDevice(const base::FilePath& path); |
56 | 58 |
| 59 // Set the gamma ramp for a particular display id. |
| 60 void SetGammaRamp(int64_t id, const std::vector<GammaRampRGBEntry>& lut); |
| 61 |
57 private: | 62 private: |
58 DrmDisplaySnapshot* FindDisplaySnapshot(int64_t id); | 63 DrmDisplaySnapshot* FindDisplaySnapshot(int64_t id); |
59 const DrmDisplayMode* FindDisplayMode(const gfx::Size& size, | 64 const DrmDisplayMode* FindDisplayMode(const gfx::Size& size, |
60 bool is_interlaced, | 65 bool is_interlaced, |
61 float refresh_rate); | 66 float refresh_rate); |
62 | 67 |
63 void RefreshDisplayList(); | 68 void RefreshDisplayList(); |
64 bool Configure(const DrmDisplaySnapshot& output, | 69 bool Configure(const DrmDisplaySnapshot& output, |
65 const DrmDisplayMode* mode, | 70 const DrmDisplayMode* mode, |
66 const gfx::Point& origin); | 71 const gfx::Point& origin); |
(...skipping 15 matching lines...) Expand all Loading... |
82 // of them independently for cleanup. | 87 // of them independently for cleanup. |
83 ScopedVector<const DisplayMode> cached_modes_; | 88 ScopedVector<const DisplayMode> cached_modes_; |
84 ScopedVector<DrmDisplaySnapshot> cached_displays_; | 89 ScopedVector<DrmDisplaySnapshot> cached_displays_; |
85 | 90 |
86 DISALLOW_COPY_AND_ASSIGN(DrmGpuDisplayManager); | 91 DISALLOW_COPY_AND_ASSIGN(DrmGpuDisplayManager); |
87 }; | 92 }; |
88 | 93 |
89 } // namespace ui | 94 } // namespace ui |
90 | 95 |
91 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_DISPLAY_MANAGER_H_ | 96 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_GPU_DISPLAY_MANAGER_H_ |
OLD | NEW |