Index: ui/ozone/platform/dri/hardware_display_controller.cc |
diff --git a/ui/ozone/platform/dri/hardware_display_controller.cc b/ui/ozone/platform/dri/hardware_display_controller.cc |
index 9e79118cc478f54ef612467b7bc1cd94088433b5..fd3666a94fe094127f162bf15ae47d89036cbe70 100644 |
--- a/ui/ozone/platform/dri/hardware_display_controller.cc |
+++ b/ui/ozone/platform/dri/hardware_display_controller.cc |
@@ -112,15 +112,52 @@ void HardwareDisplayController::Disable() { |
is_disabled_ = true; |
} |
-bool HardwareDisplayController::SchedulePageFlip() { |
- CHECK(surface_); |
- if (!is_disabled_ && !drm_->PageFlip(crtc_id_, |
- surface_->GetFramebufferId(), |
- this)) { |
+ScanoutSurface* HardwareDisplayController::AssignOverlayPlanes( |
+ std::vector<OzoneOverlayPlane>* overlays) { |
+ ScanoutSurface* primary = surface_.get(); |
dnicoara
2014/07/07 19:17:54
It seems that surface is going to be ignored. Can
achaulk
2014/07/07 20:18:04
It can't be *directly* replaced since HDC owns the
|
+ if (!overlays) |
+ return primary; |
+ for (size_t i = 0; i < overlays->size(); i++) { |
+ const OzoneOverlayPlane& plane = (*overlays)[i]; |
+ if (plane.z_order == 0) { |
+ primary = plane.scanout; |
+ } else { |
+ // TODO: assign overlay planes. |
+ } |
+ } |
+ |
+ return primary; |
+} |
+ |
+bool HardwareDisplayController::SchedulePageFlip( |
+ std::vector<OzoneOverlayPlane>* overlays) { |
+ ScanoutSurface* primary = AssignOverlayPlanes(overlays); |
+ CHECK(primary); |
+ |
+ primary->PreSwapBuffers(); |
+ |
+ if (!is_disabled_ && |
+ !drm_->PageFlip(crtc_id_, primary->GetFramebufferId(), this)) { |
LOG(ERROR) << "Cannot page flip: " << strerror(errno); |
return false; |
} |
+ if (overlays) { |
+ for (size_t i = 0; i < overlays->size(); i++) { |
+ const OzoneOverlayPlane& plane = (*overlays)[i]; |
+ if (!plane.overlay_plane) |
+ continue; |
+ if (!drm_->PageFlipOverlay(crtc_id_, |
+ plane.scanout->GetFramebufferId(), |
+ plane.display_bounds, |
+ plane.crop_rect, |
+ plane.overlay_plane)) { |
+ LOG(ERROR) << "Cannot display on overlay: " << strerror(errno); |
+ return false; |
+ } |
+ } |
+ } |
+ |
return true; |
} |