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