OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/dri/gbm_surfaceless.h" | 5 #include "ui/ozone/platform/dri/gbm_surfaceless.h" |
6 | 6 |
7 #include "ui/ozone/platform/dri/dri_vsync_provider.h" | 7 #include "ui/ozone/platform/dri/dri_vsync_provider.h" |
8 #include "ui/ozone/platform/dri/gbm_buffer.h" | 8 #include "ui/ozone/platform/dri/gbm_buffer.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { | 23 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { |
24 NOTIMPLEMENTED(); | 24 NOTIMPLEMENTED(); |
25 return false; | 25 return false; |
26 } | 26 } |
27 | 27 |
28 bool GbmSurfaceless::OnSwapBuffers() { | 28 bool GbmSurfaceless::OnSwapBuffers() { |
29 if (!controller_) | 29 if (!controller_) |
30 return true; | 30 return true; |
31 | 31 |
32 bool success = controller_->SchedulePageFlip(queued_planes_); | 32 bool success = controller_->SchedulePageFlip(); |
33 queued_planes_.clear(); | |
34 // Even on failure we may have scheduled some planes. Allow the controller to | |
35 // wait for the events for the scheduled planes. | |
36 controller_->WaitForPageFlipEvent(); | 33 controller_->WaitForPageFlipEvent(); |
37 | 34 |
38 return success; | 35 return success; |
39 } | 36 } |
40 | 37 |
41 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { | 38 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { |
42 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); | 39 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_)); |
43 } | 40 } |
44 | 41 |
45 bool GbmSurfaceless::ScheduleOverlayPlane( | |
46 int plane_z_order, | |
47 gfx::OverlayTransform plane_transform, | |
48 scoped_refptr<ui::NativePixmap> buffer, | |
49 const gfx::Rect& display_bounds, | |
50 const gfx::RectF& crop_rect) { | |
51 scoped_refptr<GbmPixmap> pixmap = | |
52 static_cast<GbmPixmap*>(buffer.get()); | |
53 if (!pixmap) { | |
54 LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer."; | |
55 return false; | |
56 } | |
57 | |
58 queued_planes_.push_back(OverlayPlane(pixmap->buffer(), | |
59 plane_z_order, | |
60 plane_transform, | |
61 display_bounds, | |
62 crop_rect)); | |
63 return true; | |
64 } | |
65 | |
66 } // namespace ui | 42 } // namespace ui |
OLD | NEW |