Chromium Code Reviews| Index: ui/ozone/platform/dri/gbm_surface_factory.cc |
| diff --git a/ui/ozone/platform/dri/gbm_surface_factory.cc b/ui/ozone/platform/dri/gbm_surface_factory.cc |
| index 51cd227bf36c7604d7bc401f4491c332c15cf35e..0ff51f8b0ac451cd89086a39992a215701b5e9ca 100644 |
| --- a/ui/ozone/platform/dri/gbm_surface_factory.cc |
| +++ b/ui/ozone/platform/dri/gbm_surface_factory.cc |
| @@ -15,6 +15,7 @@ |
| #include "ui/ozone/platform/dri/hardware_display_controller.h" |
| #include "ui/ozone/platform/dri/scanout_surface.h" |
| #include "ui/ozone/platform/dri/screen_manager.h" |
| +#include "ui/ozone/public/native_pixmap.h" |
| #include "ui/ozone/public/surface_ozone_egl.h" |
| namespace ui { |
| @@ -39,6 +40,9 @@ class GbmSurfaceAdapter : public ui::SurfaceOzoneEGL { |
| private: |
| base::WeakPtr<HardwareDisplayController> controller_; |
| + std::vector<scoped_refptr<NativePixmap> > overlay_refs_; |
| + std::vector<scoped_refptr<NativePixmap> > old_overlay_refs_; |
| + std::vector<OzoneOverlayPlane> overlays_; |
| DISALLOW_COPY_AND_ASSIGN(GbmSurfaceAdapter); |
| }; |
| @@ -65,24 +69,32 @@ bool GbmSurfaceAdapter::ResizeNativeWindow(const gfx::Size& viewport_size) { |
| bool GbmSurfaceAdapter::OnSwapBuffers() { |
| if (!controller_) |
| return false; |
| + bool ret = controller_->SchedulePageFlip(&overlays_); |
|
dnicoara
2014/07/07 19:17:54
I think it would be better if HDC takes a referenc
achaulk
2014/07/07 20:18:04
Done.
|
| + overlays_.clear(); |
| + old_overlay_refs_.clear(); |
| + old_overlay_refs_.swap(overlay_refs_); |
| - static_cast<GbmSurface*>(controller_->surface())->LockCurrentDrawable(); |
| - if (controller_->SchedulePageFlip()) { |
| + if (ret) |
| controller_->WaitForPageFlipEvent(); |
| - return true; |
| - } |
| - return false; |
| + return ret; |
| } |
| bool GbmSurfaceAdapter::ScheduleOverlayPlane( |
| int plane_z_order, |
| gfx::OverlayTransform plane_transform, |
| - scoped_refptr<ui::NativePixmap> buffer, |
| + scoped_refptr<NativePixmap> buffer, |
| const gfx::Rect& display_bounds, |
| const gfx::RectF& crop_rect) { |
| - NOTIMPLEMENTED(); |
| - return false; |
| + GbmBuffer* gbm_buffer = static_cast<GbmBuffer*>(buffer.get()); |
| + if (!gbm_buffer) { |
| + LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer"; |
| + return false; |
| + } |
| + overlays_.push_back(OzoneOverlayPlane( |
| + gbm_buffer, plane_z_order, plane_transform, display_bounds, crop_rect)); |
| + overlay_refs_.push_back(buffer); |
| + return true; |
| } |
| scoped_ptr<gfx::VSyncProvider> GbmSurfaceAdapter::CreateVSyncProvider() { |
| @@ -183,4 +195,8 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
| return buf; |
| } |
| +bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { |
| + return false; |
| +} |
| + |
| } // namespace ui |