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

Unified Diff: ui/ozone/platform/drm/gpu/crtc_controller.cc

Issue 1085123002: ozone: drm: Restore cursor in CrtcController::Modeset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup test Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/gpu/crtc_controller.cc
diff --git a/ui/ozone/platform/drm/gpu/crtc_controller.cc b/ui/ozone/platform/drm/gpu/crtc_controller.cc
index e76db6d7f337855dc182f6b098ae2b990650335c..ce7ab7136ed8b6978e230297cadaf5ef77f58123 100644
--- a/ui/ozone/platform/drm/gpu/crtc_controller.cc
+++ b/ui/ozone/platform/drm/gpu/crtc_controller.cc
@@ -27,7 +27,7 @@ CrtcController::CrtcController(const scoped_refptr<DrmDevice>& drm,
CrtcController::~CrtcController() {
if (!is_disabled_) {
drm_->SetCrtc(saved_crtc_.get(), std::vector<uint32_t>(1, connector_));
- UnsetCursor();
+ SetCursor(nullptr);
}
}
@@ -54,6 +54,9 @@ bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) {
if (page_flip_pending_)
pending_planes_ = current_planes_;
+ if (!ResetCursor())
+ return false;
+
return true;
}
@@ -118,15 +121,10 @@ void CrtcController::OnPageFlipEvent(unsigned int frame,
}
bool CrtcController::SetCursor(const scoped_refptr<ScanoutBuffer>& buffer) {
- DCHECK(!is_disabled_);
+ DCHECK(!is_disabled_ || !buffer);
cursor_buffer_ = buffer;
- return drm_->SetCursor(crtc_, buffer->GetHandle(), buffer->GetSize());
-}
-bool CrtcController::UnsetCursor() {
- bool state = drm_->SetCursor(crtc_, 0, gfx::Size());
- cursor_buffer_ = NULL;
- return state;
+ return ResetCursor();
}
bool CrtcController::MoveCursor(const gfx::Point& location) {
@@ -142,4 +140,23 @@ void CrtcController::RemoveObserver(PageFlipObserver* observer) {
observers_.RemoveObserver(observer);
}
+bool CrtcController::ResetCursor() {
+ uint32_t handle = 0;
+ gfx::Size size;
+
+ if (cursor_buffer_) {
+ handle = cursor_buffer_->GetHandle();
+ size = cursor_buffer_->GetSize();
+ }
+
+ bool status = drm_->SetCursor(crtc_, handle, size);
+ if (!status) {
+ PLOG(ERROR) << "drmModeSetCursor: device " << drm_->device_path().value()
+ << " crtc " << crtc_ << " handle " << handle << " size "
+ << size.ToString();
+ }
+
+ return status;
+}
+
} // namespace ui
« no previous file with comments | « ui/ozone/platform/drm/gpu/crtc_controller.h ('k') | ui/ozone/platform/drm/gpu/hardware_display_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698