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_HARDWARE_DISPLAY_CONTROLLER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // | CRTC1 | | 83 // | CRTC1 | |
84 // ---------------------- | 84 // ---------------------- |
85 // | 85 // |
86 // Note that it is possible to have more connectors than CRTCs which means that | 86 // Note that it is possible to have more connectors than CRTCs which means that |
87 // only a subset of connectors can be active independently, showing different | 87 // only a subset of connectors can be active independently, showing different |
88 // framebuffers. Though, in this case, it would be possible to have all | 88 // framebuffers. Though, in this case, it would be possible to have all |
89 // connectors active if some use the same CRTC to mirror the display. | 89 // connectors active if some use the same CRTC to mirror the display. |
90 class OZONE_EXPORT HardwareDisplayController | 90 class OZONE_EXPORT HardwareDisplayController |
91 : public base::SupportsWeakPtr<HardwareDisplayController>, | 91 : public base::SupportsWeakPtr<HardwareDisplayController>, |
92 public PageFlipObserver { | 92 public PageFlipObserver { |
| 93 typedef base::Callback<void(int)> PageFlipCallback; |
| 94 |
93 public: | 95 public: |
94 explicit HardwareDisplayController(scoped_ptr<CrtcController> controller); | 96 explicit HardwareDisplayController(scoped_ptr<CrtcController> controller); |
95 ~HardwareDisplayController() override; | 97 ~HardwareDisplayController() override; |
96 | 98 |
97 // Performs the initial CRTC configuration. If successful, it will display the | 99 // Performs the initial CRTC configuration. If successful, it will display the |
98 // framebuffer for |primary| with |mode|. | 100 // framebuffer for |primary| with |mode|. |
99 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); | 101 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); |
100 | 102 |
101 // Reconfigures the CRTC with the current surface and mode. | 103 // Reconfigures the CRTC with the current surface and mode. |
102 bool Enable(); | 104 bool Enable(); |
(...skipping 12 matching lines...) Expand all Loading... |
115 // | 117 // |
116 // Between this call and the callback, the framebuffers used in this call | 118 // Between this call and the callback, the framebuffers used in this call |
117 // should not be modified in any way as it would cause screen tearing if the | 119 // should not be modified in any way as it would cause screen tearing if the |
118 // hardware performed the flip. Note that the frontbuffer should also not | 120 // hardware performed the flip. Note that the frontbuffer should also not |
119 // be modified as it could still be displayed. | 121 // be modified as it could still be displayed. |
120 // | 122 // |
121 // Note that this function does not block. Also, this function should not be | 123 // Note that this function does not block. Also, this function should not be |
122 // called again before the page flip occurrs. | 124 // called again before the page flip occurrs. |
123 // | 125 // |
124 // Returns true if the page flip was successfully registered, false otherwise. | 126 // Returns true if the page flip was successfully registered, false otherwise. |
125 bool SchedulePageFlip(bool is_sync, const base::Closure& callback); | 127 bool SchedulePageFlip(bool is_sync, const PageFlipCallback& callback); |
| 128 bool SchedulePageFlipWithoutCallback(bool is_sync); |
126 | 129 |
127 // Set the hardware cursor to show the contents of |surface|. | 130 // Set the hardware cursor to show the contents of |surface|. |
128 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); | 131 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); |
129 | 132 |
130 bool UnsetCursor(); | 133 bool UnsetCursor(); |
131 | 134 |
132 // Moves the hardware cursor to |location|. | 135 // Moves the hardware cursor to |location|. |
133 bool MoveCursor(const gfx::Point& location); | 136 bool MoveCursor(const gfx::Point& location); |
134 | 137 |
135 void AddCrtc(scoped_ptr<CrtcController> controller); | 138 void AddCrtc(scoped_ptr<CrtcController> controller); |
(...skipping 26 matching lines...) Expand all Loading... |
162 void ProcessPageFlipRequest(); | 165 void ProcessPageFlipRequest(); |
163 | 166 |
164 void ClearPendingRequests(); | 167 void ClearPendingRequests(); |
165 | 168 |
166 // PageFlipObserver: | 169 // PageFlipObserver: |
167 void OnPageFlipEvent() override; | 170 void OnPageFlipEvent() override; |
168 | 171 |
169 struct PageFlipRequest { | 172 struct PageFlipRequest { |
170 PageFlipRequest(const OverlayPlaneList& planes, | 173 PageFlipRequest(const OverlayPlaneList& planes, |
171 bool is_sync, | 174 bool is_sync, |
172 const base::Closure& callback); | 175 const PageFlipCallback& callback); |
173 ~PageFlipRequest(); | 176 ~PageFlipRequest(); |
174 | 177 |
175 OverlayPlaneList planes; | 178 OverlayPlaneList planes; |
176 bool is_sync; | 179 bool is_sync; |
177 base::Closure callback; | 180 PageFlipCallback callback; |
178 }; | 181 }; |
179 | 182 |
180 // Buffers need to be declared first so that they are destroyed last. Needed | 183 // Buffers need to be declared first so that they are destroyed last. Needed |
181 // since the controllers may reference the buffers. | 184 // since the controllers may reference the buffers. |
182 OverlayPlaneList current_planes_; | 185 OverlayPlaneList current_planes_; |
183 // Planes currently being queued without having SchedulePageFlip() called. | 186 // Planes currently being queued without having SchedulePageFlip() called. |
184 OverlayPlaneList pending_planes_; | 187 OverlayPlaneList pending_planes_; |
185 // Plane lists for which SchedulePageFlip() was called. They are waiting for | 188 // Plane lists for which SchedulePageFlip() was called. They are waiting for |
186 // previous page flip events to be completed before they can be serviced. | 189 // previous page flip events to be completed before they can be serviced. |
187 std::deque<PageFlipRequest> requests_; | 190 std::deque<PageFlipRequest> requests_; |
(...skipping 13 matching lines...) Expand all Loading... |
201 drmModeModeInfo mode_; | 204 drmModeModeInfo mode_; |
202 | 205 |
203 bool is_disabled_; | 206 bool is_disabled_; |
204 | 207 |
205 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); | 208 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); |
206 }; | 209 }; |
207 | 210 |
208 } // namespace ui | 211 } // namespace ui |
209 | 212 |
210 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 213 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
OLD | NEW |