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_HARDWARE_DISPLAY_CONTROLLER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ |
6 #define UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <xf86drmMode.h> | 10 #include <xf86drmMode.h> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // framebuffer for |primary| with |mode|. | 113 // framebuffer for |primary| with |mode|. |
114 bool Modeset(const OverlayPlane& primary, | 114 bool Modeset(const OverlayPlane& primary, |
115 drmModeModeInfo mode); | 115 drmModeModeInfo mode); |
116 | 116 |
117 // Reconfigures the CRTC with the current surface and mode. | 117 // Reconfigures the CRTC with the current surface and mode. |
118 bool Enable(); | 118 bool Enable(); |
119 | 119 |
120 // Disables the CRTC. | 120 // Disables the CRTC. |
121 void Disable(); | 121 void Disable(); |
122 | 122 |
123 void QueueOverlayPlane(const OverlayPlane& plane); | |
124 | |
125 // Schedules the |overlays|' framebuffers to be displayed on the next vsync | 123 // Schedules the |overlays|' framebuffers to be displayed on the next vsync |
126 // event. The event will be posted on the graphics card file descriptor |fd_| | 124 // event. The event will be posted on the graphics card file descriptor |fd_| |
127 // and it can be read and processed by |drmHandleEvent|. That function can | 125 // and it can be read and processed by |drmHandleEvent|. That function can |
128 // define the callback for the page flip event. A generic data argument will | 126 // define the callback for the page flip event. A generic data argument will |
129 // be presented to the callback. We use that argument to pass in the HDCO | 127 // be presented to the callback. We use that argument to pass in the HDCO |
130 // object the event belongs to. | 128 // object the event belongs to. |
131 // | 129 // |
132 // Between this call and the callback, the framebuffers used in this call | 130 // Between this call and the callback, the framebuffers used in this call |
133 // should not be modified in any way as it would cause screen tearing if the | 131 // should not be modified in any way as it would cause screen tearing if the |
134 // hardware performed the flip. Note that the frontbuffer should also not | 132 // hardware performed the flip. Note that the frontbuffer should also not |
135 // be modified as it could still be displayed. | 133 // be modified as it could still be displayed. |
136 // | 134 // |
137 // Note that this function does not block. Also, this function should not be | 135 // Note that this function does not block. Also, this function should not be |
138 // called again before the page flip occurrs. | 136 // called again before the page flip occurrs. |
139 // | 137 // |
140 // Returns true if the page flip was successfully registered, false otherwise. | 138 // Returns true if the page flip was successfully registered, false otherwise. |
141 bool SchedulePageFlip(); | 139 bool SchedulePageFlip(const OverlayPlaneList& overlays); |
142 | 140 |
143 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have | 141 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have |
144 // BeginFrame can be triggered explicitly by Ozone. | 142 // BeginFrame can be triggered explicitly by Ozone. |
145 void WaitForPageFlipEvent(); | 143 void WaitForPageFlipEvent(); |
146 | 144 |
147 // Called when the page flip event occurred. The event is provided by the | 145 // Called when the page flip event occurred. The event is provided by the |
148 // kernel when a VBlank event finished. This allows the controller to | 146 // kernel when a VBlank event finished. This allows the controller to |
149 // update internal state and propagate the update to the surface. | 147 // update internal state and propagate the update to the surface. |
150 // The tuple (seconds, useconds) represents the event timestamp. |seconds| | 148 // The tuple (seconds, useconds) represents the event timestamp. |seconds| |
151 // represents the number of seconds while |useconds| represents the | 149 // represents the number of seconds while |useconds| represents the |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // 2) decremented when the page flip callback is triggered, | 206 // 2) decremented when the page flip callback is triggered, |
209 // 3) reset to 0 when a drmModeSetCrtc is called (via the DriWrapper). | 207 // 3) reset to 0 when a drmModeSetCrtc is called (via the DriWrapper). |
210 uint32_t pending_page_flips_; | 208 uint32_t pending_page_flips_; |
211 | 209 |
212 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); | 210 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); |
213 }; | 211 }; |
214 | 212 |
215 } // namespace ui | 213 } // namespace ui |
216 | 214 |
217 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ | 215 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ |
OLD | NEW |