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_CRTC_CONTROLLER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_CRTC_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 | 11 |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "ui/gfx/swap_result.h" | |
14 #include "ui/ozone/ozone_export.h" | 15 #include "ui/ozone/ozone_export.h" |
15 #include "ui/ozone/platform/drm/common/scoped_drm_types.h" | 16 #include "ui/ozone/platform/drm/common/scoped_drm_types.h" |
16 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" | 17 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" |
17 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" | 18 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" |
18 | 19 |
19 namespace ui { | 20 namespace ui { |
20 | 21 |
21 class DrmDevice; | 22 class DrmDevice; |
22 class PageFlipRequest; | 23 class PageFlipRequest; |
23 | 24 |
(...skipping 27 matching lines...) Expand all Loading... | |
51 // Schedule a page flip event and present the overlays in |planes|. | 52 // Schedule a page flip event and present the overlays in |planes|. |
52 bool SchedulePageFlip(HardwareDisplayPlaneList* plane_list, | 53 bool SchedulePageFlip(HardwareDisplayPlaneList* plane_list, |
53 const OverlayPlaneList& planes, | 54 const OverlayPlaneList& planes, |
54 bool test_only, | 55 bool test_only, |
55 scoped_refptr<PageFlipRequest> page_flip_request); | 56 scoped_refptr<PageFlipRequest> page_flip_request); |
56 | 57 |
57 // Returns list of plane id's which can support |plane| configuration. | 58 // Returns list of plane id's which can support |plane| configuration. |
58 std::vector<uint32_t> GetCompatibleHardwarePlaneIds( | 59 std::vector<uint32_t> GetCompatibleHardwarePlaneIds( |
59 const OverlayPlane& plane) const; | 60 const OverlayPlane& plane) const; |
60 | 61 |
61 // Called if the page flip for this CRTC fails after being scheduled. | 62 // Called if the page flip event wasn't scheduled and will never be. This will |
spang
2015/10/30 20:27:02
Update comment.
dnicoara
2015/11/02 17:04:03
Done.
| |
62 void PageFlipFailed(); | 63 // then signal the request such that the caller doesn't wait for the event |
64 // forever. | |
65 void SignalPageFlipRequest(gfx::SwapResult result); | |
63 | 66 |
64 // Called when the page flip event occurred. The event is provided by the | 67 // Called when the page flip event occurred. The event is provided by the |
65 // kernel when a VBlank event finished. This allows the controller to | 68 // kernel when a VBlank event finished. This allows the controller to |
66 // update internal state and propagate the update to the surface. | 69 // update internal state and propagate the update to the surface. |
67 // The tuple (seconds, useconds) represents the event timestamp. |seconds| | 70 // The tuple (seconds, useconds) represents the event timestamp. |seconds| |
68 // represents the number of seconds while |useconds| represents the | 71 // represents the number of seconds while |useconds| represents the |
69 // microseconds (< 1 second) in the timestamp. | 72 // microseconds (< 1 second) in the timestamp. |
70 void OnPageFlipEvent(unsigned int frame, | 73 void OnPageFlipEvent(unsigned int frame, |
71 unsigned int seconds, | 74 unsigned int seconds, |
72 unsigned int useconds); | 75 unsigned int useconds); |
73 | 76 |
74 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); | 77 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); |
75 bool MoveCursor(const gfx::Point& location); | 78 bool MoveCursor(const gfx::Point& location); |
76 | 79 |
77 private: | 80 private: |
78 bool ResetCursor(); | 81 bool ResetCursor(); |
79 | 82 |
80 void SignalPageFlipRequest(); | |
81 | |
82 scoped_refptr<DrmDevice> drm_; | 83 scoped_refptr<DrmDevice> drm_; |
83 | 84 |
84 // Buffers need to be declared first so that they are destroyed last. Needed | 85 // Buffers need to be declared first so that they are destroyed last. Needed |
85 // since the controllers may reference the buffers. | 86 // since the controllers may reference the buffers. |
86 OverlayPlaneList current_planes_; | 87 OverlayPlaneList current_planes_; |
87 OverlayPlaneList pending_planes_; | 88 OverlayPlaneList pending_planes_; |
88 scoped_refptr<ScanoutBuffer> cursor_buffer_; | 89 scoped_refptr<ScanoutBuffer> cursor_buffer_; |
89 scoped_refptr<PageFlipRequest> page_flip_request_; | 90 scoped_refptr<PageFlipRequest> page_flip_request_; |
90 | 91 |
91 uint32_t crtc_; | 92 uint32_t crtc_; |
92 | 93 |
93 // TODO(dnicoara) Add support for hardware mirroring (multiple connectors). | 94 // TODO(dnicoara) Add support for hardware mirroring (multiple connectors). |
94 uint32_t connector_; | 95 uint32_t connector_; |
95 | 96 |
96 drmModeModeInfo mode_; | 97 drmModeModeInfo mode_; |
97 | 98 |
98 // Keeps track of the CRTC state. If a surface has been bound, then the value | 99 // Keeps track of the CRTC state. If a surface has been bound, then the value |
99 // is set to false. Otherwise it is true. | 100 // is set to false. Otherwise it is true. |
100 bool is_disabled_ = true; | 101 bool is_disabled_ = true; |
101 | 102 |
102 // The time of the last page flip event as reported by the kernel callback. | 103 // The time of the last page flip event as reported by the kernel callback. |
103 uint64_t time_of_last_flip_ = 0; | 104 uint64_t time_of_last_flip_ = 0; |
104 | 105 |
105 DISALLOW_COPY_AND_ASSIGN(CrtcController); | 106 DISALLOW_COPY_AND_ASSIGN(CrtcController); |
106 }; | 107 }; |
107 | 108 |
108 } // namespace ui | 109 } // namespace ui |
109 | 110 |
110 #endif // UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_ | 111 #endif // UI_OZONE_PLATFORM_DRM_GPU_CRTC_CONTROLLER_H_ |
OLD | NEW |