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

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

Issue 1416973015: [Ozone-DRM] Simplify CrtcController::SignalPageFlipRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 14 matching lines...) Expand all
25 drm_->plane_manager()->planes(); 25 drm_->plane_manager()->planes();
26 for (auto* plane : all_planes) { 26 for (auto* plane : all_planes) {
27 if (plane->owning_crtc() == crtc_) { 27 if (plane->owning_crtc() == crtc_) {
28 plane->set_owning_crtc(0); 28 plane->set_owning_crtc(0);
29 plane->set_in_use(false); 29 plane->set_in_use(false);
30 } 30 }
31 } 31 }
32 32
33 SetCursor(nullptr); 33 SetCursor(nullptr);
34 drm_->DisableCrtc(crtc_); 34 drm_->DisableCrtc(crtc_);
35 SignalPageFlipRequest(); 35 if (page_flip_request_)
36 SignalPageFlipRequest();
36 } 37 }
37 } 38 }
38 39
39 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) { 40 bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) {
40 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(), 41 if (!drm_->SetCrtc(crtc_, plane.buffer->GetFramebufferId(),
41 std::vector<uint32_t>(1, connector_), &mode)) { 42 std::vector<uint32_t>(1, connector_), &mode)) {
42 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_ 43 PLOG(ERROR) << "Failed to modeset: crtc=" << crtc_
43 << " connector=" << connector_ 44 << " connector=" << connector_
44 << " framebuffer_id=" << plane.buffer->GetFramebufferId() 45 << " framebuffer_id=" << plane.buffer->GetFramebufferId()
45 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@" 46 << " mode=" << mode.hdisplay << "x" << mode.vdisplay << "@"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (!status) { 162 if (!status) {
162 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value() 163 PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value()
163 << " crtc " << crtc_ << " handle " << handle << " size " 164 << " crtc " << crtc_ << " handle " << handle << " size "
164 << size.ToString(); 165 << size.ToString();
165 } 166 }
166 167
167 return status; 168 return status;
168 } 169 }
169 170
170 void CrtcController::SignalPageFlipRequest() { 171 void CrtcController::SignalPageFlipRequest() {
171 if (page_flip_request_.get()) { 172 scoped_refptr<PageFlipRequest> request;
172 // If another frame is queued up and available immediately, calling Signal() 173 request.swap(page_flip_request_);
173 // may result in a call to SchedulePageFlip(), which will override 174 request->Signal(gfx::SwapResult::SWAP_ACK);
174 // page_flip_request_ and possibly release the ref. Stash previous request
175 // locally to avoid deleting the object we are making a call on.
176 scoped_refptr<PageFlipRequest> last_request;
177 last_request.swap(page_flip_request_);
178 last_request->Signal(gfx::SwapResult::SWAP_ACK);
179 }
180 } 175 }
181 176
182 } // namespace ui 177 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698