Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: ui/ozone/platform/drm/gpu/crtc_controller.cc

Issue 1294113005: Atomic: Don’t keep track of Cursor planes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/drm/gpu/crtc_controller.h" 5 #include "ui/ozone/platform/drm/gpu/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/drm/gpu/drm_device.h" 9 #include "ui/ozone/platform/drm/gpu/drm_device.h"
10 #include "ui/ozone/platform/drm/gpu/page_flip_request.h" 10 #include "ui/ozone/platform/drm/gpu/page_flip_request.h"
11 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" 11 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 CrtcController::CrtcController(const scoped_refptr<DrmDevice>& drm, 15 CrtcController::CrtcController(const scoped_refptr<DrmDevice>& drm,
16 uint32_t crtc, 16 uint32_t crtc,
17 uint32_t connector) 17 uint32_t connector)
18 : drm_(drm), 18 : drm_(drm), cursor_plane_(nullptr), crtc_(crtc), connector_(connector) {}
19 crtc_(crtc),
20 connector_(connector) {}
21 19
22 CrtcController::~CrtcController() { 20 CrtcController::~CrtcController() {
23 if (!is_disabled_) { 21 if (!is_disabled_) {
24 const ScopedVector<HardwareDisplayPlane>& all_planes = 22 const ScopedVector<HardwareDisplayPlane>& all_planes =
25 drm_->plane_manager()->planes(); 23 drm_->plane_manager()->planes();
26 for (auto* plane : all_planes) { 24 for (auto* plane : all_planes) {
27 if (plane->owning_crtc() == crtc_) { 25 if (plane->owning_crtc() == crtc_) {
28 plane->set_owning_crtc(0); 26 plane->set_owning_crtc(0);
29 plane->set_in_use(false); 27 plane->set_in_use(false);
30 } 28 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 137 }
140 138
141 bool CrtcController::MoveCursor(const gfx::Point& location) { 139 bool CrtcController::MoveCursor(const gfx::Point& location) {
142 DCHECK(!is_disabled_); 140 DCHECK(!is_disabled_);
143 return drm_->MoveCursor(crtc_, location); 141 return drm_->MoveCursor(crtc_, location);
144 } 142 }
145 143
146 bool CrtcController::ResetCursor() { 144 bool CrtcController::ResetCursor() {
147 uint32_t handle = 0; 145 uint32_t handle = 0;
148 gfx::Size size; 146 gfx::Size size;
149 147 #if defined(USE_DRM_ATOMIC)
148 if (!cursor_plane_) {
149 const ScopedVector<HardwareDisplayPlane>& all_planes =
150 drm_->plane_manager()->planes();
151 for (auto* plane : all_planes) {
152 if (plane->CanUseForCrtc(crtc_) && !plane->owning_crtc() &&
dnicoara 2015/08/20 14:22:45 I think that the plane allocation logic will serve
kalyank 2015/08/20 16:36:17 Removed the extra check related to owned crtc.
kalyank 2015/08/20 16:36:18 Done.
153 (plane->type() == HardwareDisplayPlane::Cursor)) {
154 cursor_plane_ = plane;
155 }
156 }
157 }
158 #endif
150 if (cursor_buffer_) { 159 if (cursor_buffer_) {
151 handle = cursor_buffer_->GetHandle(); 160 handle = cursor_buffer_->GetHandle();
152 size = cursor_buffer_->GetSize(); 161 size = cursor_buffer_->GetSize();
153 } 162 }
154 163
155 bool status = drm_->SetCursor(crtc_, handle, size); 164 bool status = drm_->SetCursor(crtc_, handle, size);
165 if (cursor_plane_) {
166 if (status && handle) {
167 cursor_plane_->set_owning_crtc(crtc_);
168 cursor_plane_->set_in_use(true);
169 } else {
170 cursor_plane_->set_owning_crtc(0);
171 cursor_plane_->set_in_use(false);
172 cursor_plane_ = nullptr;
173 }
174 }
175
156 if (!status) { 176 if (!status) {
157 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value() 177 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value()
158 << " crtc " << crtc_ << " handle " << handle << " size " 178 << " crtc " << crtc_ << " handle " << handle << " size "
159 << size.ToString(); 179 << size.ToString();
160 } 180 }
161 181
162 return status; 182 return status;
163 } 183 }
164 184
165 void CrtcController::SignalPageFlipRequest() { 185 void CrtcController::SignalPageFlipRequest() {
166 if (page_flip_request_.get()) { 186 if (page_flip_request_.get()) {
167 // If another frame is queued up and available immediately, calling Signal() 187 // If another frame is queued up and available immediately, calling Signal()
168 // may result in a call to SchedulePageFlip(), which will override 188 // may result in a call to SchedulePageFlip(), which will override
169 // page_flip_request_ and possibly release the ref. Stash previous request 189 // page_flip_request_ and possibly release the ref. Stash previous request
170 // locally to avoid deleting the object we are making a call on. 190 // locally to avoid deleting the object we are making a call on.
171 scoped_refptr<PageFlipRequest> last_request; 191 scoped_refptr<PageFlipRequest> last_request;
172 last_request.swap(page_flip_request_); 192 last_request.swap(page_flip_request_);
173 last_request->Signal(gfx::SwapResult::SWAP_ACK); 193 last_request->Signal(gfx::SwapResult::SWAP_ACK);
174 } 194 }
175 } 195 }
176 196
177 } // namespace ui 197 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698