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_DRI_WRAPPER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_WRAPPER_H_ |
6 #define UI_OZONE_PLATFORM_DRI_DRI_WRAPPER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_DRI_WRAPPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Wraps DRM calls into a nice interface. Used to provide different | 31 // Wraps DRM calls into a nice interface. Used to provide different |
32 // implementations of the DRM calls. For the actual implementation the DRM API | 32 // implementations of the DRM calls. For the actual implementation the DRM API |
33 // would be called. In unit tests this interface would be stubbed. | 33 // would be called. In unit tests this interface would be stubbed. |
34 class DriWrapper { | 34 class DriWrapper { |
35 public: | 35 public: |
36 typedef base::Callback<void(unsigned int /* frame */, | 36 typedef base::Callback<void(unsigned int /* frame */, |
37 unsigned int /* seconds */, | 37 unsigned int /* seconds */, |
38 unsigned int /* useconds */)> PageFlipCallback; | 38 unsigned int /* useconds */)> PageFlipCallback; |
39 | 39 |
40 DriWrapper(const char* device_path, bool software_mode); | 40 DriWrapper(const char* device_path, bool use_sync_flips); |
41 virtual ~DriWrapper(); | 41 virtual ~DriWrapper(); |
42 | 42 |
43 // Open device. | 43 // Open device. |
44 virtual void Initialize(); | 44 virtual void Initialize(); |
45 | 45 |
46 // Get the CRTC state. This is generally used to save state before using the | 46 // Get the CRTC state. This is generally used to save state before using the |
47 // CRTC. When the user finishes using the CRTC, the user should restore the | 47 // CRTC. When the user finishes using the CRTC, the user should restore the |
48 // CRTC to it's initial state. Use |SetCrtc| to restore the state. | 48 // CRTC to it's initial state. Use |SetCrtc| to restore the state. |
49 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id); | 49 virtual ScopedDrmCrtcPtr GetCrtc(uint32_t crtc_id); |
50 | 50 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // after the sandbox is up, thus the late initialization. | 156 // after the sandbox is up, thus the late initialization. |
157 virtual void InitializeIOWatcher(); | 157 virtual void InitializeIOWatcher(); |
158 | 158 |
159 // The file descriptor associated with this wrapper. All DRM operations will | 159 // The file descriptor associated with this wrapper. All DRM operations will |
160 // be performed using this FD. | 160 // be performed using this FD. |
161 // TODO(dnicoara) Make this a base::File | 161 // TODO(dnicoara) Make this a base::File |
162 int fd_; | 162 int fd_; |
163 | 163 |
164 scoped_ptr<HardwareDisplayPlaneManager> plane_manager_; | 164 scoped_ptr<HardwareDisplayPlaneManager> plane_manager_; |
165 | 165 |
166 // If we're running in software mode this is true. In software mode we can't | 166 // If we need to block when performing page flips this is set to true. |
167 // use the async page flip callbacks, so we need to block until the kernel | 167 bool use_sync_flips_; |
168 // responds to the page flip. | |
169 bool software_mode_; | |
170 | 168 |
171 private: | 169 private: |
172 class IOWatcher; | 170 class IOWatcher; |
173 | 171 |
174 // Path to DRM device. | 172 // Path to DRM device. |
175 const char* device_path_; | 173 const char* device_path_; |
176 | 174 |
177 // Helper thread to perform IO listener operations. | 175 // Helper thread to perform IO listener operations. |
178 // TODO(dnicoara) This should really be supported by the main thread. | 176 // TODO(dnicoara) This should really be supported by the main thread. |
179 // Alternatively we should have a way to access the IO thread's task runner. | 177 // Alternatively we should have a way to access the IO thread's task runner. |
180 base::Thread io_thread_; | 178 base::Thread io_thread_; |
181 | 179 |
182 // Watcher for |fd_| listening for page flip events. | 180 // Watcher for |fd_| listening for page flip events. |
183 scoped_refptr<IOWatcher> watcher_; | 181 scoped_refptr<IOWatcher> watcher_; |
184 | 182 |
185 DISALLOW_COPY_AND_ASSIGN(DriWrapper); | 183 DISALLOW_COPY_AND_ASSIGN(DriWrapper); |
186 }; | 184 }; |
187 | 185 |
188 } // namespace ui | 186 } // namespace ui |
189 | 187 |
190 #endif // UI_OZONE_PLATFORM_DRI_DRI_WRAPPER_H_ | 188 #endif // UI_OZONE_PLATFORM_DRI_DRI_WRAPPER_H_ |
OLD | NEW |