| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ui/ozone/platform/dri/page_flip_observer.h" | 24 #include "ui/ozone/platform/dri/page_flip_observer.h" |
| 25 | 25 |
| 26 namespace gfx { | 26 namespace gfx { |
| 27 class Point; | 27 class Point; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace ui { | 30 namespace ui { |
| 31 | 31 |
| 32 class CrtcController; | 32 class CrtcController; |
| 33 class ScanoutBuffer; | 33 class ScanoutBuffer; |
| 34 class DriWrapper; | 34 class DrmDevice; |
| 35 | 35 |
| 36 // The HDCOz will handle modesettings and scannout operations for hardware | 36 // The HDCOz will handle modesettings and scannout operations for hardware |
| 37 // devices. | 37 // devices. |
| 38 // | 38 // |
| 39 // In the DRM world there are 3 components that need to be paired up to be able | 39 // In the DRM world there are 3 components that need to be paired up to be able |
| 40 // to display an image to the monitor: CRTC (cathode ray tube controller), | 40 // to display an image to the monitor: CRTC (cathode ray tube controller), |
| 41 // encoder and connector. The CRTC determines which framebuffer to read, when | 41 // encoder and connector. The CRTC determines which framebuffer to read, when |
| 42 // to scanout and where to scanout. Encoders converts the stream from the CRTC | 42 // to scanout and where to scanout. Encoders converts the stream from the CRTC |
| 43 // to the appropriate format for the connector. The connector is the physical | 43 // to the appropriate format for the connector. The connector is the physical |
| 44 // connection that monitors connect to. | 44 // connection that monitors connect to. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 // Set the hardware cursor to show the contents of |surface|. | 128 // Set the hardware cursor to show the contents of |surface|. |
| 129 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); | 129 bool SetCursor(const scoped_refptr<ScanoutBuffer>& buffer); |
| 130 | 130 |
| 131 bool UnsetCursor(); | 131 bool UnsetCursor(); |
| 132 | 132 |
| 133 // Moves the hardware cursor to |location|. | 133 // Moves the hardware cursor to |location|. |
| 134 bool MoveCursor(const gfx::Point& location); | 134 bool MoveCursor(const gfx::Point& location); |
| 135 | 135 |
| 136 void AddCrtc(scoped_ptr<CrtcController> controller); | 136 void AddCrtc(scoped_ptr<CrtcController> controller); |
| 137 scoped_ptr<CrtcController> RemoveCrtc(const scoped_refptr<DriWrapper>& drm, | 137 scoped_ptr<CrtcController> RemoveCrtc(const scoped_refptr<DrmDevice>& drm, |
| 138 uint32_t crtc); | 138 uint32_t crtc); |
| 139 bool HasCrtc(const scoped_refptr<DriWrapper>& drm, uint32_t crtc) const; | 139 bool HasCrtc(const scoped_refptr<DrmDevice>& drm, uint32_t crtc) const; |
| 140 bool IsMirrored() const; | 140 bool IsMirrored() const; |
| 141 bool IsDisabled() const; | 141 bool IsDisabled() const; |
| 142 gfx::Size GetModeSize() const; | 142 gfx::Size GetModeSize() const; |
| 143 | 143 |
| 144 gfx::Point origin() const { return origin_; } | 144 gfx::Point origin() const { return origin_; } |
| 145 void set_origin(const gfx::Point& origin) { origin_ = origin; } | 145 void set_origin(const gfx::Point& origin) { origin_ = origin; } |
| 146 | 146 |
| 147 const drmModeModeInfo& get_mode() const { return mode_; }; | 147 const drmModeModeInfo& get_mode() const { return mode_; }; |
| 148 | 148 |
| 149 uint64_t GetTimeOfLastFlip() const; | 149 uint64_t GetTimeOfLastFlip() const; |
| 150 | 150 |
| 151 const std::vector<CrtcController*>& crtc_controllers() const { | 151 const std::vector<CrtcController*>& crtc_controllers() const { |
| 152 return crtc_controllers_.get(); | 152 return crtc_controllers_.get(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 scoped_refptr<DriWrapper> GetAllocationDriWrapper() const; | 155 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 // Returns true if any of the CRTCs is waiting for a page flip. | 158 // Returns true if any of the CRTCs is waiting for a page flip. |
| 159 bool HasPendingPageFlips() const; | 159 bool HasPendingPageFlips() const; |
| 160 | 160 |
| 161 bool ActualSchedulePageFlip(); | 161 bool ActualSchedulePageFlip(); |
| 162 | 162 |
| 163 void ProcessPageFlipRequest(); | 163 void ProcessPageFlipRequest(); |
| 164 | 164 |
| 165 void ClearPendingRequests(); | 165 void ClearPendingRequests(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 178 base::Closure callback; | 178 base::Closure callback; |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 // Buffers need to be declared first so that they are destroyed last. Needed | 181 // Buffers need to be declared first so that they are destroyed last. Needed |
| 182 // since the controllers may reference the buffers. | 182 // since the controllers may reference the buffers. |
| 183 OverlayPlaneList current_planes_; | 183 OverlayPlaneList current_planes_; |
| 184 OverlayPlaneList pending_planes_; | 184 OverlayPlaneList pending_planes_; |
| 185 std::deque<PageFlipRequest> requests_; | 185 std::deque<PageFlipRequest> requests_; |
| 186 scoped_refptr<ScanoutBuffer> cursor_buffer_; | 186 scoped_refptr<ScanoutBuffer> cursor_buffer_; |
| 187 | 187 |
| 188 base::ScopedPtrHashMap<DriWrapper*, HardwareDisplayPlaneList> | 188 base::ScopedPtrHashMap<DrmDevice*, HardwareDisplayPlaneList> |
| 189 owned_hardware_planes_; | 189 owned_hardware_planes_; |
| 190 | 190 |
| 191 // Stores the CRTC configuration. This is used to identify monitors and | 191 // Stores the CRTC configuration. This is used to identify monitors and |
| 192 // configure them. | 192 // configure them. |
| 193 ScopedVector<CrtcController> crtc_controllers_; | 193 ScopedVector<CrtcController> crtc_controllers_; |
| 194 | 194 |
| 195 // Location of the controller on the screen. | 195 // Location of the controller on the screen. |
| 196 gfx::Point origin_; | 196 gfx::Point origin_; |
| 197 | 197 |
| 198 // The mode used by the last modesetting operation. | 198 // The mode used by the last modesetting operation. |
| 199 drmModeModeInfo mode_; | 199 drmModeModeInfo mode_; |
| 200 | 200 |
| 201 bool is_disabled_; | 201 bool is_disabled_; |
| 202 | 202 |
| 203 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); | 203 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 } // namespace ui | 206 } // namespace ui |
| 207 | 207 |
| 208 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ | 208 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ |
| OLD | NEW |