Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: ui/ozone/platform/dri/gbm_surfaceless.cc

Issue 960273003: ozone: dri: add synchronous SwapBuffers support on surfaceless (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Schedule asynchronous flip correctly on flip callback Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h"
8 #include "base/bind_helpers.h"
7 #include "ui/ozone/platform/dri/dri_vsync_provider.h" 9 #include "ui/ozone/platform/dri/dri_vsync_provider.h"
8 #include "ui/ozone/platform/dri/dri_window_delegate.h" 10 #include "ui/ozone/platform/dri/dri_window_delegate.h"
9 #include "ui/ozone/platform/dri/gbm_buffer.h" 11 #include "ui/ozone/platform/dri/gbm_buffer.h"
10 #include "ui/ozone/platform/dri/hardware_display_controller.h" 12 #include "ui/ozone/platform/dri/hardware_display_controller.h"
11 13
12 namespace ui { 14 namespace ui {
13 15
14 GbmSurfaceless::GbmSurfaceless(DriWindowDelegate* window_delegate) 16 GbmSurfaceless::GbmSurfaceless(DriWindowDelegate* window_delegate)
15 : window_delegate_(window_delegate) { 17 : window_delegate_(window_delegate) {
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 return true; 28 return true;
27 } 29 }
28 30
29 bool GbmSurfaceless::OnSwapBuffers() { 31 bool GbmSurfaceless::OnSwapBuffers() {
30 NOTREACHED(); 32 HardwareDisplayController* controller = window_delegate_->GetController();
31 return false; 33 if (!controller)
34 return true;
35
36 return controller->SchedulePageFlip(true /* is_sync */,
37 base::Bind(&base::DoNothing));
32 } 38 }
33 39
34 bool GbmSurfaceless::OnSwapBuffersAsync( 40 bool GbmSurfaceless::OnSwapBuffersAsync(
35 const SwapCompletionCallback& callback) { 41 const SwapCompletionCallback& callback) {
36 HardwareDisplayController* controller = window_delegate_->GetController(); 42 HardwareDisplayController* controller = window_delegate_->GetController();
37 if (!controller) { 43 if (!controller) {
38 callback.Run(); 44 callback.Run();
39 return true; 45 return true;
40 } 46 }
41 47
42 return controller->SchedulePageFlip(callback); 48 return controller->SchedulePageFlip(false /* is_sync */, callback);
43 } 49 }
44 50
45 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() { 51 scoped_ptr<gfx::VSyncProvider> GbmSurfaceless::CreateVSyncProvider() {
46 return make_scoped_ptr(new DriVSyncProvider(window_delegate_)); 52 return make_scoped_ptr(new DriVSyncProvider(window_delegate_));
47 } 53 }
48 54
49 } // namespace ui 55 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698