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

Unified Diff: ui/ozone/platform/dri/crtc_controller.cc

Issue 821023003: [Ozone-DRI] Listen for swap events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@async-swap
Patch Set: Added comment Created 5 years, 11 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
« no previous file with comments | « ui/ozone/platform/dri/crtc_controller.h ('k') | ui/ozone/platform/dri/dri_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/crtc_controller.cc
diff --git a/ui/ozone/platform/dri/crtc_controller.cc b/ui/ozone/platform/dri/crtc_controller.cc
index a94ac18c2b0db65ce754a2390ce5aae2fea9377b..fd2ff6656a7ad292debd49fdd3500f7b31d0cf6c 100644
--- a/ui/ozone/platform/dri/crtc_controller.cc
+++ b/ui/ozone/platform/dri/crtc_controller.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/time/time.h"
#include "ui/ozone/platform/dri/dri_wrapper.h"
+#include "ui/ozone/platform/dri/page_flip_observer.h"
#include "ui/ozone/platform/dri/scanout_buffer.h"
namespace ui {
@@ -41,11 +42,17 @@ bool CrtcController::Modeset(const OverlayPlane& plane, drmModeModeInfo mode) {
return false;
}
- current_planes_ = std::vector<OverlayPlane>(1, plane);
mode_ = mode;
pending_planes_.clear();
is_disabled_ = false;
- page_flip_pending_ = false;
+
+ // drmModeSetCrtc has an immediate effect, so we can assume that the current
+ // planes have been updated. However if a page flip is still pending, set the
+ // pending planes to the same values so that the callback keeps the correct
+ // state.
+ current_planes_ = std::vector<OverlayPlane>(1, plane);
+ if (page_flip_pending_)
+ pending_planes_ = current_planes_;
return true;
}
@@ -55,7 +62,6 @@ bool CrtcController::Disable() {
return true;
is_disabled_ = true;
- page_flip_pending_ = false;
return drm_->DisableCrtc(crtc_);
}
@@ -66,6 +72,7 @@ bool CrtcController::SchedulePageFlip(HardwareDisplayPlaneList* plane_list,
const OverlayPlane* primary = OverlayPlane::GetPrimaryPlane(overlays);
if (!primary) {
LOG(ERROR) << "No primary plane to display on crtc " << crtc_;
+ FOR_EACH_OBSERVER(PageFlipObserver, observers_, OnPageFlipEvent());
return true;
}
DCHECK(primary->buffer.get());
@@ -75,6 +82,7 @@ bool CrtcController::SchedulePageFlip(HardwareDisplayPlaneList* plane_list,
<< mode_.hdisplay << "x" << mode_.vdisplay << " got "
<< primary->buffer->GetSize().ToString() << " for"
<< " crtc=" << crtc_ << " connector=" << connector_;
+ FOR_EACH_OBSERVER(PageFlipObserver, observers_, OnPageFlipEvent());
return true;
}
@@ -105,6 +113,8 @@ void CrtcController::OnPageFlipEvent(unsigned int frame,
current_planes_.clear();
current_planes_.swap(pending_planes_);
+
+ FOR_EACH_OBSERVER(PageFlipObserver, observers_, OnPageFlipEvent());
}
bool CrtcController::SetCursor(const scoped_refptr<ScanoutBuffer>& buffer) {
@@ -124,4 +134,12 @@ bool CrtcController::MoveCursor(const gfx::Point& location) {
return drm_->MoveCursor(crtc_, location);
}
+void CrtcController::AddObserver(PageFlipObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void CrtcController::RemoveObserver(PageFlipObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
} // namespace ui
« no previous file with comments | « ui/ozone/platform/dri/crtc_controller.h ('k') | ui/ozone/platform/dri/dri_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698