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/dri_window_delegate.h" | 8 #include "ui/ozone/platform/dri/dri_window_delegate.h" |
9 #include "ui/ozone/platform/dri/gbm_buffer.h" | 9 #include "ui/ozone/platform/dri/gbm_buffer.h" |
10 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 10 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
11 #include "ui/ozone/platform/dri/page_flip_event_handler.h" | |
11 | 12 |
12 namespace ui { | 13 namespace ui { |
13 | 14 |
14 GbmSurfaceless::GbmSurfaceless(DriWindowDelegate* window_delegate) | 15 GbmSurfaceless::GbmSurfaceless(DriWindowDelegate* window_delegate, |
15 : window_delegate_(window_delegate) { | 16 PageFilpEventHandler* handler) |
17 : window_delegate_(window_delegate), flip_handler_(handler) { | |
16 } | 18 } |
17 | 19 |
18 GbmSurfaceless::~GbmSurfaceless() {} | 20 GbmSurfaceless::~GbmSurfaceless() {} |
19 | 21 |
20 intptr_t GbmSurfaceless::GetNativeWindow() { | 22 intptr_t GbmSurfaceless::GetNativeWindow() { |
21 NOTREACHED(); | 23 NOTREACHED(); |
22 return 0; | 24 return 0; |
23 } | 25 } |
24 | 26 |
25 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { | 27 bool GbmSurfaceless::ResizeNativeWindow(const gfx::Size& viewport_size) { |
26 NOTIMPLEMENTED(); | 28 NOTIMPLEMENTED(); |
27 return false; | 29 return false; |
28 } | 30 } |
29 | 31 |
30 bool GbmSurfaceless::OnSwapBuffers() { | 32 bool GbmSurfaceless::OnSwapBuffers() { |
31 HardwareDisplayController* controller = window_delegate_->GetController(); | 33 HardwareDisplayController* controller = window_delegate_->GetController(); |
32 if (!controller) | 34 if (!controller) |
33 return true; | 35 return true; |
34 | 36 |
37 // Make sure any previous Page Flip requests have been processed, otherwise | |
38 // the drivers will complain as EBusy. We don't have support for Flip queue | |
39 // in any of the drivers. | |
40 if (flip_handler_) | |
41 flip_handler_->EnsurePreviousFlipHandled(); | |
brianderson
2014/12/10 22:48:05
Looks like this is a blocking call. Is this on a c
kalyank
2014/12/11 03:24:26
We swap, submit page flip requests and wait till t
kalyank
2014/12/11 12:55:58
Now, we don't block on Main thread at all. In GLSu
| |
42 | |
35 bool success = controller->SchedulePageFlip(); | 43 bool success = controller->SchedulePageFlip(); |
36 controller->WaitForPageFlipEvent(); | 44 if (!flip_handler_) |
45 controller->WaitForPageFlipEvent(); | |
46 else | |
47 flip_handler_->GetPageFlipCompleted(controller, callback_); | |
37 | 48 |
38 return success; | 49 return success; |
39 } | 50 } |
40 | 51 |
41 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { | 52 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { |
42 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(window_delegate_)); | 53 return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(window_delegate_)); |
43 } | 54 } |
44 | 55 |
56 void GbmSurfaceless::SetPageFlipCompletionCallback( | |
57 const PageFlipCompletionCallback& callback) { | |
58 callback_ = callback; | |
59 } | |
60 | |
45 } // namespace ui | 61 } // namespace ui |
OLD | NEW |