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> |
11 #include <deque> | 11 #include <deque> |
12 #include <map> | 12 #include <map> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/containers/scoped_ptr_hash_map.h" | 17 #include "base/containers/scoped_ptr_hash_map.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/memory/scoped_vector.h" | 19 #include "base/memory/scoped_vector.h" |
| 20 #include "ui/gfx/swap_result.h" |
20 #include "ui/ozone/ozone_export.h" | 21 #include "ui/ozone/ozone_export.h" |
21 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" | 22 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" |
22 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" | 23 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" |
23 | 24 |
24 namespace gfx { | 25 namespace gfx { |
25 class Point; | 26 class Point; |
26 } | 27 } |
27 | 28 |
28 namespace ui { | 29 namespace ui { |
29 | 30 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // | | | 80 // | | |
80 // ---------------------- | 81 // ---------------------- |
81 // | CRTC1 | | 82 // | CRTC1 | |
82 // ---------------------- | 83 // ---------------------- |
83 // | 84 // |
84 // Note that it is possible to have more connectors than CRTCs which means that | 85 // Note that it is possible to have more connectors than CRTCs which means that |
85 // only a subset of connectors can be active independently, showing different | 86 // only a subset of connectors can be active independently, showing different |
86 // framebuffers. Though, in this case, it would be possible to have all | 87 // framebuffers. Though, in this case, it would be possible to have all |
87 // connectors active if some use the same CRTC to mirror the display. | 88 // connectors active if some use the same CRTC to mirror the display. |
88 class OZONE_EXPORT HardwareDisplayController { | 89 class OZONE_EXPORT HardwareDisplayController { |
| 90 typedef base::Callback<void(gfx::SwapResult)> PageFlipCallback; |
| 91 |
89 public: | 92 public: |
90 explicit HardwareDisplayController(scoped_ptr<CrtcController> controller); | 93 explicit HardwareDisplayController(scoped_ptr<CrtcController> controller); |
91 ~HardwareDisplayController(); | 94 ~HardwareDisplayController(); |
92 | 95 |
93 // Performs the initial CRTC configuration. If successful, it will display the | 96 // Performs the initial CRTC configuration. If successful, it will display the |
94 // framebuffer for |primary| with |mode|. | 97 // framebuffer for |primary| with |mode|. |
95 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); | 98 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); |
96 | 99 |
97 // Disables the CRTC. | 100 // Disables the CRTC. |
98 void Disable(); | 101 void Disable(); |
99 | 102 |
100 // Schedules the |overlays|' framebuffers to be displayed on the next vsync | 103 // Schedules the |overlays|' framebuffers to be displayed on the next vsync |
101 // event. The event will be posted on the graphics card file descriptor |fd_| | 104 // event. The event will be posted on the graphics card file descriptor |fd_| |
102 // and it can be read and processed by |drmHandleEvent|. That function can | 105 // and it can be read and processed by |drmHandleEvent|. That function can |
103 // define the callback for the page flip event. A generic data argument will | 106 // define the callback for the page flip event. A generic data argument will |
104 // be presented to the callback. We use that argument to pass in the HDCO | 107 // be presented to the callback. We use that argument to pass in the HDCO |
105 // object the event belongs to. | 108 // object the event belongs to. |
106 // | 109 // |
107 // Between this call and the callback, the framebuffers used in this call | 110 // Between this call and the callback, the framebuffers used in this call |
108 // should not be modified in any way as it would cause screen tearing if the | 111 // should not be modified in any way as it would cause screen tearing if the |
109 // hardware performed the flip. Note that the frontbuffer should also not | 112 // hardware performed the flip. Note that the frontbuffer should also not |
110 // be modified as it could still be displayed. | 113 // be modified as it could still be displayed. |
111 // | 114 // |
112 // Note that this function does not block. Also, this function should not be | 115 // Note that this function does not block. Also, this function should not be |
113 // called again before the page flip occurrs. | 116 // called again before the page flip occurrs. |
114 // | 117 // |
115 // Returns true if the page flip was successfully registered, false otherwise. | 118 // Returns true if the page flip was successfully registered, false otherwise. |
116 bool SchedulePageFlip(const OverlayPlaneList& plane_list, | 119 bool SchedulePageFlip(const OverlayPlaneList& plane_list, |
117 bool is_sync, | 120 bool is_sync, |
118 const base::Closure& callback); | 121 const PageFlipCallback& callback); |
119 | 122 |
120 // Set the hardware cursor to show the contents of |surface|. | 123 // Set the hardware cursor to show the contents of |surface|. |
121 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); | 124 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); |
122 | 125 |
123 bool UnsetCursor(); | 126 bool UnsetCursor(); |
124 | 127 |
125 // Moves the hardware cursor to |location|. | 128 // Moves the hardware cursor to |location|. |
126 bool MoveCursor(const gfx::Point& location); | 129 bool MoveCursor(const gfx::Point& location); |
127 | 130 |
128 void AddCrtc(scoped_ptr<CrtcController> controller); | 131 void AddCrtc(scoped_ptr<CrtcController> controller); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 drmModeModeInfo mode_; | 164 drmModeModeInfo mode_; |
162 | 165 |
163 bool is_disabled_; | 166 bool is_disabled_; |
164 | 167 |
165 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); | 168 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); |
166 }; | 169 }; |
167 | 170 |
168 } // namespace ui | 171 } // namespace ui |
169 | 172 |
170 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 173 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
OLD | NEW |