| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 public: | 92 public: |
| 93 HardwareDisplayController(scoped_ptr<CrtcController> controller, | 93 HardwareDisplayController(scoped_ptr<CrtcController> controller, |
| 94 const gfx::Point& origin); | 94 const gfx::Point& origin); |
| 95 ~HardwareDisplayController(); | 95 ~HardwareDisplayController(); |
| 96 | 96 |
| 97 // Performs the initial CRTC configuration. If successful, it will display the | 97 // Performs the initial CRTC configuration. If successful, it will display the |
| 98 // framebuffer for |primary| with |mode|. | 98 // framebuffer for |primary| with |mode|. |
| 99 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); | 99 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); |
| 100 | 100 |
| 101 // Performs a CRTC configuration re-using the modes from the CRTCs. |
| 102 bool Enable(const OverlayPlane& primary); |
| 103 |
| 101 // Disables the CRTC. | 104 // Disables the CRTC. |
| 102 void Disable(); | 105 void Disable(); |
| 103 | 106 |
| 104 // Schedules the |overlays|' framebuffers to be displayed on the next vsync | 107 // Schedules the |overlays|' framebuffers to be displayed on the next vsync |
| 105 // event. The event will be posted on the graphics card file descriptor |fd_| | 108 // event. The event will be posted on the graphics card file descriptor |fd_| |
| 106 // and it can be read and processed by |drmHandleEvent|. That function can | 109 // and it can be read and processed by |drmHandleEvent|. That function can |
| 107 // define the callback for the page flip event. A generic data argument will | 110 // define the callback for the page flip event. A generic data argument will |
| 108 // be presented to the callback. We use that argument to pass in the HDCO | 111 // be presented to the callback. We use that argument to pass in the HDCO |
| 109 // object the event belongs to. | 112 // object the event belongs to. |
| 110 // | 113 // |
| (...skipping 29 matching lines...) Expand all Loading... |
| 140 scoped_ptr<CrtcController> RemoveCrtc(const scoped_refptr<DrmDevice>& drm, | 143 scoped_ptr<CrtcController> RemoveCrtc(const scoped_refptr<DrmDevice>& drm, |
| 141 uint32_t crtc); | 144 uint32_t crtc); |
| 142 bool HasCrtc(const scoped_refptr<DrmDevice>& drm, uint32_t crtc) const; | 145 bool HasCrtc(const scoped_refptr<DrmDevice>& drm, uint32_t crtc) const; |
| 143 bool IsMirrored() const; | 146 bool IsMirrored() const; |
| 144 bool IsDisabled() const; | 147 bool IsDisabled() const; |
| 145 gfx::Size GetModeSize() const; | 148 gfx::Size GetModeSize() const; |
| 146 | 149 |
| 147 gfx::Point origin() const { return origin_; } | 150 gfx::Point origin() const { return origin_; } |
| 148 void set_origin(const gfx::Point& origin) { origin_ = origin; } | 151 void set_origin(const gfx::Point& origin) { origin_ = origin; } |
| 149 | 152 |
| 150 const drmModeModeInfo& get_mode() const { return mode_; }; | |
| 151 | |
| 152 uint64_t GetTimeOfLastFlip() const; | 153 uint64_t GetTimeOfLastFlip() const; |
| 153 | 154 |
| 154 const std::vector<CrtcController*>& crtc_controllers() const { | 155 const std::vector<CrtcController*>& crtc_controllers() const { |
| 155 return crtc_controllers_.get(); | 156 return crtc_controllers_.get(); |
| 156 } | 157 } |
| 157 | 158 |
| 158 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; | 159 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; |
| 159 | 160 |
| 160 private: | 161 private: |
| 161 base::ScopedPtrHashMap<DrmDevice*, scoped_ptr<HardwareDisplayPlaneList>> | 162 base::ScopedPtrHashMap<DrmDevice*, scoped_ptr<HardwareDisplayPlaneList>> |
| 162 owned_hardware_planes_; | 163 owned_hardware_planes_; |
| 163 | 164 |
| 164 // Stores the CRTC configuration. This is used to identify monitors and | 165 // Stores the CRTC configuration. This is used to identify monitors and |
| 165 // configure them. | 166 // configure them. |
| 166 ScopedVector<CrtcController> crtc_controllers_; | 167 ScopedVector<CrtcController> crtc_controllers_; |
| 167 | 168 |
| 168 // Location of the controller on the screen. | 169 // Location of the controller on the screen. |
| 169 gfx::Point origin_; | 170 gfx::Point origin_; |
| 170 | 171 |
| 171 // The mode used by the last modesetting operation. | |
| 172 drmModeModeInfo mode_; | |
| 173 | |
| 174 bool is_disabled_; | 172 bool is_disabled_; |
| 175 | 173 |
| 176 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); | 174 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); |
| 177 }; | 175 }; |
| 178 | 176 |
| 179 } // namespace ui | 177 } // namespace ui |
| 180 | 178 |
| 181 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ | 179 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ |
| OLD | NEW |