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_PLANE_MANAGER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_MANAGER_H_ |
6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_MANAGER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_MANAGER_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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // |crtc_id| will be used. |overlay_list| must be sorted bottom-to-top. | 85 // |crtc_id| will be used. |overlay_list| must be sorted bottom-to-top. |
86 virtual bool AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list, | 86 virtual bool AssignOverlayPlanes(HardwareDisplayPlaneList* plane_list, |
87 const OverlayPlaneList& overlay_list, | 87 const OverlayPlaneList& overlay_list, |
88 uint32_t crtc_id, | 88 uint32_t crtc_id, |
89 CrtcController* crtc); | 89 CrtcController* crtc); |
90 | 90 |
91 // Commit the plane states in |plane_list|. | 91 // Commit the plane states in |plane_list|. |
92 virtual bool Commit(HardwareDisplayPlaneList* plane_list, | 92 virtual bool Commit(HardwareDisplayPlaneList* plane_list, |
93 bool test_only) = 0; | 93 bool test_only) = 0; |
94 | 94 |
95 const std::vector<scoped_ptr<HardwareDisplayPlane>>& planes() { | 95 const std::vector<std::unique_ptr<HardwareDisplayPlane>>& planes() { |
96 return planes_; | 96 return planes_; |
97 } | 97 } |
98 | 98 |
99 // Returns all formats which can be scanned out by this PlaneManager. Use | 99 // Returns all formats which can be scanned out by this PlaneManager. Use |
100 // IsFormatSupported to find if a given format is supported on a particular | 100 // IsFormatSupported to find if a given format is supported on a particular |
101 // plane for a given crtc. | 101 // plane for a given crtc. |
102 const std::vector<uint32_t>& GetSupportedFormats() const; | 102 const std::vector<uint32_t>& GetSupportedFormats() const; |
103 bool IsFormatSupported(uint32_t fourcc_format, | 103 bool IsFormatSupported(uint32_t fourcc_format, |
104 uint32_t z_order, | 104 uint32_t z_order, |
105 uint32_t crtc_id) const; | 105 uint32_t crtc_id) const; |
106 | 106 |
107 protected: | 107 protected: |
108 virtual bool SetPlaneData(HardwareDisplayPlaneList* plane_list, | 108 virtual bool SetPlaneData(HardwareDisplayPlaneList* plane_list, |
109 HardwareDisplayPlane* hw_plane, | 109 HardwareDisplayPlane* hw_plane, |
110 const OverlayPlane& overlay, | 110 const OverlayPlane& overlay, |
111 uint32_t crtc_id, | 111 uint32_t crtc_id, |
112 const gfx::Rect& src_rect, | 112 const gfx::Rect& src_rect, |
113 CrtcController* crtc) = 0; | 113 CrtcController* crtc) = 0; |
114 | 114 |
115 virtual scoped_ptr<HardwareDisplayPlane> CreatePlane(uint32_t plane_id, | 115 virtual std::unique_ptr<HardwareDisplayPlane> CreatePlane( |
116 uint32_t possible_crtcs); | 116 uint32_t plane_id, |
| 117 uint32_t possible_crtcs); |
117 | 118 |
118 // Finds the plane located at or after |*index| that is not in use and can | 119 // Finds the plane located at or after |*index| that is not in use and can |
119 // be used with |crtc_index|. | 120 // be used with |crtc_index|. |
120 HardwareDisplayPlane* FindNextUnusedPlane(size_t* index, | 121 HardwareDisplayPlane* FindNextUnusedPlane(size_t* index, |
121 uint32_t crtc_index, | 122 uint32_t crtc_index, |
122 const OverlayPlane& overlay) const; | 123 const OverlayPlane& overlay) const; |
123 | 124 |
124 // Convert |crtc_id| into an index, returning -1 if the ID couldn't be found. | 125 // Convert |crtc_id| into an index, returning -1 if the ID couldn't be found. |
125 int LookupCrtcIndex(uint32_t crtc_id) const; | 126 int LookupCrtcIndex(uint32_t crtc_id) const; |
126 | 127 |
127 // Returns true if |plane| can support |overlay| and compatible with | 128 // Returns true if |plane| can support |overlay| and compatible with |
128 // |crtc_index|. | 129 // |crtc_index|. |
129 bool IsCompatible(HardwareDisplayPlane* plane, | 130 bool IsCompatible(HardwareDisplayPlane* plane, |
130 const OverlayPlane& overlay, | 131 const OverlayPlane& overlay, |
131 uint32_t crtc_index) const; | 132 uint32_t crtc_index) const; |
132 | 133 |
133 void ResetCurrentPlaneList(HardwareDisplayPlaneList* plane_list) const; | 134 void ResetCurrentPlaneList(HardwareDisplayPlaneList* plane_list) const; |
134 | 135 |
135 // Populates scanout formats supported by all planes. | 136 // Populates scanout formats supported by all planes. |
136 void PopulateSupportedFormats(); | 137 void PopulateSupportedFormats(); |
137 | 138 |
138 // Object containing the connection to the graphics device and wraps the API | 139 // Object containing the connection to the graphics device and wraps the API |
139 // calls to control it. Not owned. | 140 // calls to control it. Not owned. |
140 DrmDevice* drm_; | 141 DrmDevice* drm_; |
141 | 142 |
142 std::vector<scoped_ptr<HardwareDisplayPlane>> planes_; | 143 std::vector<std::unique_ptr<HardwareDisplayPlane>> planes_; |
143 std::vector<uint32_t> crtcs_; | 144 std::vector<uint32_t> crtcs_; |
144 std::vector<uint32_t> supported_formats_; | 145 std::vector<uint32_t> supported_formats_; |
145 | 146 |
146 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManager); | 147 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayPlaneManager); |
147 }; | 148 }; |
148 | 149 |
149 } // namespace ui | 150 } // namespace ui |
150 | 151 |
151 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_MANAGER_H_ | 152 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_PLANE_MANAGER_H_ |
OLD | NEW |