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..a6cb9bd61105f55a9f548ee18b52248f5b7faa50 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,8 @@ class GbmSurfaceAdapter : public ui::SurfaceOzoneEGL { |
| private: |
| base::WeakPtr<HardwareDisplayController> controller_; |
| + std::vector<scoped_refptr<NativePixmap> > overlay_refs_; |
|
alexst (slow to review)
2014/07/08 17:22:32
nit: these vector declarations are re-used in a bu
achaulk
2014/07/08 18:16:37
Sure
|
| + std::vector<OzoneOverlayPlane> overlays_; |
| DISALLOW_COPY_AND_ASSIGN(GbmSurfaceAdapter); |
| }; |
| @@ -65,24 +68,30 @@ bool GbmSurfaceAdapter::ResizeNativeWindow(const gfx::Size& viewport_size) { |
| bool GbmSurfaceAdapter::OnSwapBuffers() { |
| if (!controller_) |
| return false; |
| + bool ret = controller_->SchedulePageFlip(&overlays_, &overlay_refs_); |
|
alexst (slow to review)
2014/07/08 17:22:32
this is hard to read without context, please renam
achaulk
2014/07/08 18:16:37
Done.
|
| + overlays_.clear(); |
| - 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() { |
| @@ -91,9 +100,11 @@ scoped_ptr<gfx::VSyncProvider> GbmSurfaceAdapter::CreateVSyncProvider() { |
| } // namespace |
| -GbmSurfaceFactory::GbmSurfaceFactory() |
| +GbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless) |
| : DriSurfaceFactory(NULL, NULL), |
| - device_(NULL) {} |
| + device_(NULL), |
| + allow_surfaceless_(allow_surfaceless) { |
| +} |
| GbmSurfaceFactory::~GbmSurfaceFactory() {} |
| @@ -183,4 +194,8 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap( |
| return buf; |
| } |
| +bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { |
| + return allow_surfaceless_; |
| +} |
| + |
| } // namespace ui |