Chromium Code Reviews| 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 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 5 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
| 6 | 6 |
| 7 #include <drm.h> | 7 #include <drm.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <xf86drm.h> | 10 #include <xf86drm.h> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 } | 105 } |
| 106 | 106 |
| 107 return true; | 107 return true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void HardwareDisplayController::Disable() { | 110 void HardwareDisplayController::Disable() { |
| 111 drm_->SetCrtc(crtc_id_, 0, 0, NULL); | 111 drm_->SetCrtc(crtc_id_, 0, 0, NULL); |
| 112 is_disabled_ = true; | 112 is_disabled_ = true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool HardwareDisplayController::SchedulePageFlip() { | 115 ScanoutSurface* HardwareDisplayController::AssignOverlayPlanes( |
| 116 CHECK(surface_); | 116 std::vector<OzoneOverlayPlane>* overlays) { |
| 117 if (!is_disabled_ && !drm_->PageFlip(crtc_id_, | 117 ScanoutSurface* primary = surface_.get(); |
|
dnicoara
2014/07/07 19:17:54
It seems that surface is going to be ignored. Can
achaulk
2014/07/07 20:18:04
It can't be *directly* replaced since HDC owns the
| |
| 118 surface_->GetFramebufferId(), | 118 if (!overlays) |
| 119 this)) { | 119 return primary; |
| 120 for (size_t i = 0; i < overlays->size(); i++) { | |
| 121 const OzoneOverlayPlane& plane = (*overlays)[i]; | |
| 122 if (plane.z_order == 0) { | |
| 123 primary = plane.scanout; | |
| 124 } else { | |
| 125 // TODO: assign overlay planes. | |
| 126 } | |
| 127 } | |
| 128 | |
| 129 return primary; | |
| 130 } | |
| 131 | |
| 132 bool HardwareDisplayController::SchedulePageFlip( | |
| 133 std::vector<OzoneOverlayPlane>* overlays) { | |
| 134 ScanoutSurface* primary = AssignOverlayPlanes(overlays); | |
| 135 CHECK(primary); | |
| 136 | |
| 137 primary->PreSwapBuffers(); | |
| 138 | |
| 139 if (!is_disabled_ && | |
| 140 !drm_->PageFlip(crtc_id_, primary->GetFramebufferId(), this)) { | |
| 120 LOG(ERROR) << "Cannot page flip: " << strerror(errno); | 141 LOG(ERROR) << "Cannot page flip: " << strerror(errno); |
| 121 return false; | 142 return false; |
| 122 } | 143 } |
| 123 | 144 |
| 145 if (overlays) { | |
| 146 for (size_t i = 0; i < overlays->size(); i++) { | |
| 147 const OzoneOverlayPlane& plane = (*overlays)[i]; | |
| 148 if (!plane.overlay_plane) | |
| 149 continue; | |
| 150 if (!drm_->PageFlipOverlay(crtc_id_, | |
| 151 plane.scanout->GetFramebufferId(), | |
| 152 plane.display_bounds, | |
| 153 plane.crop_rect, | |
| 154 plane.overlay_plane)) { | |
| 155 LOG(ERROR) << "Cannot display on overlay: " << strerror(errno); | |
| 156 return false; | |
| 157 } | |
| 158 } | |
| 159 } | |
| 160 | |
| 124 return true; | 161 return true; |
| 125 } | 162 } |
| 126 | 163 |
| 127 void HardwareDisplayController::WaitForPageFlipEvent() { | 164 void HardwareDisplayController::WaitForPageFlipEvent() { |
| 128 TRACE_EVENT0("dri", "WaitForPageFlipEvent"); | 165 TRACE_EVENT0("dri", "WaitForPageFlipEvent"); |
| 129 | 166 |
| 130 if (is_disabled_) | 167 if (is_disabled_) |
| 131 return; | 168 return; |
| 132 | 169 |
| 133 drmEventContext drm_event; | 170 drmEventContext drm_event; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 163 } | 200 } |
| 164 | 201 |
| 165 bool HardwareDisplayController::MoveCursor(const gfx::Point& location) { | 202 bool HardwareDisplayController::MoveCursor(const gfx::Point& location) { |
| 166 if (is_disabled_) | 203 if (is_disabled_) |
| 167 return true; | 204 return true; |
| 168 | 205 |
| 169 return drm_->MoveCursor(crtc_id_, location.x(), location.y()); | 206 return drm_->MoveCursor(crtc_id_, location.x(), location.y()); |
| 170 } | 207 } |
| 171 | 208 |
| 172 } // namespace ui | 209 } // namespace ui |
| OLD | NEW |