Chromium Code Reviews| 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..e0dc36ee903874de84dccfaf392cb606dcff489a 100644 |
| --- a/ui/ozone/platform/dri/hardware_display_controller.cc |
| +++ b/ui/ozone/platform/dri/hardware_display_controller.cc |
| @@ -19,6 +19,7 @@ |
| #include "ui/ozone/platform/dri/dri_buffer.h" |
| #include "ui/ozone/platform/dri/dri_wrapper.h" |
| #include "ui/ozone/platform/dri/scanout_surface.h" |
| +#include "ui/ozone/public/native_pixmap.h" |
| namespace ui { |
| @@ -112,15 +113,58 @@ void HardwareDisplayController::Disable() { |
| is_disabled_ = true; |
| } |
| -bool HardwareDisplayController::SchedulePageFlip() { |
| - CHECK(surface_); |
| - if (!is_disabled_ && !drm_->PageFlip(crtc_id_, |
| - surface_->GetFramebufferId(), |
| - this)) { |
| +ScanoutSurface* HardwareDisplayController::GetPrimaryPlane( |
| + const std::vector<OzoneOverlayPlane>& overlays) { |
| + ScanoutSurface* primary = surface_.get(); |
| + for (size_t i = 0; i < overlays.size(); i++) { |
| + const OzoneOverlayPlane& plane = overlays[i]; |
| + if (plane.z_order == 0) { |
|
dnicoara
2014/07/10 17:00:56
Should replace |surface_| in this case otherwise l
achaulk
2014/07/10 17:07:50
We could NULL it, but we can't store any of the ov
dnicoara
2014/07/10 17:25:47
You can't NULL it otherwise SchedulePageFlip will
achaulk
2014/07/10 17:42:29
References are only taken on NativePixmap objects
dnicoara
2014/07/10 19:17:13
We clarified this offline :)
|
| + return plane.scanout; |
| + } |
| + } |
| + |
| + return primary; |
| +} |
| + |
| +bool HardwareDisplayController::SchedulePageFlip( |
| + const std::vector<OzoneOverlayPlane>& overlays, |
| + NativePixmapList* references) { |
| + ScanoutSurface* primary = GetPrimaryPlane(overlays); |
| + CHECK(primary); |
| + |
| + primary->PreSwapBuffers(); |
| + |
| + if (!is_disabled_ && |
| + !drm_->PageFlip(crtc_id_, primary->GetFramebufferId(), this)) { |
| LOG(ERROR) << "Cannot page flip: " << strerror(errno); |
| return false; |
| } |
| + current_overlay_references_.clear(); |
| + if (references) |
| + current_overlay_references_.swap(*references); |
| + |
| + for (size_t i = 0; i < overlays.size(); i++) { |
| + const OzoneOverlayPlane& plane = overlays[i]; |
| + if (!plane.overlay_plane) |
| + continue; |
| + const gfx::Size& size = plane.scanout->Size(); |
| + const gfx::SizeF sizef(size.width(), size.height()); |
| + const gfx::RectF& crop_rect = plane.crop_rect; |
| + gfx::RectF draw_rect(crop_rect.x() * sizef.width(), |
|
dnicoara
2014/07/10 19:53:52
I think you can just make crop_rect non-const and
achaulk
2014/07/11 16:57:49
Acknowledged.
|
| + crop_rect.y() * sizef.height(), |
| + crop_rect.width() * sizef.width(), |
| + crop_rect.height() * sizef.height()); |
| + if (!drm_->PageFlipOverlay(crtc_id_, |
| + plane.scanout->GetFramebufferId(), |
| + plane.display_bounds, |
| + draw_rect, |
| + plane.overlay_plane)) { |
| + LOG(ERROR) << "Cannot display on overlay: " << strerror(errno); |
| + return false; |
| + } |
| + } |
| + |
| return true; |
| } |