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/crtc_controller.h" | 5 #include "ui/ozone/platform/dri/crtc_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "ui/ozone/platform/dri/dri_wrapper.h" | 9 #include "ui/ozone/platform/dri/dri_wrapper.h" |
10 #include "ui/ozone/platform/dri/scanout_buffer.h" | 10 #include "ui/ozone/platform/dri/scanout_buffer.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 CrtcController::~CrtcController() { | 26 CrtcController::~CrtcController() { |
27 if (!is_disabled_) { | 27 if (!is_disabled_) { |
28 drm_->SetCrtc(saved_crtc_.get(), std::vector<uint32_t>(1, connector_)); | 28 drm_->SetCrtc(saved_crtc_.get(), std::vector<uint32_t>(1, connector_)); |
29 UnsetCursor(); | 29 UnsetCursor(); |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { | 33 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { |
34 if (!drm_->SetCrtc(crtc_, | 34 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), |
35 plane.buffer->GetFramebufferId(), | 35 std::vector<uint32_t>(1, connector_), &mode)) { |
36 std::vector<uint32_t>(1, connector_), | |
37 &mode)) { | |
38 LOG(ERROR) << "Failed to modeset: error='" << strerror(errno) | 36 LOG(ERROR) << "Failed to modeset: error='" << strerror(errno) |
39 << "' crtc=" << crtc_ << " connector=" << connector_ | 37 << "' crtc=" << crtc_ << " connector=" << connector_ |
40 << " framebuffer_id=" << plane.buffer->GetFramebufferId() | 38 << " framebuffer_id=" << plane.buffer->GetFramebufferId() |
41 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@" | 39 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@" |
42 << mode.vrefresh; | 40 << mode.vrefresh; |
43 return false; | 41 return false; |
44 } | 42 } |
45 | 43 |
46 current_planes_ = std::vector<OverlayPlane>(1, plane); | 44 current_planes_ = std::vector<OverlayPlane>(1, plane); |
47 mode_ = mode; | 45 mode_ = mode; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 pending_planes_ = overlays; | 85 pending_planes_ = overlays; |
88 | 86 |
89 for (size_t i = 0; i < overlays.size(); i++) { | 87 for (size_t i = 0; i < overlays.size(); i++) { |
90 const OverlayPlane& plane = overlays[i]; | 88 const OverlayPlane& plane = overlays[i]; |
91 if (!plane.overlay_plane) | 89 if (!plane.overlay_plane) |
92 continue; | 90 continue; |
93 | 91 |
94 const gfx::Size& size = plane.buffer->GetSize(); | 92 const gfx::Size& size = plane.buffer->GetSize(); |
95 gfx::RectF crop_rect = plane.crop_rect; | 93 gfx::RectF crop_rect = plane.crop_rect; |
96 crop_rect.Scale(size.width(), size.height()); | 94 crop_rect.Scale(size.width(), size.height()); |
97 if (!drm_->PageFlipOverlay(crtc_, | 95 if (!drm_->PageFlipOverlay(crtc_, plane.buffer->GetFramebufferId(), |
98 plane.buffer->GetFramebufferId(), | 96 plane.display_bounds, crop_rect, |
99 plane.display_bounds, | |
100 crop_rect, | |
101 plane.overlay_plane)) { | 97 plane.overlay_plane)) { |
102 LOG(ERROR) << "Cannot display on overlay: " << strerror(errno); | 98 LOG(ERROR) << "Cannot display on overlay: " << strerror(errno); |
103 return false; | 99 return false; |
104 } | 100 } |
105 } | 101 } |
106 | 102 |
107 return true; | 103 return true; |
108 } | 104 } |
109 | 105 |
110 void CrtcController::OnPageFlipEvent(unsigned int frame, | 106 void CrtcController::OnPageFlipEvent(unsigned int frame, |
(...skipping 19 matching lines...) Expand all Loading... |
130 cursor_buffer_ = NULL; | 126 cursor_buffer_ = NULL; |
131 return state; | 127 return state; |
132 } | 128 } |
133 | 129 |
134 bool CrtcController::MoveCursor(const gfx::Point& location) { | 130 bool CrtcController::MoveCursor(const gfx::Point& location) { |
135 DCHECK(!is_disabled_); | 131 DCHECK(!is_disabled_); |
136 return drm_->MoveCursor(crtc_, location); | 132 return drm_->MoveCursor(crtc_, location); |
137 } | 133 } |
138 | 134 |
139 } // namespace ui | 135 } // namespace ui |
OLD | NEW |