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

Side by Side Diff: ui/ozone/platform/dri/dri_surface.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/dri_surface.h" 5 #include "ui/ozone/platform/dri/dri_surface.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 DCHECK(base::MessageLoopForUI::IsCurrent()); 65 DCHECK(base::MessageLoopForUI::IsCurrent());
66 66
67 HardwareDisplayController* controller = window_delegate_->GetController(); 67 HardwareDisplayController* controller = window_delegate_->GetController();
68 if (!controller) 68 if (!controller)
69 return; 69 return;
70 70
71 DCHECK(buffers_[front_buffer_ ^ 1].get()); 71 DCHECK(buffers_[front_buffer_ ^ 1].get());
72 controller->QueueOverlayPlane(OverlayPlane(buffers_[front_buffer_ ^ 1])); 72 controller->QueueOverlayPlane(OverlayPlane(buffers_[front_buffer_ ^ 1]));
73 73
74 UpdateNativeSurface(damage); 74 UpdateNativeSurface(damage);
75 controller->SchedulePageFlip(base::Bind(&base::DoNothing)); 75 controller->SchedulePageFlip(false /* is_sync */,
76 base::Bind(&base::DoNothing));
76 77
77 // Update our front buffer pointer. 78 // Update our front buffer pointer.
78 front_buffer_ ^= 1; 79 front_buffer_ ^= 1;
79 } 80 }
80 81
81 scoped_ptr<gfx::VSyncProvider> DriSurface::CreateVSyncProvider() { 82 scoped_ptr<gfx::VSyncProvider> DriSurface::CreateVSyncProvider() {
82 return make_scoped_ptr(new DriVSyncProvider(window_delegate_)); 83 return make_scoped_ptr(new DriVSyncProvider(window_delegate_));
83 } 84 }
84 85
85 void DriSurface::UpdateNativeSurface(const gfx::Rect& damage) { 86 void DriSurface::UpdateNativeSurface(const gfx::Rect& damage) {
86 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas(); 87 SkCanvas* canvas = buffers_[front_buffer_ ^ 1]->GetCanvas();
87 88
88 // The DriSurface is double buffered, so the current back buffer is 89 // The DriSurface is double buffered, so the current back buffer is
89 // missing the previous update. Expand damage region. 90 // missing the previous update. Expand damage region.
90 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_)); 91 SkRect real_damage = RectToSkRect(UnionRects(damage, last_damage_));
91 92
92 // Copy damage region. 93 // Copy damage region.
93 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot()); 94 skia::RefPtr<SkImage> image = skia::AdoptRef(surface_->newImageSnapshot());
94 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL); 95 canvas->drawImageRect(image.get(), &real_damage, real_damage, NULL);
95 96
96 last_damage_ = damage; 97 last_damage_ = damage;
97 } 98 }
98 99
99 } // namespace ui 100 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/ozone/platform/dri/dri_wrapper.h » ('j') | ui/ozone/platform/dri/hardware_display_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698